unify inner-d-index when unifying branches; close a few other leaks where meta-d could have been popped without updating inner-d-index

db4
Joe Groff 2010-03-07 20:44:50 -08:00
parent 66687d6b21
commit 6689113519
3 changed files with 10 additions and 4 deletions

View File

@ -42,8 +42,11 @@ IN: stack-checker.backend
: shorten-by ( n seq -- )
[ length swap - ] keep shorten ; inline
: shorten-d ( n -- )
meta-d shorten-by meta-d length update-inner-d ;
: consume-d ( n -- seq )
[ ensure-d ] [ meta-d shorten-by ] bi ;
[ ensure-d ] [ shorten-d ] bi ;
: output-d ( values -- ) meta-d push-all ;

View File

@ -61,7 +61,9 @@ SYMBOL: quotations
branch-variable ;
: datastack-phi ( seq -- phi-in phi-out )
[ input-count branch-variable ] [ \ meta-d active-variable ] bi
[ input-count branch-variable ]
[ inner-d-index branch-variable infimum inner-d-index set ]
[ \ meta-d active-variable ] tri
unify-branches
[ input-count set ] [ ] [ dup >vector \ meta-d set ] tri* ;
@ -80,7 +82,8 @@ SYMBOL: quotations
: copy-inference ( -- )
\ meta-d [ clone ] change
literals [ clone ] change
input-count [ ] change ;
input-count [ ] change
inner-d-index [ ] change ;
GENERIC: infer-branch ( literal -- namespace )

View File

@ -18,7 +18,7 @@ IN: stack-checker.transforms
:: ((apply-transform)) ( quot values stack rstate -- )
rstate recursive-state [ stack quot call-transformer ] with-variable
values [ length meta-d shorten-by ] [ #drop, ] bi
values [ length shorten-d ] [ #drop, ] bi
rstate infer-quot ;
: literal-values? ( values -- ? ) [ literal-value? ] all? ;