compiler.codegen.gc-maps: docs and tests
parent
7ebd63a217
commit
42a528bb28
|
@ -70,4 +70,8 @@ HELP: serialize-gc-maps
|
|||
{ $values { "byte-array" byte-array } }
|
||||
{ $description "Serializes the gc-maps that have been registered in the " { $link gc-maps } " variable into a byte-array." } ;
|
||||
|
||||
HELP: gc-map-here
|
||||
{ $values { "gc-map" gc-map } }
|
||||
{ $description "Registers the gc map in the " { $link gc-maps } " dynamic variable at the current compiled offset." } ;
|
||||
|
||||
ABOUT: "compiler.codegen.gc-maps"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
USING: namespaces byte-arrays make compiler.codegen.gc-maps
|
||||
compiler.codegen.relocation bit-arrays accessors classes.struct
|
||||
tools.test kernel math sequences alien.c-types
|
||||
USING: accessors alien.c-types arrays classes.struct byte-arrays make
|
||||
namespaces compiler.cfg.stack-frame compiler.codegen.gc-maps
|
||||
compiler.codegen.relocation bit-arrays tools.test kernel math sequences
|
||||
specialized-arrays boxes compiler.cfg.instructions system
|
||||
cpu.architecture vm ;
|
||||
SPECIALIZED-ARRAY: uint
|
||||
|
@ -73,6 +73,62 @@ M: fake-cpu gc-root-offset ;
|
|||
[ t ] [ "result" get length "expect" get length = ] unit-test
|
||||
[ t ] [ "result" get "expect" get = ] unit-test
|
||||
|
||||
|
||||
cpu x86.64? [
|
||||
x86.64 \ cpu set
|
||||
|
||||
! gc-root-offsets
|
||||
{ { 1 3 } } [
|
||||
T{ stack-frame { spill-area-base 0 } } stack-frame [
|
||||
T{ gc-map
|
||||
{ gc-roots {
|
||||
T{ spill-slot { n 0 } }
|
||||
T{ spill-slot { n 16 } }
|
||||
} }
|
||||
} gc-root-offsets
|
||||
] with-variable
|
||||
] unit-test
|
||||
|
||||
{ { 6 10 } } [
|
||||
T{ stack-frame { spill-area-base 32 } } stack-frame [
|
||||
T{ gc-map
|
||||
{ gc-roots {
|
||||
T{ spill-slot { n 8 } }
|
||||
T{ spill-slot { n 40 } }
|
||||
} }
|
||||
} gc-root-offsets
|
||||
] with-variable
|
||||
] unit-test
|
||||
|
||||
! scrub-d scrub-r check-d check-r gc-roots
|
||||
{ { 0 0 0 0 5 } } [
|
||||
T{ stack-frame { spill-area-base 0 } } stack-frame [
|
||||
T{ gc-map
|
||||
{ gc-roots {
|
||||
T{ spill-slot { n 0 } }
|
||||
T{ spill-slot { n 24 } }
|
||||
} }
|
||||
} 1array gc-maps set
|
||||
[ emit-gc-info-bitmaps ] B{ } make drop
|
||||
] with-variable
|
||||
] unit-test
|
||||
|
||||
! scrub-d scrub-r check-d check-r gc-roots
|
||||
{ { 0 0 0 0 9 } } [
|
||||
T{ stack-frame { spill-area-base 32 } } stack-frame [
|
||||
T{ gc-map
|
||||
{ gc-roots {
|
||||
T{ spill-slot { n 0 } }
|
||||
T{ spill-slot { n 24 } }
|
||||
} }
|
||||
} 1array gc-maps set
|
||||
[ emit-gc-info-bitmaps ] B{ } make drop
|
||||
] with-variable
|
||||
] unit-test
|
||||
|
||||
fake-cpu \ cpu set
|
||||
] when
|
||||
|
||||
! gc-map-needed?
|
||||
{ t t } [
|
||||
T{ gc-map { scrub-d { 0 1 1 1 0 } } { scrub-r { 1 0 } } } gc-map-needed?
|
||||
|
|
|
@ -9,8 +9,6 @@ IN: compiler.codegen.gc-maps
|
|||
SYMBOLS: return-addresses gc-maps ;
|
||||
|
||||
: gc-map-needed? ( gc-map/f -- ? )
|
||||
! If there are no stack locations to scrub or check, and no GC
|
||||
! roots, there's no point storing the GC map.
|
||||
dup [ tuple-slots [ empty? ] all? not ] when ;
|
||||
|
||||
: gc-map-here ( gc-map -- )
|
||||
|
|
Loading…
Reference in New Issue