fix syntax
[oota-llvm.git] / docs / GarbageCollection.html
index 0accd0c78a09796cb876e7eea47086c36e42a8b7..dc52a8b2efb90b7369f4b2bf1e1059878aa9653b 100644 (file)
@@ -159,16 +159,14 @@ interface that front-end authors should generate code for.
 <div class="doc_text">
 
 <div class="doc_code"><tt>
-  void %llvm.gcroot(&lt;ty&gt;** %ptrloc, &lt;ty2&gt;* %metadata)
+  void %llvm.gcroot(i8** %ptrloc, i8* %metadata)
 </tt></div>
 
 <p>
 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:
@@ -193,13 +191,17 @@ Entry:
    %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:
    ;; Initialize the object, telling LLVM that it is now live.
    ;; Java has type-tags on objects, so it doesn't need any
    ;; metadata.
-   call void %llvm.gcroot(%Object** %X, sbyte* null)
+   %tmp = bitcast %Object** %X to i8**
+   call void %llvm.gcroot(i8** %tmp, i8* null)
    ...
 
    ;; As the pointer goes out of scope, store a null value into
@@ -218,7 +220,7 @@ CodeBlock:
 <div class="doc_text">
 
 <div class="doc_code"><tt>
-  sbyte *%llvm_gc_allocate(unsigned %Size)
+  void *llvm_gc_allocate(unsigned Size)
 </tt></div>
 
 <p>The <tt>llvm_gc_allocate</tt> function is a global function defined by the
@@ -235,8 +237,8 @@ zeroed-out block of memory of the appropriate size.</p>
 <div class="doc_text">
 
 <div class="doc_code"><tt>
-  sbyte *%llvm.gcread(sbyte *, sbyte **)<br>
-  void %llvm.gcwrite(sbyte*, sbyte*, sbyte**)
+  i8 *%llvm.gcread(i8 *, i8 **)<br>
+  void %llvm.gcwrite(i8*, i8*, i8**)
 </tt></div>
 
 <p>Several of the more interesting garbage collectors (e.g., generational