compiler.cfg.stacks.vacant: invert meaning of 0/1 for overinit:ed locs to make some logic simpler
parent
70e4f2a8b7
commit
46082d836a
|
@ -34,6 +34,6 @@ HELP: overinitialized>bits
|
||||||
{ "overinitialized" "sequence of overinitialized stack locations" }
|
{ "overinitialized" "sequence of overinitialized stack locations" }
|
||||||
{ "bits" "sequence of 1:s and 0:s" }
|
{ "bits" "sequence of 1:s and 0:s" }
|
||||||
}
|
}
|
||||||
{ $description "Converts a sequence of overinitialized stack locations to the pattern of 1:s and 0:s that can be put in the " { $slot "check-d" } " and " { $slot "check-r" } " slots of a " { $link gc-map } ". 0:s are empty locations and 1:s are initialized. First element is stack location -1,second -2 and so on." } ;
|
{ $description "Converts a sequence of overinitialized stack locations to the pattern of 1:s and 0:s that can be put in the " { $slot "check-d" } " and " { $slot "check-r" } " slots of a " { $link gc-map } ". 0:s are initialized locations and 0:s are empty ones. First element is stack location -1,second -2 and so on." } ;
|
||||||
|
|
||||||
ABOUT: "compiler.cfg.stacks.vacant"
|
ABOUT: "compiler.cfg.stacks.vacant"
|
||||||
|
|
|
@ -70,7 +70,7 @@ IN: compiler.cfg.stacks.vacant.tests
|
||||||
|
|
||||||
! Replace -1, then gc. Peek is ok here because the -1 should be
|
! Replace -1, then gc. Peek is ok here because the -1 should be
|
||||||
! checked.
|
! checked.
|
||||||
{ { 1 } } [
|
{ { 0 } } [
|
||||||
V{
|
V{
|
||||||
T{ ##replace { src 10 } { loc D -1 } }
|
T{ ##replace { src 10 } { loc D -1 } }
|
||||||
T{ ##alien-invoke { gc-map T{ gc-map { scrub-d { } } } } }
|
T{ ##alien-invoke { gc-map T{ gc-map { scrub-d { } } } } }
|
||||||
|
@ -156,7 +156,7 @@ IN: compiler.cfg.stacks.vacant.tests
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{
|
{
|
||||||
{ { { } { 1 1 1 } } { { } { 1 } } }
|
{ { { } { 0 0 0 } } { { } { 0 } } }
|
||||||
} [
|
} [
|
||||||
{ { 4 { 3 2 1 -3 0 -2 -1 } } { 0 { -1 } } } state>gc-data
|
{ { 4 { 3 2 1 -3 0 -2 -1 } } { 0 { -1 } } } state>gc-data
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
|
@ -30,7 +30,7 @@ IN: compiler.cfg.stacks.vacant
|
||||||
second [ 0 < ] filter ;
|
second [ 0 < ] filter ;
|
||||||
|
|
||||||
: overinitialized>bits ( overinitialized -- bits )
|
: overinitialized>bits ( overinitialized -- bits )
|
||||||
[ neg 1 - ] map vacant>bits [ 1 = 0 1 ? ] map ;
|
[ neg 1 - ] map vacant>bits ;
|
||||||
|
|
||||||
: stack>scrub-and-check ( stack -- pair )
|
: stack>scrub-and-check ( stack -- pair )
|
||||||
[ stack>vacant vacant>bits ]
|
[ stack>vacant vacant>bits ]
|
||||||
|
|
Loading…
Reference in New Issue