compiler.cfg.stacks.*: removing the adjust word which wasn't useful
parent
bff165c85c
commit
ee5c28f470
|
@ -91,7 +91,6 @@ $nl
|
||||||
translate-local-loc }
|
translate-local-loc }
|
||||||
"Words for writing the stack state:"
|
"Words for writing the stack state:"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
adjust
|
|
||||||
inc-stack
|
inc-stack
|
||||||
modify-height
|
modify-height
|
||||||
replace-loc
|
replace-loc
|
||||||
|
|
|
@ -14,9 +14,6 @@ IN: compiler.cfg.stacks.local
|
||||||
: modify-height ( state loc -- )
|
: modify-height ( state loc -- )
|
||||||
>loc< 0 1 ? rot nth [ + ] with map! drop ;
|
>loc< 0 1 ? rot nth [ + ] with map! drop ;
|
||||||
|
|
||||||
: adjust ( state loc -- )
|
|
||||||
>loc< 0 1 ? rot nth dup first swapd + 0 rot set-nth ;
|
|
||||||
|
|
||||||
: reset-emits ( state -- )
|
: reset-emits ( state -- )
|
||||||
[ 0 1 rot set-nth ] each ;
|
[ 0 1 rot set-nth ] each ;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ HELP: end-stack-analysis
|
||||||
{ $description "Ends the stack analysis of the current cfg. This is the last step of the cfg construction (but comes before all optimization passes)." } ;
|
{ $description "Ends the stack analysis of the current cfg. This is the last step of the cfg construction (but comes before all optimization passes)." } ;
|
||||||
|
|
||||||
HELP: adjust-d
|
HELP: adjust-d
|
||||||
{ $values { "n" number } }
|
{ $values { "n" integer } }
|
||||||
{ $description "Changes the height of the current data stack. This word is called when other instructions which internally adjust the stack height are emitted, such as " { $link ##call } " and " { $link ##alien-invoke } "." } ;
|
{ $description "Changes the current height of the data stack. The word is used when other instructions which adjust the stack height are emitted, such as " { $link ##call } " and " { $link ##alien-invoke } ". Since the stack height is adjusted without emitting " { ##inc } " instructions, the " { $link inc-stack } " word can't be used by them." } ;
|
||||||
|
|
||||||
HELP: ds-drop
|
HELP: ds-drop
|
||||||
{ $description "Used to signal to the stack analysis that the datastacks height is decreased by one." } ;
|
{ $description "Used to signal to the stack analysis that the datastacks height is decreased by one." } ;
|
||||||
|
|
|
@ -3,6 +3,15 @@ compiler.cfg.stacks compiler.cfg.stacks.local compiler.test kernel literals
|
||||||
namespaces tools.test ;
|
namespaces tools.test ;
|
||||||
IN: compiler.cfg.stacks.tests
|
IN: compiler.cfg.stacks.tests
|
||||||
|
|
||||||
|
! adjust-d
|
||||||
|
{
|
||||||
|
{ { 6 2 } { 3 4 } }
|
||||||
|
{ { -4 2 } { 3 4 } }
|
||||||
|
} [
|
||||||
|
{ { 1 2 } { 3 4 } } [ height-state set 5 adjust-d ] keep
|
||||||
|
{ { 1 2 } { 3 4 } } [ height-state set -5 adjust-d ] keep
|
||||||
|
] unit-test
|
||||||
|
|
||||||
{
|
{
|
||||||
H{ { D: 1 4 } { D: 2 3 } { D: 0 5 } }
|
H{ { D: 1 4 } { D: 2 3 } { D: 0 5 } }
|
||||||
{ { 0 0 } { 0 0 } }
|
{ { 0 0 } { 0 0 } }
|
||||||
|
|
|
@ -61,4 +61,4 @@ IN: compiler.cfg.stacks
|
||||||
[ ds-pop ] dip call ds-push ; inline
|
[ ds-pop ] dip call ds-push ; inline
|
||||||
|
|
||||||
: adjust-d ( n -- )
|
: adjust-d ( n -- )
|
||||||
<ds-loc> height-state get swap adjust ;
|
0 height-state get first [ + ] change-nth ;
|
||||||
|
|
Loading…
Reference in New Issue