]> gitweb.factorcode.org Git - factor.git/commitdiff
ppc asm to get stack_chain using vm ptr
authorsheeple <sheeple@oberon.local>
Sun, 30 Aug 2009 19:55:46 +0000 (14:55 -0500)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:16:31 +0000 (08:16 +0100)
basis/cpu/ppc/ppc.factor

index 9c829bc390023b8e88ddcb01c734f8f837107b28..44309b15c6f87fe59263452f2b762923e89f8f8e 100644 (file)
@@ -7,7 +7,7 @@ cpu.ppc.assembler cpu.ppc.assembler.backend compiler.cfg.registers
 compiler.cfg.instructions compiler.cfg.comparisons
 compiler.codegen.fixup compiler.cfg.intrinsics
 compiler.cfg.stack-frame compiler.cfg.build-stack-frame
-compiler.units compiler.constants compiler.codegen ;
+compiler.units compiler.constants compiler.codegen vm ;
 FROM: cpu.ppc.assembler => B ;
 IN: cpu.ppc
 
@@ -678,11 +678,18 @@ M: ppc %box-large-struct ( n c-type -- )
     ! Call the function
     "box_value_struct" f %alien-invoke ;
 
+: %load-vm-addr ( reg -- )
+    0 swap LOAD32 rc-absolute-ppc-2/2 rt-vm rel-fixup ;
+
+: %load-vm-field-addr ( reg symbol -- )
+    [ drop %load-vm-addr ]
+    [ [ dup ] dip vm-offset ADDI ] 2bi ;
+
 M:: ppc %save-context ( temp1 temp2 callback-allowed? -- )
     #! Save Factor stack pointers in case the C code calls a
     #! callback which does a GC, which must reliably trace
     #! all roots.
-    temp1 "stack_chain" f %alien-global
+    temp1 "stack_chain" %load-vm-field-addr
     temp1 temp1 0 LWZ
     1 temp1 0 STW
     callback-allowed? [