<div><div class="gmail_quote"><div>snip</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<br>
> My problem is that I can't see how to address this without generating<br>
> horribly bloated and inefficient code. Pretty much every function argument<br>
> that isn't a simple integer or float will have to be copied to a hidden<br>
> local variable before every function call - in addition to copying it to the<br>
> stack to create the call frame. Even local variables are not immune if you<br>
> allow closures in your language. Under this scenario, calling conventions<br>
> that pass arguments in registers are utterly futile and save nothing,<br>
> because everything has to get copied to the stack anyway.<br>
<br>
</div>One way or another, stack roots *must* get copied to the stack, so<br>
that the GC can find them.  Remember the GC is usually running in some<br>
other thread and can *only* find pointers that live somewhere in<br>
memory (either the stack or the heap).<br></blockquote></div></div></div></blockquote><div><br></div><div><div>I think the logic is that by putting the responsibility for having stack roots on the caller, the callee's do not need to concern themselves with their arguments. A function using a gc'ed pointer assumes that a caller somewhere up the call-chain has created a gcroot for that pointer that will outlive its invocation therefore it doesn't need to do anything with the garbage collector.<div>
<br></div><div>In the case of the 'this' pointer, only the function that got the 'this' pointer from somewhere else (global, heap) would be responsible for creating a gcroot, once this is done the 'this' pointer can be passed through any number of calls and no more roots are required as long as the pointer is not stored somewhere that will outlive the invocation.<br>
</div></div></div><div><br></div><div>snip</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>-- Talin<br>
</div>
<br>_______________________________________________<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>
<br></blockquote></div><div><br></div></div><div>- Nathan</div>