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

View File

@ -1,10 +1,9 @@
USING: arrays byte-arrays compiler.cfg.gc-checks
compiler.cfg.gc-checks.private compiler.cfg.debugger
compiler.cfg.registers compiler.cfg.instructions compiler.cfg
compiler.cfg.predecessors compiler.cfg.rpo cpu.architecture
tools.test kernel vectors namespaces accessors sequences alien
memory classes make combinators.short-circuit
compiler.cfg.comparisons compiler.test compiler.cfg.utilities ;
USING: accessors alien arrays byte-arrays combinators.short-circuit
compiler.cfg compiler.cfg.comparisons compiler.cfg.debugger
compiler.cfg.gc-checks compiler.cfg.gc-checks.private
compiler.cfg.instructions compiler.cfg.registers compiler.cfg.rpo
compiler.cfg.utilities compiler.test cpu.architecture kernel layouts
math memory namespaces sequences tools.test ;
IN: compiler.cfg.gc-checks.tests
! insert-gc-check?
@ -15,7 +14,13 @@ IN: compiler.cfg.gc-checks.tests
! allocation-size
{ 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
! add-gc-checks

View File

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

View File

@ -1,8 +1,14 @@
USING: compiler.codegen compiler.codegen.labels
compiler.codegen.relocation tools.test cpu.architecture math
kernel make compiler.constants words ;
USING: compiler.cfg.utilities compiler.codegen compiler.codegen.labels
compiler.constants cpu.architecture kernel make math tools.test ;
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
{ } [ [ \ + %call ] with-fixup drop ] unit-test

View File

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