Added a vm C-STRUCT, using it for struct offsets in x86 asm

db4
Phil Dawes 2009-08-20 19:39:40 +01:00
parent 9a37b6abb6
commit 88d3179358
4 changed files with 21 additions and 2 deletions

View 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? [

1
basis/vm/authors.txt Normal file
View File

@ -0,0 +1 @@
Phil Dawes

1
basis/vm/summary.txt Normal file
View File

@ -0,0 +1 @@
Layout of the C vm structure

8
basis/vm/vm.factor Normal file
View File

@ -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 ;