<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">Chris,</span></span></span></div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">For your review.<br class="Apple-interchange-newline"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><br class="khtml-block-placeholder"></div>Thanks!</span></span></span></span></span></span></div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Trebuchet MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">— Gordon<br class="Apple-interchange-newline"></span></span></span></span></span></span> </div><br><div><br class="webkit-block-placeholder"></div><div><div>//===-- gc-0-docs.patch (+1170 -241) --------------------------===//</div><div><br class="webkit-block-placeholder"></div><div>  runtime/GC/SemiSpace/README.txt (+5)</div><div>  docs/llvm.css (+1 -1)</div><div>  docs/Lexicon.html (+76 -3)</div><div>  docs/GarbageCollection.html (+1088 -237)</div><div><br class="webkit-block-placeholder"></div><div>GarbageCollection.html is expanded to encompass the new</div><div>capabilities. This is a major rewrite and is easier to read en toto</div><div>rather than patchwise:</div><div><br class="webkit-block-placeholder"></div><div><a href="http://homepage.mac.com/malichus/GarbageCollection.html">http://homepage.mac.com/malichus/GarbageCollection.html</a></div><div><br class="webkit-block-placeholder"></div><div>This patch is independent.</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>//===-- gc-1-registry.patch (+300) ----------------------------===//</div><div><br class="webkit-block-placeholder"></div><div>  include/llvm/Support/Registry.h (+243)</div><div>  include/llvm/CodeGen/Collectors.h (+36)</div><div>  lib/CodeGen/Collectors.cpp (+21)</div><div><br class="webkit-block-placeholder"></div><div>My previous Registry.h header, as well as Collectors.h, which is the</div><div>registry for dynamically-loaded garbage collectors.</div><div><br class="webkit-block-placeholder"></div><div>This patch is independent.</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>//===-- gc-2-metadata.patch (+383) ----------------------------===//</div><div><br class="webkit-block-placeholder"></div><div>  include/llvm/CodeGen/CollectorMetadata.h (+198)</div><div>  lib/CodeGen/CollectorMetadata.cpp (+185)</div><div><br class="webkit-block-placeholder"></div><div>CollectorMetadata is the data structure populated by back-ends</div><div>during code-generation.</div><div><br class="webkit-block-placeholder"></div><div>This patch is independent.</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>//===-- gc-3-collector.patch (+531) ---------------------------===//</div><div><br class="webkit-block-placeholder"></div><div>  include/llvm/CodeGen/Collector.h (+134)</div><div>  lib/CodeGen/Collector.cpp (+359)</div><div>  lib/CodeGen/README.txt (+38)</div><div><br class="webkit-block-placeholder"></div><div>Collector is the base class for garbage collector code generators.</div><div>This version enhances the previous patch to add root initialization</div><div>as discussed here:</div><div><br class="webkit-block-placeholder"></div><div><a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070910/053455.html">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070910/053455.html</a></div><div><br class="webkit-block-placeholder"></div><div>Collector gives its subclasses control over generic algorithms:</div><div><br class="webkit-block-placeholder"></div><div>  unsigned NeededSafePoints; //< Bitmask of required safe points.</div><div>  bool CustomReadBarriers;   //< Default is to insert loads.</div><div>  bool CustomWriteBarriers;  //< Default is to insert stores.</div><div>  bool CustomRoots;          //< Default is to pass through to backend.</div><div>  bool InitRoots;            //< If set, roots are nulled during lowering.</div><div><br class="webkit-block-placeholder"></div><div>It also has callbacks which collectors can hook:</div><div><br class="webkit-block-placeholder"></div><div>  /// If any of the actions are set to Custom, this is expected to</div><div>  /// be overriden to create a transform to lower those actions to</div><div>  /// LLVM IR.</div><div>  virtual Pass *createCustomLoweringPass() const;</div><div><br class="webkit-block-placeholder"></div><div>  /// beginAssembly/finishAssembly - Emit module metadata as</div><div>  /// assembly code.</div><div>  virtual void beginAssembly(Module &M, std::ostream &OS,</div><div>                             AsmPrinter &AP,</div><div>                             const TargetAsmInfo &TAI) const;</div><div>  virtual void finishAssembly(Module &M,</div><div>                              CollectorModuleMetadata &CMM,</div><div>                              std::ostream &OS, AsmPrinter &AP,</div><div>                              const TargetAsmInfo &TAI) const;  </div><div><br class="webkit-block-placeholder"></div><div>Various other independent algorithms could be implemented, but were</div><div>not necessary for the initial two collectors. Some examples are</div><div>listed here:</div><div><br class="webkit-block-placeholder"></div><div><a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-August/010500.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-August/010500.html</a></div><div><br class="webkit-block-placeholder"></div><div>This patch depends on gc-2-metadata.</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>//===-- gc-4-integration.patch (+116 -17) ---------------------===//</div><div><br class="webkit-block-placeholder"></div><div>  include/llvm/CodeGen/LinkAllCodegenComponents.h (+4)</div><div>  include/llvm/CodeGen/SelectionDAGISel.h (+3 -1)</div><div>  include/llvm/CodeGen/AsmPrinter.h (+4)</div><div>  tools/llc/llc.cpp (+13)</div><div>  lib/CodeGen/LLVMTargetMachine.cpp (+28 -4)</div><div>  lib/CodeGen/AsmPrinter.cpp (+15)</div><div>  lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (+41 -9)</div><div>  lib/Target/ARM/ARMAsmPrinter.cpp (+1)</div><div>  lib/Target/X86/X86AsmPrinter.h (+1 -1)</div><div>  lib/Target/CBackend/CBackend.cpp (+3 -1)</div><div>  lib/Target/MSIL/MSILWriter.cpp (+3 -1)</div><div><br class="webkit-block-placeholder"></div><div>In this patch, Collector winds its tendrils throughout the compiler.</div><div>Overhead should be minimal when disabled.</div><div><br class="webkit-block-placeholder"></div><div>I would particularly appreciate any feedback on this interface.</div><div>The primary item of concern to me is that I exposed the desired</div><div>collector to the compiler using a global. I have not decided on a</div><div>better approach. In the meantime, it works and is simple.</div><div><br class="webkit-block-placeholder"></div><div>Less concretely, I am not convinced that Collector is well-factored</div><div>in its interaction with TargetMachine et al. Collector and</div><div>TargetMachine have no way of sniffing their respective capabilities</div><div>and requirements. So llc -march=c -gc=ocaml with silently do the</div><div>wrong thing; likewise the JIT, object writers, and MSIL backend.</div><div><br class="webkit-block-placeholder"></div><div>Finally, the -gc option is mandatory if collector intrinsics are</div><div>used. This is somewhat sensible since there is no default collector</div><div>runtime (excluding the MSIL target), but I would rather stuff any</div><div>necessary information inside the LLVM representation somehow so that</div><div>the .bc/.ll remain self-contained.</div><div><br class="webkit-block-placeholder"></div><div>This patch depends on gc-1-registry and gc-3-collector.</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>//===-- gc-5-shadowstack.patch (+493 -371) --------------------===//</div><div><br class="webkit-block-placeholder"></div><div>  test/CodeGen/Generic/GC/alloc_loop.ll (+1 -1)</div><div>  test/CodeGen/Generic/GC/lower_gcroot.ll (+1 -1)</div><div>  test/CodeGen/Generic/GC/redundant_init.ll (+17)</div><div>  include/llvm/LinkAllPasses.h (-1)</div><div>  include/llvm/Transforms/Scalar.h (-7)</div><div>  runtime/GC/SemiSpace/semispace.c (+15 -13)</div><div>  lib/CodeGen/ShadowStackCollector.cpp (+459)</div><div>  lib/Transforms/Scalar/LowerGC.cpp (-348)</div><div><br class="webkit-block-placeholder"></div><div>With this patch, the LowerGC transformation becomes the</div><div>ShadowStackCollector, which additionally has reduced overhead with</div><div>no sacrifice in portability.</div><div><br class="webkit-block-placeholder"></div><div>This patch depends on gc-4-integration.</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>Considering a function @fun with 8 loop-local roots,</div><div>ShadowStackCollector introduces the following overhead</div><div>(x86):</div><div><br class="webkit-block-placeholder"></div><div>; shadowstack prologue</div><div>        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax</div><div>        movl    (%eax), %ecx</div><div>        movl    $___gc_fun, 20(%esp)</div><div>        movl    $0, 24(%esp)</div><div>        movl    $0, 28(%esp)</div><div>        movl    $0, 32(%esp)</div><div>        movl    $0, 36(%esp)</div><div>        movl    $0, 40(%esp)</div><div>        movl    $0, 44(%esp)</div><div>        movl    $0, 48(%esp)</div><div>        movl    $0, 52(%esp)</div><div>        movl    %ecx, 16(%esp)</div><div>        leal    16(%esp), %ecx</div><div>        movl    %ecx, (%eax)</div><div><br class="webkit-block-placeholder"></div><div>; shadowstack loop overhead</div><div>        (none)</div><div><br class="webkit-block-placeholder"></div><div>; shadowstack epilogue</div><div>        movl    48(%esp), %edx</div><div>        movl    %edx, (%ecx)</div><div><br class="webkit-block-placeholder"></div><div>; shadowstack metadata</div><div>        .align  3</div><div>___gc_fun:                              # __gc_fun</div><div>        .long   8</div><div>        .space  4</div><div><br class="webkit-block-placeholder"></div><div>In comparison to LowerGC:</div><div><br class="webkit-block-placeholder"></div><div>; lowergc prologue</div><div>        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax</div><div>        movl    (%eax), %ecx</div><div>        movl    %ecx, 48(%esp)</div><div>        movl    $8, 52(%esp)</div><div>        movl    $0, 60(%esp)</div><div>        movl    $0, 56(%esp)</div><div>        movl    $0, 68(%esp)</div><div>        movl    $0, 64(%esp)</div><div>        movl    $0, 76(%esp)</div><div>        movl    $0, 72(%esp)</div><div>        movl    $0, 84(%esp)</div><div>        movl    $0, 80(%esp)</div><div>        movl    $0, 92(%esp)</div><div>        movl    $0, 88(%esp)</div><div>        movl    $0, 100(%esp)</div><div>        movl    $0, 96(%esp)</div><div>        movl    $0, 108(%esp)</div><div>        movl    $0, 104(%esp)</div><div>        movl    $0, 116(%esp)</div><div>        movl    $0, 112(%esp)</div><div><br class="webkit-block-placeholder"></div><div>; lowergc loop overhead</div><div>        leal    44(%esp), %eax</div><div>        movl    %eax, 56(%esp)</div><div>        leal    40(%esp), %eax</div><div>        movl    %eax, 64(%esp)</div><div>        leal    36(%esp), %eax</div><div>        movl    %eax, 72(%esp)</div><div>        leal    32(%esp), %eax</div><div>        movl    %eax, 80(%esp)</div><div>        leal    28(%esp), %eax</div><div>        movl    %eax, 88(%esp)</div><div>        leal    24(%esp), %eax</div><div>        movl    %eax, 96(%esp)</div><div>        leal    20(%esp), %eax</div><div>        movl    %eax, 104(%esp)</div><div>        leal    16(%esp), %eax</div><div>        movl    %eax, 112(%esp)</div><div><br class="webkit-block-placeholder"></div><div>; lowergc epilogue</div><div>        movl    48(%esp), %edx</div><div>        movl    %edx, (%ecx)</div><div><br class="webkit-block-placeholder"></div><div>; lowergc metadata</div><div>        (none)</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>//===-- gc-6-ocaml-collector.patch (+219) ---------------------===//</div><div><br class="webkit-block-placeholder"></div><div>  test/CodeGen/Generic/GC/simple_ocaml.ll (+42)</div><div>  test/CodeGen/Generic/GC/frame_size.ll (+13)</div><div>  lib/CodeGen/OcamlCollector.cpp (+164)</div><div><br class="webkit-block-placeholder"></div><div>The new OcamlCollector emits the Ocaml frametable data structure and</div><div>related symbols.</div><div><br class="webkit-block-placeholder"></div><div>This patch depends on gc-4-integration.</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>$ llvm-as -o simple_ocaml.bc simple_ocaml.ll</div><div>$ llc -gc=ocaml -asm-verbose -o - simple_ocaml.bc</div><div>        .text</div><div>_camlSimple_ocaml__code_begin:</div><div>        .data</div><div>_camlSimple_ocaml__data_begin:</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>        .text</div><div>        .align  4,0x90</div><div>        .globl  _fun</div><div>_fun:</div><div>        subl    $12, %esp</div><div>        movl    $0, 4(%esp)</div><div>        movl    $0, 8(%esp)</div><div>        movl    16(%esp), %eax</div><div>        movl    %eax, 4(%esp)</div><div>LBB1_1: # bb.loop</div><div>        movl    4(%esp), %eax</div><div>        movl    4(%eax), %eax</div><div>        testl   %eax, %eax</div><div>        je      LBB1_1  # bb.loop</div><div>LBB1_2: # bb.end</div><div>        movl    $8, (%esp)</div><div>        call    L_malloc$stub</div><div><br class="webkit-block-placeholder"></div><div>Llabel1:</div><div>        movl    %eax, 8(%esp)</div><div>        movl    4(%esp), %ecx</div><div>        movl    %ecx, 4(%ecx)</div><div>        addl    $12, %esp</div><div>        ret</div><div>.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5</div><div>L_malloc$stub:</div><div>        .indirect_symbol _malloc</div><div>        hlt ; hlt ; hlt ; hlt ; hlt</div><div><br class="webkit-block-placeholder"></div><div>        .subsections_via_symbols</div><div><br class="webkit-block-placeholder"></div><div>        .text</div><div>_camlSimple_ocaml__code_end:</div><div>        .data</div><div>_camlSimple_ocaml__data_end:</div><div>        .long   0</div><div>_camlSimple_ocaml__frametable:</div><div>        # live roots for fun</div><div>        .long   Llabel1 # call return address</div><div>        .short  0xc     # stack frame size</div><div>        .short  0x2     # live root count</div><div>        .word   4       # stack offset</div><div>        .word   8       # stack offset</div><div>        .align  2</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>//===-- housekeeping.patch (+16) ------------------------------===//</div><div><br class="webkit-block-placeholder"></div><div>  Xcode/LLVM.xcodeproj/project.pbxproj (+16)</div><div><br class="webkit-block-placeholder"></div><div>Just updating the Xcode project.</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><span></span></div></body></html>