]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg.ssa.destruction: fix and testcase for the
authorBjörn Lindqvist <bjourne@gmail.com>
Sat, 9 May 2015 21:02:30 +0000 (23:02 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 10 May 2015 03:04:22 +0000 (20:04 -0700)
"lookup-base-pointer* does not define a method for the POSTPONE: f
class" bug

basis/compiler/cfg/ssa/destruction/destruction-tests.factor
basis/compiler/cfg/ssa/destruction/destruction.factor

index e225709e0cec46968bd612fe039bec9fb7b0965a..236eaa598958cdd19265e861a17699271add1ba9 100644 (file)
@@ -1,7 +1,8 @@
-USING: compiler.cfg.instructions compiler.cfg.registers
-compiler.cfg.ssa.destruction compiler.cfg.ssa.destruction.leaders
-compiler.cfg.ssa.destruction.private cpu.architecture kernel make namespaces
-tools.test ;
+USING: alien.syntax compiler.cfg.def-use compiler.cfg.instructions
+compiler.cfg.registers compiler.cfg.ssa.destruction
+compiler.cfg.ssa.destruction.leaders
+compiler.cfg.ssa.destruction.private compiler.cfg.utilities
+cpu.architecture cpu.x86.assembler.operands make namespaces tools.test ;
 IN: compiler.cfg.ssa.destruction.tests
 
 ! cleanup-insn
@@ -25,3 +26,39 @@ IN: compiler.cfg.ssa.destruction.tests
     T{ ##parallel-copy { values V{ } } }
     [ cleanup-insn ] V{ } make
 ] unit-test
+
+! init-coalescing
+{
+    H{ { 123 123 } { 77 77 } }
+} [
+    H{ { 123 "bb1" } { 77 "bb2" } } defs set
+    init-coalescing
+    leader-map get
+] unit-test
+
+! destruct-ssa
+{ } [
+    H{ { 36 23 } { 23 23 } } leader-map set
+    H{ { 36 int-rep } { 37 tagged-rep } } representations set
+    V{
+        T{ ##alien-invoke
+           { reg-inputs V{ { 56 int-rep RDI } } }
+           { stack-inputs V{ } }
+           { reg-outputs { { 36 int-rep RAX } } }
+           { dead-outputs { } }
+           { cleanup 0 }
+           { stack-size 0 }
+           { symbols "g_quark_to_string" }
+           { dll DLL" libglib-2.0.so" }
+           { gc-map T{ gc-map { scrub-d { } } { scrub-r { } } } }
+           { insn# 14 }
+        }
+        T{ ##call-gc { gc-map T{ gc-map { scrub-d { } } { scrub-r { } } } } }
+        T{ ##box-alien
+           { dst 37 }
+           { src 36 }
+           { temp 11 }
+           { insn# 18 }
+        }
+    } 0 insns>block block>cfg destruct-ssa
+] unit-test
index f876c5f38e6907d6c42f8a58023779ef77e394aa..5d421a133d3d5e534bf20a91e2e94c552bd8d1db 100644 (file)
@@ -11,7 +11,6 @@ cpu.architecture kernel locals make namespaces sequences sets ;
 FROM: namespaces => set ;
 IN: compiler.cfg.ssa.destruction
 
-! Maps leaders to equivalence class elements.
 SYMBOL: class-element-map
 
 : class-elements ( vreg -- elts ) class-element-map get at ;
@@ -26,7 +25,7 @@ SYMBOL: copies
 
 : init-coalescing ( -- )
     defs get
-    [ [ drop dup ] assoc-map leader-map set ]
+    [ keys unique leader-map set ]
     [
         [ [ dup dup value-of ] dip <vreg-info> 1array ] assoc-map
         class-element-map set
@@ -132,6 +131,7 @@ M: insn cleanup-insn , ;
 PRIVATE>
 
 : destruct-ssa ( cfg -- )
+    H{ } clone leader-map set
     {
         needs-dominance
         construct-cssa