The <tt>llvm.gcroot</tt> intrinsic is used to inform LLVM of a pointer variable
on the stack. The first argument contains the address of the variable on the
stack, and the second contains a pointer to metadata that should be associated
-with the pointer (which <b>must</b> be a constant or global value address). At
-runtime, the <tt>llvm.gcroot</tt> intrinsic stores a null pointer into the
-specified location to initialize the pointer.</p>
+with the pointer (which <b>must</b> be a constant or global value address).</p>
<p>
Consider the following fragment of Java code:
%X = alloca %Object*
...
+ ;; Java null-initializes pointers.
+ store %Object* null, %Object** %X
+
;; "CodeBlock" is the block corresponding to the start
;; of the scope above.
CodeBlock:
new StoreInst(Null, RootPtrPtr, IP);
// Each occurrance of the llvm.gcroot intrinsic now turns into an
- // initialization of the slot with the address and a zeroing out of the
- // address specified.
- new StoreInst(Constant::getNullValue(PtrLocTy->getElementType()),
- GCRoots[i]->getOperand(1), GCRoots[i]);
+ // initialization of the slot with the address.
new StoreInst(GCRoots[i]->getOperand(1), RootPtrPtr, GCRoots[i]);
}