compiler.cfg.stacks.vacant: ##call instructions clear the set of overinitialized locations

db4
Björn Lindqvist 2014-08-31 06:14:20 +02:00 committed by Doug Coleman
parent e3c2704986
commit ffacc8370d
2 changed files with 16 additions and 0 deletions

View File

@ -161,6 +161,17 @@ IN: compiler.cfg.stacks.vacant.tests
{ { 4 { 3 2 1 -3 0 -2 -1 } } { 0 { -1 } } } state>gc-data
] unit-test
! ##call clears the overinitialized slots.
{
{ -1 { } }
} [
V{
T{ ##replace { src 10 } { loc D 0 } }
T{ ##inc-d f -1 }
T{ ##call }
} create-cfg output-stack-map first
] unit-test
: cfg1 ( -- cfg )
V{
T{ ##inc-d f 1 }

View File

@ -68,6 +68,11 @@ M: ##replace visit-insn visit-replace ;
M: ##peek visit-insn ( state insn -- state' )
2dup peek-loc-ok? [ drop ] [ vacant-peek ] if ;
M: ##call visit-insn ( state insn -- state' )
! After a word call, we can't trust any overinitialized locations
! to contain valid pointers anymore.
drop [ first2 [ 0 >= ] filter 2array ] map ;
: set-gc-map ( state gc-map -- )
swap state>gc-data concat
{ >>scrub-d >>check-d >>scrub-r >>check-r } write-slots ;