compiler.cfg.*: putting test-init in compiler.cfg.stacks.tests didn't work, put new word cfg-unit-test in compiler.test

db4
Björn Lindqvist 2015-03-26 22:46:37 +00:00 committed by John Benediktsson
parent 4390561a6e
commit b983053130
5 changed files with 47 additions and 52 deletions

View File

@ -1,5 +1,5 @@
USING: alien.c-types compiler.cfg.builder.alien compiler.cfg.instructions
compiler.cfg.registers compiler.cfg.stacks.local compiler.cfg.stacks.tests
compiler.cfg.registers compiler.cfg.stacks.local compiler.test
cpu.architecture kernel make namespaces tools.test ;
IN: compiler.cfg.builder.alien.tests
@ -8,6 +8,5 @@ IN: compiler.cfg.builder.alien.tests
{ { int-rep f f } { int-rep f f } }
V{ T{ ##unbox-any-c-ptr { dst 2 } { src 1 } } }
} [
test-init
[ { c-string int } unbox-parameters ] V{ } make
] unit-test
] cfg-unit-test

View File

@ -3,11 +3,11 @@ combinators.short-circuit compiler.cfg compiler.cfg.builder compiler.cfg.checker
compiler.cfg.debugger compiler.cfg.instructions compiler.cfg.optimizer
compiler.cfg.predecessors compiler.cfg.registers compiler.cfg.representations
compiler.cfg.rpo compiler.cfg.stacks compiler.cfg.stacks.local
compiler.cfg.stacks.tests compiler.cfg.utilities compiler.tree
compiler.tree.builder compiler.tree.optimizer fry hashtables kernel
kernel.private locals make math math.partial-dispatch math.private namespaces
prettyprint sbufs sequences sequences.private slots.private strings
strings.private tools.test vectors words ;
compiler.cfg.utilities compiler.test compiler.tree compiler.tree.builder
compiler.tree.optimizer fry hashtables kernel kernel.private locals make math
math.partial-dispatch math.private namespaces prettyprint sbufs sequences
sequences.private slots.private strings strings.private tools.test vectors
words ;
FROM: alien.c-types => int ;
IN: compiler.cfg.builder.tests
@ -248,18 +248,16 @@ IN: compiler.cfg.builder.tests
{
{ T{ ##load-integer { dst 78 } { val 0 } } }
} [
test-init
77 vreg-counter set-global
[
T{ #push { literal 0 } { out-d { 8537399 } } } emit-node
] { } make
] unit-test
] cfg-unit-test
{
{ { 1 1 } { 0 0 } }
H{ { D -1 4 } { D 0 4 } }
} [
test-init
4 D 0 replace-loc
T{ #shuffle
{ mapping { { 2 4 } { 3 4 } } }
@ -268,46 +266,42 @@ IN: compiler.cfg.builder.tests
} emit-node
height-state get
replace-mapping get
] unit-test
] cfg-unit-test
{ 1 } [
V{ } 0 insns>block basic-block set
begin-stack-analysis begin-local-analysis
V{ } 0 insns>block basic-block set init-cfg-test
V{ } 1 insns>block [ emit-loop-call ] V{ } make drop
basic-block get successors>> length
] unit-test
! emit-loop-call
{ "bar" } [
V{ } "foo" insns>block basic-block set
begin-stack-analysis begin-local-analysis [
V{ } "bar" insns>block emit-loop-call
] V{ } make drop basic-block get successors>> first number>>
V{ } "foo" insns>block basic-block set init-cfg-test
[ V{ } "bar" insns>block emit-loop-call ] V{ } make drop
basic-block get successors>> first number>>
] unit-test
! begin-cfg
SYMBOL: foo
{ foo } [
begin-stack-analysis \ foo f begin-cfg word>>
] unit-test
\ foo f begin-cfg word>>
] cfg-unit-test
! store-shuffle
{
H{ { D 2 1 } }
} [
test-init
T{ #shuffle { in-d { 7 3 0 } } { out-d { 55 } } { mapping { { 55 3 } } } }
emit-node replace-mapping get
] unit-test
] cfg-unit-test
{
H{ { D -1 1 } { D 0 1 } }
} [
test-init
T{ #shuffle
{ in-d { 7 } }
{ out-d { 55 77 } }
{ mapping { { 55 7 } { 77 7 } } }
} emit-node replace-mapping get
] unit-test
] cfg-unit-test

View File

@ -1,22 +1,21 @@
USING: accessors assocs biassocs combinators compiler.cfg
compiler.cfg.instructions compiler.cfg.registers compiler.cfg.stacks
compiler.cfg.stacks.height compiler.cfg.stacks.local compiler.cfg.stacks.tests
compiler.cfg.utilities cpu.architecture namespaces kernel tools.test ;
compiler.cfg.stacks.height compiler.cfg.stacks.local compiler.cfg.utilities
compiler.test cpu.architecture namespaces kernel tools.test ;
IN: compiler.cfg.stacks.local.tests
{
{ { 3 3 } { 0 0 } }
} [
test-init
D 3 inc-stack height-state get
] unit-test
] cfg-unit-test
{
{ { 5 3 } { 0 0 } }
} [
{ { 2 0 } { 0 0 } } height-state set
D 3 inc-stack height-state get
] unit-test
] cfg-unit-test
{
{ T{ ##inc { loc D 4 } } T{ ##inc { loc R -2 } } }
@ -25,8 +24,8 @@ IN: compiler.cfg.stacks.local.tests
] unit-test
{ 1 } [
test-init D 0 loc>vreg
] unit-test
D 0 loc>vreg
] cfg-unit-test
{
{
@ -34,24 +33,22 @@ IN: compiler.cfg.stacks.local.tests
T{ ##copy { dst 2 } { src 26 } { rep any-rep } }
}
} [
test-init { { D 0 25 } { R 0 26 } } stack-changes
] unit-test
{ { D 0 25 } { R 0 26 } } stack-changes
] cfg-unit-test
{ 80 } [
test-init
80 D 77 replace-loc
D 77 peek-loc
] unit-test
] cfg-unit-test
{ H{ { D -1 40 } } } [
test-init
D 1 inc-stack 40 D 0 replace-loc
replace-mapping get
] unit-test
D 1 inc-stack 40 D 0 replace-loc replace-mapping get
] cfg-unit-test
{ 0 } [
V{ } 0 insns>block basic-block set
test-init compute-local-kill-set assoc-size
init-cfg-test
compute-local-kill-set assoc-size
] unit-test
{ H{ { R -4 R -4 } } } [

View File

@ -1,28 +1,23 @@
USING: accessors arrays assocs combinators compiler.cfg.registers
compiler.cfg.stacks compiler.cfg.stacks.local kernel literals namespaces
tools.test ;
compiler.cfg.stacks compiler.cfg.stacks.local compiler.test kernel literals
namespaces tools.test ;
IN: compiler.cfg.stacks.tests
: test-init ( -- )
reset-vreg-counter begin-stack-analysis begin-local-analysis
H{ } clone replace-mapping set ;
{
H{ { D 1 4 } { D 2 3 } { D 0 5 } }
{ { 0 0 } { 0 0 } }
} [
test-init
{ 3 4 5 } ds-loc store-vregs
replace-mapping get
height-state get
] unit-test
] cfg-unit-test
! load-vregs
{
{ 1 2 3 4 5 6 7 8 }
} [
test-init 8 ds-loc load-vregs
] unit-test
8 ds-loc load-vregs
] cfg-unit-test
! 2inputs
{
@ -30,5 +25,5 @@ IN: compiler.cfg.stacks.tests
2
{ { -2 -2 } { 0 0 } }
} [
test-init 2inputs height-state get
] unit-test
2inputs height-state get
] cfg-unit-test

View File

@ -17,3 +17,13 @@ IN: compiler.test
: compiler-test ( name -- )
"resource:basis/compiler/tests/" ".factor" surround run-test-file ;
USING: compiler.cfg.registers compiler.cfg.stacks compiler.cfg.stacks.local
fry namespaces ;
: init-cfg-test ( -- )
reset-vreg-counter begin-stack-analysis begin-local-analysis
H{ } clone replace-mapping set ;
: cfg-unit-test ( result quot -- )
'[ init-cfg-test @ ] unit-test ; inline