compiler.*: more compiler tests

locals-and-roots
Björn Lindqvist 2016-04-22 12:44:25 +02:00
parent e58e1b9a65
commit 3e14ceafe2
5 changed files with 51 additions and 25 deletions

View File

@ -1,9 +1,10 @@
USING: accessors alien alien.accessors arrays assocs byte-arrays USING: accessors alien alien.accessors arrays assocs byte-arrays
combinators.short-circuit compiler.cfg compiler.cfg.builder combinators.short-circuit compiler.cfg compiler.cfg.builder
compiler.cfg.builder.blocks compiler.cfg.checker compiler.cfg.debugger compiler.cfg.builder.blocks compiler.cfg.checker compiler.cfg.debugger
compiler.cfg.instructions compiler.cfg.optimizer compiler.cfg.instructions compiler.cfg.linearization
compiler.cfg.registers compiler.cfg.stacks.local compiler.cfg.optimizer compiler.cfg.registers
compiler.cfg.utilities compiler.test compiler.tree compiler.cfg.stacks.local compiler.cfg.utilities compiler.test
compiler.tree compiler.tree.builder compiler.tree.optimizer
compiler.tree.propagation.info cpu.architecture fry hashtables io compiler.tree.propagation.info cpu.architecture fry hashtables io
kernel kernel.private locals make math math.intervals kernel kernel.private locals make math math.intervals
math.partial-dispatch math.private namespaces prettyprint sbufs math.partial-dispatch math.private namespaces prettyprint sbufs
@ -244,11 +245,10 @@ SYMBOL: foo
\ foo f begin-cfg word>> \ foo f begin-cfg word>>
] cfg-unit-test ] cfg-unit-test
! make-input-map ! build-cfg
{ { 5 } [
{ { 37 D: 2 } { 81 D: 1 } { 92 D: 0 } } [ dup ] build-tree optimize-tree gensym build-cfg
} [ first linearization-order length
T{ #shuffle { in-d { 37 81 92 } } } make-input-map
] unit-test ] unit-test
! emit-branch ! emit-branch
@ -380,6 +380,12 @@ SYMBOL: foo
<basic-block> dup set-basic-block end-word instructions>> <basic-block> dup set-basic-block end-word instructions>>
] unit-test ] unit-test
! make-input-map
{
{ { 37 D: 2 } { 81 D: 1 } { 92 D: 0 } }
} [
T{ #shuffle { in-d { 37 81 92 } } } make-input-map
] unit-test
! store-shuffle ! store-shuffle
{ {

View File

@ -1,10 +1,9 @@
USING: arrays byte-arrays compiler.cfg.gc-checks USING: accessors alien arrays byte-arrays combinators.short-circuit
compiler.cfg.gc-checks.private compiler.cfg.debugger compiler.cfg compiler.cfg.comparisons compiler.cfg.debugger
compiler.cfg.registers compiler.cfg.instructions compiler.cfg compiler.cfg.gc-checks compiler.cfg.gc-checks.private
compiler.cfg.predecessors compiler.cfg.rpo cpu.architecture compiler.cfg.instructions compiler.cfg.registers compiler.cfg.rpo
tools.test kernel vectors namespaces accessors sequences alien compiler.cfg.utilities compiler.test cpu.architecture kernel layouts
memory classes make combinators.short-circuit math memory namespaces sequences tools.test ;
compiler.cfg.comparisons compiler.test compiler.cfg.utilities ;
IN: compiler.cfg.gc-checks.tests IN: compiler.cfg.gc-checks.tests
! insert-gc-check? ! insert-gc-check?
@ -15,7 +14,13 @@ IN: compiler.cfg.gc-checks.tests
! allocation-size ! allocation-size
{ t } [ { t } [
V{ T{ ##box-alien f 0 1 } } allocation-size 123 <alien> size = V{ T{ ##box-alien f 0 1 } } allocation-size
123 <alien> size =
] unit-test
{ t } [
V{ T{ ##box-alien } T{ ##replace } } allocation-size
5 cells data-alignment get align =
] unit-test ] unit-test
! add-gc-checks ! add-gc-checks

View File

@ -1,9 +1,9 @@
USING: accessors alien assocs compiler.cfg.comparisons compiler.cfg.liveness USING: accessors alien assocs compiler.cfg compiler.cfg.comparisons
compiler.cfg compiler.cfg.debugger compiler.cfg.def-use compiler.cfg.debugger compiler.cfg.def-use compiler.cfg.instructions
compiler.cfg.instructions compiler.cfg.predecessors compiler.cfg.registers compiler.cfg.liveness compiler.cfg.registers
compiler.cfg.ssa.destruction.leaders compiler.cfg.utilities cpu.architecture compiler.cfg.ssa.destruction.leaders compiler.cfg.utilities
cpu.x86.assembler.operands dlists math namespaces sequences kernel system cpu.architecture cpu.x86.assembler.operands kernel math namespaces
tools.test vectors ; sequences system tools.test ;
IN: compiler.cfg.liveness.tests IN: compiler.cfg.liveness.tests
QUALIFIED: sets QUALIFIED: sets
@ -74,6 +74,11 @@ QUALIFIED: sets
{ 123 124 125 } sets:unique gc-roots { 123 124 125 } sets:unique gc-roots
] unit-test ] unit-test
! gen-uses
{ H{ { 37 37 } } } [
H{ } clone [ T{ ##replace f 37 D: 0 0 } gen-uses ] keep
] unit-test
! kill-defs ! kill-defs
{ H{ } } [ { H{ } } [
H{ } dup T{ ##peek f 37 D: 0 0 } kill-defs H{ } dup T{ ##peek f 37 D: 0 0 } kill-defs

View File

@ -1,8 +1,14 @@
USING: compiler.codegen compiler.codegen.labels USING: compiler.cfg.utilities compiler.codegen compiler.codegen.labels
compiler.codegen.relocation tools.test cpu.architecture math compiler.constants cpu.architecture kernel make math tools.test ;
kernel make compiler.constants words ;
IN: compiler.codegen.tests IN: compiler.codegen.tests
! useless-branch?
{ t f } [
{ } 0 insns>block { } 1 insns>block useless-branch?
{ } 0 insns>block { } 20 insns>block useless-branch?
] unit-test
{ } [ [ ] with-fixup drop ] unit-test { } [ [ ] with-fixup drop ] unit-test
{ } [ [ \ + %call ] with-fixup drop ] unit-test { } [ [ \ + %call ] with-fixup drop ] unit-test

View File

@ -23,3 +23,7 @@ H{ } clone copies set
{ 1 } [ 3 resolve-copy ] unit-test { 1 } [ 3 resolve-copy ] unit-test
{ 1 } [ 4 resolve-copy ] unit-test { 1 } [ 4 resolve-copy ] unit-test
{ 0 } [ 6 resolve-copy ] unit-test { 0 } [ 6 resolve-copy ] unit-test
{ 1234 } [
H{ { 1234 1234 } } copies set 1234 resolve-copy
] unit-test