! 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 ( -- )
] [ 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 ;
! 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 ;
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
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
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 {
! 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
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 ;
! 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 ;
}
} ;
-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
{ 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 }
{ 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
{ 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 }