[llvm-commits] gc-6-ocaml.patch [last of 6]

Gordon Henriksen gordonhenriksen at mac.com
Mon Sep 3 23:45:55 PDT 2007


• gc-6-ocaml.patch (+190 lines)
Finally, the new OcamlCollector emits the Ocaml frametable data  
structure and related symbols.

$ llvm-as -o simple_ocaml.bc simple_ocaml.ll
$ llc -asm-verbose -gc=ocaml -o - simple_ocaml.bc
         .text
_camlSimple_ocaml__code_begin:
         .data
_camlSimple_ocaml__data_begin:


         .text
         .align  4,0x90
         .globl  _fun
_fun:
         subl    $12, %esp
         movl    16(%esp), %eax
         movl    %eax, 8(%esp)
LBB1_1: # bb.loop
         movl    8(%esp), %eax
         movl    4(%eax), %eax
         testl   %eax, %eax
         je      LBB1_1  # bb.loop
LBB1_2: # bb.end
         movl    $8, (%esp)
         call    L_malloc$stub

Llabel1:
         movl    8(%esp), %ecx
         movl    %ecx, 4(%ecx)
         addl    $12, %esp
         ret
.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code 
+pure_instructions,5
L_malloc$stub:
         .indirect_symbol _malloc
         hlt ; hlt ; hlt ; hlt ; hlt

         .subsections_via_symbols

         .text
_camlSimple_ocaml__code_end:
         .data
_camlSimple_ocaml__data_end:
         .long   0
_camlSimple_ocaml__frametable:
         # live roots for fun
         .long   Llabel1 # call return address
         .short  0x0     # stack frame size
         .short  0x2     # live root count
         .word   8       # stack offset
         .word   4       # stack offset
         .align  2

(Oops, just noticed that the stack frame size is incorrect here. I  
think the machine code pass simply needs to be moved after epilogue/ 
prologue generation a couple patches back.)

— Gordon


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070904/870f1191/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gc-6-ocaml.patch
Type: application/octet-stream
Size: 7507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070904/870f1191/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070904/870f1191/attachment-0001.html>


More information about the llvm-commits mailing list