compiler.cfg.*: new unit test vocabs

db4
Björn Lindqvist 2014-12-31 02:56:00 +01:00
parent 5782855343
commit d0dde922bd
3 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,14 @@
USING: accessors assocs combinators compiler.cfg compiler.cfg.registers
compiler.cfg.stacks compiler.cfg.stacks.height kernel tools.test ;
IN: compiler.cfg.stacks.height.tests
{
T{ ds-loc f 4 }
T{ rs-loc f 5 }
} [
begin-stack-analysis
3 4 T{ basic-block }
[ record-stack-heights ]
[ D 1 swap untranslate-loc ]
[ R 1 swap untranslate-loc ] tri
] unit-test

View File

@ -0,0 +1,36 @@
USING: accessors assocs biassocs combinators compiler.cfg.instructions
compiler.cfg.registers compiler.cfg.stacks.local cpu.architecture kernel
namespaces sequences tools.test ;
IN: compiler.cfg.stacks.local.tests
{ T{ current-height f 3 0 3 0 } } [
current-height new current-height [
3 inc-d current-height get
] with-variable
] unit-test
{
{ T{ ##inc-d { n 4 } } T{ ##inc-r { n -2 } } }
} [
T{ current-height { emit-d 4 } { emit-r -2 } } height-changes
] unit-test
{ 30 } [
29 vreg-counter set-global <bihash> locs>vregs set D 0 loc>vreg
] unit-test
{
{
T{ ##copy { dst 1 } { src 25 } { rep any-rep } }
T{ ##copy { dst 2 } { src 26 } { rep any-rep } }
}
} [
0 vreg-counter set-global <bihash> locs>vregs set
{ { D 0 25 } { R 0 26 } } stack-changes
] unit-test
{ 80 } [
current-height new current-height set
H{ } clone replace-mapping set 80
D 77 replace-loc D 77 peek-loc
] unit-test

View File

@ -0,0 +1,12 @@
USING: accessors arrays assocs combinators compiler.cfg.registers
compiler.cfg.stacks.local kernel literals namespaces tools.test ;
IN: compiler.cfg.stacks
{ H{ { D -2 4 } { D -1 3 } { D -3 5 } } } [
{
${ current-height current-height new }
${ replace-mapping H{ } clone }
} [
{ 3 4 5 } ds-store replace-mapping get
] with-variables
] unit-test