compiler.cfg.stacks.padding: docs

db4
Björn Lindqvist 2015-05-10 01:26:43 +02:00 committed by John Benediktsson
parent 24dc0679dc
commit 409a32d555
3 changed files with 16 additions and 15 deletions

View File

@ -0,0 +1,9 @@
USING: assocs compiler.cfg help.markup help.syntax ;
IN: compiler.cfg.stacks.padding
HELP: initial-state
{ $description "Initially the stack bottom is at 0 for both the data and retain stacks and no replaces have been registered." } ;
HELP: trace-stack-state2
{ $values { "cfg" cfg } { "assoc" assoc } }
{ $description "Outputs an assoc with the instruction numbers as keys and as values two tuples of the data and retain stacks shapes before that instruction. All instructions in the cfg gets numbered as a side-effect." } ;

View File

@ -154,6 +154,11 @@ IN: compiler.cfg.stacks.padding.tests
{ { 4 { } } { 0 { } } } T{ ##call-gc } visit-insn
] unit-test
[
{ { 2 { -1 0 1 } } { 0 { } } } T{ ##call-gc } visit-insn
] [ overinitialized-when-gc? ] must-fail-with
! visit-insn ##peek
{
{ { 3 { 0 } } { 0 { } } }
@ -596,16 +601,3 @@ IN: compiler.cfg.stacks.padding.tests
T{ ##peek { loc R 0 } }
} following-stack-state
] [ vacant-peek? ] must-fail-with
! ! (scan-c-args) run-test flip
! seem good: (gamma-random-float>1)

View File

@ -8,7 +8,7 @@ sequences ;
QUALIFIED: sets
IN: compiler.cfg.stacks.padding
ERROR: overinitialized-when-calling seq ;
ERROR: overinitialized-when-gc seq ;
ERROR: vacant-when-calling seq ;
: safe-iota ( n -- seq )
@ -62,7 +62,7 @@ CONSTANT: initial-state { { 0 { } } { 0 { } } }
: ensure-no-overinitialized ( state -- )
[ second [ 0 < ] filter ] map dup { { } { } } =
[ drop ] [ overinitialized-when-calling ] if ;
[ drop ] [ overinitialized-when-gc ] if ;
: fill-vacancies ( state -- state' )
[ fill-stack ] map ;