]> gitweb.factorcode.org Git - factor.git/commitdiff
Added a vm C-STRUCT, using it for struct offsets in x86 asm
authorPhil Dawes <phil@phildawes.net>
Thu, 20 Aug 2009 18:39:40 +0000 (19:39 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:16:31 +0000 (08:16 +0100)
basis/cpu/x86/x86.factor
basis/vm/authors.txt [new file with mode: 0644]
basis/vm/summary.txt [new file with mode: 0644]
basis/vm/vm.factor [new file with mode: 0644]

index 798b67bc1a7d0f2adfd069dc089955bc1f7abd0e..c142818c7f3847d62983f0187854b9dd9eadc73e 100644 (file)
@@ -1,5 +1,6 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
+<<<<<<< HEAD
 USING: accessors assocs alien alien.c-types arrays strings
 cpu.x86.assembler cpu.x86.assembler.private cpu.x86.assembler.operands
 cpu.architecture kernel kernel.private math memory namespaces make
@@ -12,6 +13,14 @@ compiler.cfg.comparisons
 compiler.cfg.stack-frame
 compiler.codegen
 compiler.codegen.fixup ;
+=======
+USING: accessors alien combinators compiler.cfg.comparisons
+compiler.cfg.intrinsics compiler.cfg.registers
+compiler.cfg.stack-frame compiler.codegen.fixup compiler.constants
+cpu.architecture cpu.x86.assembler cpu.x86.assembler.operands fry
+kernel layouts locals make math math.order namespaces sequences system
+vm ;
+>>>>>>> Added a vm C-STRUCT, using it for struct offsets in x86 asm
 IN: cpu.x86
 
 << enable-fixnum-log2 >>
@@ -742,8 +751,8 @@ M:: x86 %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 0 MOV rc-absolute-cell rt-vm rel-fixup ! stack-chain is first item in vm struct. TODO: make vm C-STRUCT
-    temp1 temp1 [] MOV
+    temp1 0 MOV rc-absolute-cell rt-vm rel-fixup
+    temp1 temp1 "stack_chain" vm-offset [+] MOV
     temp2 stack-reg cell neg [+] LEA
     temp1 [] temp2 MOV
     callback-allowed? [
diff --git a/basis/vm/authors.txt b/basis/vm/authors.txt
new file mode 100644 (file)
index 0000000..b125620
--- /dev/null
@@ -0,0 +1 @@
+Phil Dawes
\ No newline at end of file
diff --git a/basis/vm/summary.txt b/basis/vm/summary.txt
new file mode 100644 (file)
index 0000000..bfa1067
--- /dev/null
@@ -0,0 +1 @@
+Layout of the C vm structure
diff --git a/basis/vm/vm.factor b/basis/vm/vm.factor
new file mode 100644 (file)
index 0000000..335f809
--- /dev/null
@@ -0,0 +1,8 @@
+! Copyright (C) 2009 Phil Dawes.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.structs alien.syntax ;
+IN: vm
+
+C-STRUCT: vm { "context*" "stack_chain" } ;
+
+: vm-offset ( field -- offset ) "vm" offset-of ;
\ No newline at end of file