[llvm-commits] Patch to allow llvm.gcroot to work with non-pointer allocas.

Talin viridia at gmail.com
Thu Sep 16 23:32:13 PDT 2010


This patch modifies Verifier.cpp to allow the first argument to llvm.gcroot
to be a "non-pointer" alloca. This allows you to have an alloca of, say,
struct type which may contain pointers that need to be traced. Note that the
first argument is still required to be an alloca, but is no longer required
to be an alloca of a pointer.

For safety, the code requires the metadata argument to llvm.gcroot to be a
non-null constant if the first argument is anything but a pointer. The
theory is that gcroot will need some kind of information about the structure
of the item being traced in order to interpret it. Allocas which are
pointers can point to tagged objects of some sort, so the metadata is
optional in that case.

I've currently written a bunch of code for my own compiler which relies on
this patch. (I'm fairly far along on a non-shadow-stack gc, which creates
static call frame descriptor maps that store all of the offsets of pointers
within the call frame. This will make it possible to handle concurrent
collection, which shadow-stack cannot do. The hardest part so far has been
supporting union types, which may or may not be traced depending on what's
in the union at the moment.)

-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100916/c89a8c71/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcroot.patch
Type: text/x-patch
Size: 1025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100916/c89a8c71/attachment.bin>


More information about the llvm-commits mailing list