From 6097e80178c0769f88835784de05656504bcc182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Thu, 30 Apr 2015 04:49:48 +0200 Subject: [PATCH] compiler.cfg.*: fixing tests so they work on 32bit archs too --- .../cfg/builder/alien/alien-tests.factor | 19 +++++++++++++++-- .../intrinsics/strings/strings-tests.factor | 8 ++++--- .../allocation/state/state-tests.factor | 21 ++++++++++++------- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/basis/compiler/cfg/builder/alien/alien-tests.factor b/basis/compiler/cfg/builder/alien/alien-tests.factor index 8d44b6c003..f6aa93d362 100644 --- a/basis/compiler/cfg/builder/alien/alien-tests.factor +++ b/basis/compiler/cfg/builder/alien/alien-tests.factor @@ -1,12 +1,27 @@ USING: alien.c-types compiler.cfg.builder.alien compiler.cfg.instructions compiler.cfg.registers compiler.cfg.stacks.local compiler.test -cpu.architecture kernel make namespaces tools.test ; +cpu.architecture kernel make namespaces system tools.test ; IN: compiler.cfg.builder.alien.tests +! unboxing ints is only needed on 32bit archs +cpu x86.32? +{ + { 2 4 } + { { int-rep f f } { int-rep f f } } + V{ + T{ ##unbox-any-c-ptr { dst 2 } { src 1 } } + T{ ##unbox + { dst 4 } + { src 3 } + { unboxer "to_fixnum" } + { rep int-rep } + } + } +} { { 2 3 } { { int-rep f f } { int-rep f f } } V{ T{ ##unbox-any-c-ptr { dst 2 } { src 1 } } } -} [ +} ? [ [ { c-string int } unbox-parameters ] V{ } make ] cfg-unit-test diff --git a/basis/compiler/cfg/intrinsics/strings/strings-tests.factor b/basis/compiler/cfg/intrinsics/strings/strings-tests.factor index 4b82de8981..1408238a0e 100644 --- a/basis/compiler/cfg/intrinsics/strings/strings-tests.factor +++ b/basis/compiler/cfg/intrinsics/strings/strings-tests.factor @@ -1,5 +1,6 @@ -USING: alien.c-types compiler.cfg.instructions compiler.cfg.intrinsics.strings -compiler.test cpu.architecture make tools.test ; +USING: accessors alien.c-types compiler.cfg.instructions +compiler.cfg.intrinsics.strings compiler.test cpu.architecture kernel make +sequences tools.test ; IN: compiler.cfg.intrinsics.strings.tests { @@ -9,11 +10,12 @@ IN: compiler.cfg.intrinsics.strings.tests T{ ##store-memory-imm { src 1 } { base 5 } - { offset 21 } + { offset "varies" } { rep int-rep } { c-type uchar } } } } [ [ emit-set-string-nth-fast ] V{ } make + dup third "varies" >>offset drop ] cfg-unit-test diff --git a/basis/compiler/cfg/linear-scan/allocation/state/state-tests.factor b/basis/compiler/cfg/linear-scan/allocation/state/state-tests.factor index 7d2f3bf72b..a072b71d45 100644 --- a/basis/compiler/cfg/linear-scan/allocation/state/state-tests.factor +++ b/basis/compiler/cfg/linear-scan/allocation/state/state-tests.factor @@ -1,4 +1,4 @@ -USING: accessors assocs combinators.extras compiler.cfg +USING: accessors arrays assocs combinators.extras compiler.cfg compiler.cfg.instructions compiler.cfg.linear-scan.allocation.state compiler.cfg.linear-scan.live-intervals compiler.cfg.utilities cpu.architecture cpu.x86.assembler.operands heaps kernel layouts namespaces sequences system @@ -62,13 +62,18 @@ cpu x86.64? [ ] when ! assign-spill-slot -{ - H{ - { { 3 8 } T{ spill-slot { n 32 } } } - { { 1234 8 } T{ spill-slot } } - { { 45 16 } T{ spill-slot { n 16 } } } - } -} [ +cpu x86.32? +H{ + { { 3 4 } T{ spill-slot { n 32 } } } + { { 1234 4 } T{ spill-slot } } + { { 45 16 } T{ spill-slot { n 16 } } } +} +H{ + { { 3 8 } T{ spill-slot { n 32 } } } + { { 1234 8 } T{ spill-slot } } + { { 45 16 } T{ spill-slot { n 16 } } } +} ? 1array +[ H{ } clone spill-slots set f f cfg set { 1234 45 3 } { int-rep double-2-rep tagged-rep }