<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
Firstly, rather than using a single 1 word pointer to represent a reference I<br>
chose to use 3 words including a pointer to the type and a pointer to the<br>
value (as well as metadata). This allows typed nulls and that addresses an<br>
important deficiency found in most other VMs including the CLR. Is Scarcity<br>
able to handle such references or does its implementation of stack frames<br>
require references to be a single word?<br></blockquote><br>Three words sounds pretty expensive to me, I can see the use of an extra word for typed nulls. If you look at something like the CLR you will see that you have very fast access to an objects type, after all when you have a reference to an object what you really have is a reference to an objects' object header. From there you can access an objects syncblock (if it has one, which is before the obj header) and the objects' method table which includes the relevant pointers to the objects' type among other things. It simply means you do a few hops, each of which is a constant operation anyway.<br>
<br>Maybe I'm missing something key about the language you are implementing the GC for, also is it really necessary to use an extra word for null types? <br><br>Granville<br><br><div class="gmail_quote">2009/6/18 Jon Harrop <span dir="ltr"><<a href="mailto:jon@ffconsultancy.com">jon@ffconsultancy.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Tuesday 16 June 2009 07:37:32 Talin wrote:<br>
> A while back there was a discussion thread about whether an accurate,<br>
> concurrent garbage collector could be "generic" in the sense of being<br>
> able to support multiple different languages efficiently. After having<br>
> done some work on this, I now believe that this is the case - using C++<br>
> policy-based design principles, you can create a set of modules that<br>
> represent different aspects of collector behavior (such as<br>
> mark-and-sweep, stop-the-world, and so on) along with different aspects<br>
> of the runtime environment (object tracing strategies, heap structures,<br>
> threading primitives, atomics), and encode these various behaviors as<br>
> template classes which can be bound together to create an efficient<br>
> collector.<br>
<br>
</div>Hi Talin,<br>
<br>
This is great news! I have some questions...<br>
<br>
I had great success using some seemingly-unusual techniques in my experiments.<br>
<br>
Firstly, rather than using a single 1 word pointer to represent a reference I<br>
chose to use 3 words including a pointer to the type and a pointer to the<br>
value (as well as metadata). This allows typed nulls and that addresses an<br>
important deficiency found in most other VMs including the CLR. Is Scarcity<br>
able to handle such references or does its implementation of stack frames<br>
require references to be a single word?<br>
<br>
Secondly, I used LLVM to JIT compile per-type code for garbage collection in<br>
order to traverse data structures as efficiently as possible. Moreover, I<br>
chose to write the entire GC in an unsafe subset of the language that I was<br>
implementing so that I could rely upon tail calls and so forth. Does Scarcity<br>
require the GC code to be written entirely in C?<br>
<br>
Finally, do you have any references describing the techniques you have used to<br>
implement a concurrent GC? I have been reading up on the subject for several<br>
years now, with a view to implementing my own concurrent GC.<br>
<font color="#888888"><br>
--<br>
Dr Jon Harrop, Flying Frog Consultancy Ltd.<br>
<a href="http://www.ffconsultancy.com/?e" target="_blank">http://www.ffconsultancy.com/?e</a><br>
</font><div><div></div><div class="h5">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Granville Barnett<br><a href="http://gbarnett.github.com">http://gbarnett.github.com</a><br>