vm: remove vm-field-offset and context-field-offset

Shorter to just write "vm offset-of" and "context offset-of"
db4
Björn Lindqvist 2015-12-14 09:29:18 +01:00
parent 1378841c95
commit 7247906bf8
5 changed files with 35 additions and 43 deletions

View File

@ -1,10 +1,10 @@
! Copyright (C) 2008, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors classes.algebra compiler.cfg.builder.blocks
compiler.cfg.comparisons compiler.cfg.hats
USING: accessors classes.algebra classes.struct
compiler.cfg.builder.blocks compiler.cfg.comparisons compiler.cfg.hats
compiler.cfg.instructions compiler.cfg.stacks compiler.constants
compiler.tree.propagation.info cpu.architecture kernel layouts
math namespaces sequences vm ;
compiler.tree.propagation.info cpu.architecture kernel layouts math
namespaces sequences vm ;
IN: compiler.cfg.intrinsics.misc
: emit-tag ( -- )
@ -28,11 +28,11 @@ IN: compiler.cfg.intrinsics.misc
] [ emit-primitive ] ?if ;
: context-object-offset ( n -- n )
cells "context-objects" context-field-offset + ;
cells "context-objects" context offset-of + ;
: emit-context-object ( node -- )
dup node-input-infos first literal>> [
"ctx" vm-field-offset ^^vm-field
"ctx" vm offset-of ^^vm-field
ds-drop swap context-object-offset cell /i 0 ^^slot-imm ds-push
] [ emit-primitive ] ?if ;

View File

@ -1,15 +1,13 @@
! Copyright (C) 2011 Erik Charlebois
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs sequences kernel combinators
classes.algebra byte-arrays make math math.order math.ranges
system namespaces locals layouts words alien alien.accessors
alien.c-types alien.complex alien.data alien.libraries
literals cpu.architecture cpu.ppc.assembler
compiler.cfg 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 vm memory fry io prettyprint ;
USING: accessors alien alien.accessors alien.c-types alien.complex alien.data
alien.libraries assocs byte-arrays classes.algebra classes.struct combinators
compiler.cfg compiler.cfg.build-stack-frame compiler.cfg.comparisons
compiler.cfg.instructions compiler.cfg.intrinsics compiler.cfg.registers
compiler.cfg.stack-frame compiler.codegen compiler.codegen.fixup
compiler.constants compiler.units cpu.architecture cpu.ppc.assembler fry io
kernel layouts literals locals make math math.order math.ranges memory
namespaces prettyprint sequences system vm words ;
QUALIFIED-WITH: alien.c-types c
FROM: cpu.ppc.assembler => B ;
FROM: math => float ;
@ -408,9 +406,9 @@ M:: ppc %box-long-long ( dst src1 src2 func gc-map -- )
M:: ppc %save-context ( temp1 temp2 -- )
temp1 %context
1 temp1 "callstack-top" context-field-offset %store-cell
ds-reg temp1 "datastack" context-field-offset %store-cell
rs-reg temp1 "retainstack" context-field-offset %store-cell ;
1 temp1 "callstack-top" context offset-of %store-cell
ds-reg temp1 "datastack" context offset-of %store-cell
rs-reg temp1 "retainstack" context offset-of %store-cell ;
M:: ppc %c-invoke ( name dll gc-map -- )
11 0 %load-cell-imm name dll %load-cell-imm-rc rel-dlsym
@ -873,7 +871,7 @@ M: ppc.64 %store-memory ( src base displacement scale offset rep c-type -- )
M:: ppc %allot ( dst size class nursery-ptr -- )
! dst = vm->nursery.here;
nursery-ptr vm-reg "nursery" vm-field-offset ADDI
nursery-ptr vm-reg "nursery" vm offset-of ADDI
dst nursery-ptr 0 %load-cell
! vm->nursery.here += align(size, data_alignment);
scratch-reg dst size data-alignment get align ADDI
@ -908,8 +906,8 @@ M:: ppc %write-barrier-imm ( src slot tag temp1 temp2 -- )
M:: ppc %check-nursery-branch ( label size cc temp1 temp2 -- )
! if (vm->nursery.here + size >= vm->nursery.end) ...
temp1 vm-reg "nursery" vm-field-offset %load-cell
temp2 vm-reg "nursery" vm-field-offset 2 cells + %load-cell
temp1 vm-reg "nursery" vm offset-of %load-cell
temp2 vm-reg "nursery" vm offset-of 2 cells + %load-cell
temp1 temp1 size ADDI
0 temp1 temp2 %compare-cell
cc {

View File

@ -1,15 +1,15 @@
! Copyright (C) 2005, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien arrays assocs byte-arrays classes.algebra
combinators compiler compiler.cfg compiler.cfg.comparisons
compiler.cfg.instructions compiler.cfg.intrinsics
compiler.cfg.registers compiler.cfg.stack-frame
compiler.codegen.gc-maps compiler.codegen.labels
compiler.codegen.relocation compiler.constants compiler.units
cpu.architecture cpu.x86.assembler cpu.x86.assembler.operands
cpu.x86.assembler.private cpu.x86.features cpu.x86.features.private
fry io kernel layouts locals make math math.order memory namespaces
sequences system vm vocabs ;
classes.struct combinators compiler compiler.cfg
compiler.cfg.comparisons compiler.cfg.instructions
compiler.cfg.intrinsics compiler.cfg.registers
compiler.cfg.stack-frame compiler.codegen.gc-maps
compiler.codegen.labels compiler.codegen.relocation compiler.constants
compiler.units cpu.architecture cpu.x86.assembler
cpu.x86.assembler.operands cpu.x86.assembler.private cpu.x86.features
cpu.x86.features.private fry io kernel layouts locals make math
math.order memory namespaces sequences system vm vocabs ;
QUALIFIED-WITH: alien.c-types c
FROM: math => float ;
IN: cpu.x86
@ -452,7 +452,7 @@ M: x86 %sar int-rep two-operand [ SAR ] emit-shift ;
HOOK: %vm-field-ptr cpu ( reg offset -- )
: load-zone-offset ( nursery-ptr -- )
"nursery" vm-field-offset %vm-field-ptr ;
"nursery" vm offset-of %vm-field-ptr ;
: load-allot-ptr ( nursery-ptr allot-ptr -- )
[ drop load-zone-offset ] [ swap [] MOV ] 2bi ;
@ -686,9 +686,9 @@ M:: x86 %save-context ( temp1 temp2 -- )
! all roots.
temp1 %context
temp2 stack-reg cell neg [+] LEA
temp1 "callstack-top" context-field-offset [+] temp2 MOV
temp1 "datastack" context-field-offset [+] ds-reg MOV
temp1 "retainstack" context-field-offset [+] rs-reg MOV ;
temp1 "callstack-top" context offset-of [+] temp2 MOV
temp1 "datastack" context offset-of [+] ds-reg MOV
temp1 "retainstack" context offset-of [+] rs-reg MOV ;
M: x86 value-struct? drop t ;

View File

@ -17,10 +17,6 @@ HELP: vm
}
} ;
HELP: vm-field-offset
{ $values { "field" string } { "offset" number } }
{ $description "Gets the offset in bytes to the named virtual machine field." } ;
HELP: gc-info
{ $class-description "A struct that defines the sizes of the garbage collection maps for a word. It has the following slots:"
{ $table

View File

@ -21,8 +21,6 @@ STRUCT: context
{ callstack-seg segment* }
{ context-objects cell_t[context-object-count] } ;
: context-field-offset ( field -- offset ) context offset-of ; inline
STRUCT: zone
{ here cell_t }
{ start cell_t }
@ -43,8 +41,6 @@ STRUCT: vm
{ retainstack-size cell_t }
{ callstack-size cell_t } ;
: vm-field-offset ( field -- offset ) vm offset-of ; inline
CONSTANT: collect-nursery-op 0
CONSTANT: collect-aging-op 1
CONSTANT: collect-to-tenured-op 2
@ -90,6 +86,8 @@ STRUCT: gc-event
{ compaction-time cell_t }
{ temp-time ulonglong } ;
! dispatch-statistics should be kept in sync with:
! vm/dispatch.hpp
STRUCT: dispatch-statistics
{ megamorphic-cache-hits cell_t }
{ megamorphic-cache-misses cell_t }