diff options
Diffstat (limited to 'chapter18/src/test/java')
| -rw-r--r-- | chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java | 20 | ||||
| -rw-r--r-- | chapter18/src/test/java/com/seaofnodes/simple/Eval2.java | 2 |
2 files changed, 20 insertions, 2 deletions
diff --git a/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java b/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java index 64c07cf0..0e92c8c0 100644 --- a/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java +++ b/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java @@ -13,9 +13,9 @@ public class Chapter18Test { """ return 0; """); - code.parse().opto().typeCheck().GCM(); + code.parse().opto().typeCheck().GCM().localSched(); assertEquals("return 0;", code._stop.toString()); - assertEquals("0", Eval2.eval(code, 1)); + assertEquals("0", Eval2.eval(code, 2)); } @Test @@ -297,4 +297,20 @@ for(;;) { assertEquals("0", Eval2.eval(code, 0)); } + // Inline hidden called more than once + @Test + public void testInline() { + CodeGen code = new CodeGen( +""" +{int->int}?! i2i = {int i->return i;}; +{{int->int}->{int->int}}! f2f = {{int->int} f->return f;}; +val o = i2i; +if (arg) i2i = null; +if (i2i) return i2i(arg); +return f2f(o)(1); +"""); + code.parse().opto().typeCheck().GCM().localSched(); + assertEquals("Stop[ return Phi(Region,o( arg),o( 1)); return Parm_i(o,int,arg,1); ]", code._stop.toString()); + assertEquals("1", Eval2.eval(code, 2)); + } } diff --git a/chapter18/src/test/java/com/seaofnodes/simple/Eval2.java b/chapter18/src/test/java/com/seaofnodes/simple/Eval2.java index 006034e9..913e21e9 100644 --- a/chapter18/src/test/java/com/seaofnodes/simple/Eval2.java +++ b/chapter18/src/test/java/com/seaofnodes/simple/Eval2.java @@ -137,6 +137,7 @@ public abstract class Eval2 { // Evaluate until exit or timeout. Each outer loop step computes // all data nodes under some new Control. while( true ) { + assert BB!=null; traceCtrl(BB,trace); if( trace!=null ) System.out.println(F.p()); @@ -165,6 +166,7 @@ public abstract class Eval2 { case RegionNode r : break; default: throw Utils.TODO(); } + assert !BB.isDead(); } } |
