vm: remove vm-field-offset and context-field-offset
Shorter to just write "vm offset-of" and "context offset-of"db4
parent
1378841c95
commit
7247906bf8
|
@ -1,10 +1,10 @@
|
||||||
! Copyright (C) 2008, 2010 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors classes.algebra compiler.cfg.builder.blocks
|
USING: accessors classes.algebra classes.struct
|
||||||
compiler.cfg.comparisons compiler.cfg.hats
|
compiler.cfg.builder.blocks compiler.cfg.comparisons compiler.cfg.hats
|
||||||
compiler.cfg.instructions compiler.cfg.stacks compiler.constants
|
compiler.cfg.instructions compiler.cfg.stacks compiler.constants
|
||||||
compiler.tree.propagation.info cpu.architecture kernel layouts
|
compiler.tree.propagation.info cpu.architecture kernel layouts math
|
||||||
math namespaces sequences vm ;
|
namespaces sequences vm ;
|
||||||
IN: compiler.cfg.intrinsics.misc
|
IN: compiler.cfg.intrinsics.misc
|
||||||
|
|
||||||
: emit-tag ( -- )
|
: emit-tag ( -- )
|
||||||
|
@ -28,11 +28,11 @@ IN: compiler.cfg.intrinsics.misc
|
||||||
] [ emit-primitive ] ?if ;
|
] [ emit-primitive ] ?if ;
|
||||||
|
|
||||||
: context-object-offset ( n -- n )
|
: context-object-offset ( n -- n )
|
||||||
cells "context-objects" context-field-offset + ;
|
cells "context-objects" context offset-of + ;
|
||||||
|
|
||||||
: emit-context-object ( node -- )
|
: emit-context-object ( node -- )
|
||||||
dup node-input-infos first literal>> [
|
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
|
ds-drop swap context-object-offset cell /i 0 ^^slot-imm ds-push
|
||||||
] [ emit-primitive ] ?if ;
|
] [ emit-primitive ] ?if ;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
! Copyright (C) 2011 Erik Charlebois
|
! Copyright (C) 2011 Erik Charlebois
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs sequences kernel combinators
|
USING: accessors alien alien.accessors alien.c-types alien.complex alien.data
|
||||||
classes.algebra byte-arrays make math math.order math.ranges
|
alien.libraries assocs byte-arrays classes.algebra classes.struct combinators
|
||||||
system namespaces locals layouts words alien alien.accessors
|
compiler.cfg compiler.cfg.build-stack-frame compiler.cfg.comparisons
|
||||||
alien.c-types alien.complex alien.data alien.libraries
|
compiler.cfg.instructions compiler.cfg.intrinsics compiler.cfg.registers
|
||||||
literals cpu.architecture cpu.ppc.assembler
|
compiler.cfg.stack-frame compiler.codegen compiler.codegen.fixup
|
||||||
compiler.cfg compiler.cfg.registers compiler.cfg.instructions
|
compiler.constants compiler.units cpu.architecture cpu.ppc.assembler fry io
|
||||||
compiler.cfg.comparisons compiler.codegen.fixup
|
kernel layouts literals locals make math math.order math.ranges memory
|
||||||
compiler.cfg.intrinsics compiler.cfg.stack-frame
|
namespaces prettyprint sequences system vm words ;
|
||||||
compiler.cfg.build-stack-frame compiler.units compiler.constants
|
|
||||||
compiler.codegen vm memory fry io prettyprint ;
|
|
||||||
QUALIFIED-WITH: alien.c-types c
|
QUALIFIED-WITH: alien.c-types c
|
||||||
FROM: cpu.ppc.assembler => B ;
|
FROM: cpu.ppc.assembler => B ;
|
||||||
FROM: math => float ;
|
FROM: math => float ;
|
||||||
|
@ -408,9 +406,9 @@ M:: ppc %box-long-long ( dst src1 src2 func gc-map -- )
|
||||||
|
|
||||||
M:: ppc %save-context ( temp1 temp2 -- )
|
M:: ppc %save-context ( temp1 temp2 -- )
|
||||||
temp1 %context
|
temp1 %context
|
||||||
1 temp1 "callstack-top" context-field-offset %store-cell
|
1 temp1 "callstack-top" context offset-of %store-cell
|
||||||
ds-reg temp1 "datastack" context-field-offset %store-cell
|
ds-reg temp1 "datastack" context offset-of %store-cell
|
||||||
rs-reg temp1 "retainstack" context-field-offset %store-cell ;
|
rs-reg temp1 "retainstack" context offset-of %store-cell ;
|
||||||
|
|
||||||
M:: ppc %c-invoke ( name dll gc-map -- )
|
M:: ppc %c-invoke ( name dll gc-map -- )
|
||||||
11 0 %load-cell-imm name dll %load-cell-imm-rc rel-dlsym
|
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 -- )
|
M:: ppc %allot ( dst size class nursery-ptr -- )
|
||||||
! dst = vm->nursery.here;
|
! 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
|
dst nursery-ptr 0 %load-cell
|
||||||
! vm->nursery.here += align(size, data_alignment);
|
! vm->nursery.here += align(size, data_alignment);
|
||||||
scratch-reg dst size data-alignment get align ADDI
|
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 -- )
|
M:: ppc %check-nursery-branch ( label size cc temp1 temp2 -- )
|
||||||
! if (vm->nursery.here + size >= vm->nursery.end) ...
|
! if (vm->nursery.here + size >= vm->nursery.end) ...
|
||||||
temp1 vm-reg "nursery" vm-field-offset %load-cell
|
temp1 vm-reg "nursery" vm offset-of %load-cell
|
||||||
temp2 vm-reg "nursery" vm-field-offset 2 cells + %load-cell
|
temp2 vm-reg "nursery" vm offset-of 2 cells + %load-cell
|
||||||
temp1 temp1 size ADDI
|
temp1 temp1 size ADDI
|
||||||
0 temp1 temp2 %compare-cell
|
0 temp1 temp2 %compare-cell
|
||||||
cc {
|
cc {
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
! Copyright (C) 2005, 2010 Slava Pestov.
|
! Copyright (C) 2005, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien arrays assocs byte-arrays classes.algebra
|
USING: accessors alien arrays assocs byte-arrays classes.algebra
|
||||||
combinators compiler compiler.cfg compiler.cfg.comparisons
|
classes.struct combinators compiler compiler.cfg
|
||||||
compiler.cfg.instructions compiler.cfg.intrinsics
|
compiler.cfg.comparisons compiler.cfg.instructions
|
||||||
compiler.cfg.registers compiler.cfg.stack-frame
|
compiler.cfg.intrinsics compiler.cfg.registers
|
||||||
compiler.codegen.gc-maps compiler.codegen.labels
|
compiler.cfg.stack-frame compiler.codegen.gc-maps
|
||||||
compiler.codegen.relocation compiler.constants compiler.units
|
compiler.codegen.labels compiler.codegen.relocation compiler.constants
|
||||||
cpu.architecture cpu.x86.assembler cpu.x86.assembler.operands
|
compiler.units cpu.architecture cpu.x86.assembler
|
||||||
cpu.x86.assembler.private cpu.x86.features cpu.x86.features.private
|
cpu.x86.assembler.operands cpu.x86.assembler.private cpu.x86.features
|
||||||
fry io kernel layouts locals make math math.order memory namespaces
|
cpu.x86.features.private fry io kernel layouts locals make math
|
||||||
sequences system vm vocabs ;
|
math.order memory namespaces sequences system vm vocabs ;
|
||||||
QUALIFIED-WITH: alien.c-types c
|
QUALIFIED-WITH: alien.c-types c
|
||||||
FROM: math => float ;
|
FROM: math => float ;
|
||||||
IN: cpu.x86
|
IN: cpu.x86
|
||||||
|
@ -452,7 +452,7 @@ M: x86 %sar int-rep two-operand [ SAR ] emit-shift ;
|
||||||
HOOK: %vm-field-ptr cpu ( reg offset -- )
|
HOOK: %vm-field-ptr cpu ( reg offset -- )
|
||||||
|
|
||||||
: load-zone-offset ( nursery-ptr -- )
|
: 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 -- )
|
: load-allot-ptr ( nursery-ptr allot-ptr -- )
|
||||||
[ drop load-zone-offset ] [ swap [] MOV ] 2bi ;
|
[ drop load-zone-offset ] [ swap [] MOV ] 2bi ;
|
||||||
|
@ -686,9 +686,9 @@ M:: x86 %save-context ( temp1 temp2 -- )
|
||||||
! all roots.
|
! all roots.
|
||||||
temp1 %context
|
temp1 %context
|
||||||
temp2 stack-reg cell neg [+] LEA
|
temp2 stack-reg cell neg [+] LEA
|
||||||
temp1 "callstack-top" context-field-offset [+] temp2 MOV
|
temp1 "callstack-top" context offset-of [+] temp2 MOV
|
||||||
temp1 "datastack" context-field-offset [+] ds-reg MOV
|
temp1 "datastack" context offset-of [+] ds-reg MOV
|
||||||
temp1 "retainstack" context-field-offset [+] rs-reg MOV ;
|
temp1 "retainstack" context offset-of [+] rs-reg MOV ;
|
||||||
|
|
||||||
M: x86 value-struct? drop t ;
|
M: x86 value-struct? drop t ;
|
||||||
|
|
||||||
|
|
|
@ -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
|
HELP: gc-info
|
||||||
{ $class-description "A struct that defines the sizes of the garbage collection maps for a word. It has the following slots:"
|
{ $class-description "A struct that defines the sizes of the garbage collection maps for a word. It has the following slots:"
|
||||||
{ $table
|
{ $table
|
||||||
|
|
|
@ -21,8 +21,6 @@ STRUCT: context
|
||||||
{ callstack-seg segment* }
|
{ callstack-seg segment* }
|
||||||
{ context-objects cell_t[context-object-count] } ;
|
{ context-objects cell_t[context-object-count] } ;
|
||||||
|
|
||||||
: context-field-offset ( field -- offset ) context offset-of ; inline
|
|
||||||
|
|
||||||
STRUCT: zone
|
STRUCT: zone
|
||||||
{ here cell_t }
|
{ here cell_t }
|
||||||
{ start cell_t }
|
{ start cell_t }
|
||||||
|
@ -43,8 +41,6 @@ STRUCT: vm
|
||||||
{ retainstack-size cell_t }
|
{ retainstack-size cell_t }
|
||||||
{ callstack-size cell_t } ;
|
{ callstack-size cell_t } ;
|
||||||
|
|
||||||
: vm-field-offset ( field -- offset ) vm offset-of ; inline
|
|
||||||
|
|
||||||
CONSTANT: collect-nursery-op 0
|
CONSTANT: collect-nursery-op 0
|
||||||
CONSTANT: collect-aging-op 1
|
CONSTANT: collect-aging-op 1
|
||||||
CONSTANT: collect-to-tenured-op 2
|
CONSTANT: collect-to-tenured-op 2
|
||||||
|
@ -90,6 +86,8 @@ STRUCT: gc-event
|
||||||
{ compaction-time cell_t }
|
{ compaction-time cell_t }
|
||||||
{ temp-time ulonglong } ;
|
{ temp-time ulonglong } ;
|
||||||
|
|
||||||
|
! dispatch-statistics should be kept in sync with:
|
||||||
|
! vm/dispatch.hpp
|
||||||
STRUCT: dispatch-statistics
|
STRUCT: dispatch-statistics
|
||||||
{ megamorphic-cache-hits cell_t }
|
{ megamorphic-cache-hits cell_t }
|
||||||
{ megamorphic-cache-misses cell_t }
|
{ megamorphic-cache-misses cell_t }
|
||||||
|
|
Loading…
Reference in New Issue