From 518d5c60f714c7d5f58c3da484368cbf26e9bfd5 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Wed, 7 May 2025 11:28:33 -0700 Subject: Fix missing up/down phi peep. Slight shuffling of sys.smp triggers different worklist order, triggers missing peep. The pull-down phi op needs a reverse peep when more constants appear. CodeGen driver can be called repeatedly. Rename LogicalNode to ArithNode; use it on Add,Sub,MulDiv also. Bugfix jump in loop that both exits on one path and enters a deeper loop on other. --- chapter22/src/test/java/com/seaofnodes/simple/Chapter10Test.java | 1 + chapter22/src/test/java/com/seaofnodes/simple/Chapter13Test.java | 4 ++-- chapter22/src/test/java/com/seaofnodes/simple/Chapter18Test.java | 2 +- chapter22/src/test/java/com/seaofnodes/simple/Eval2.java | 4 +--- 4 files changed, 5 insertions(+), 6 deletions(-) (limited to 'chapter22/src/test/java') diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Chapter10Test.java b/chapter22/src/test/java/com/seaofnodes/simple/Chapter10Test.java index b7d65b95..712704db 100644 --- a/chapter22/src/test/java/com/seaofnodes/simple/Chapter10Test.java +++ b/chapter22/src/test/java/com/seaofnodes/simple/Chapter10Test.java @@ -379,6 +379,7 @@ while(0) {} } } } } +return 0; """); code.parse().opto(); assertEquals("return 0;", code.print()); diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Chapter13Test.java b/chapter22/src/test/java/com/seaofnodes/simple/Chapter13Test.java index a4644917..a19f85e3 100644 --- a/chapter22/src/test/java/com/seaofnodes/simple/Chapter13Test.java +++ b/chapter22/src/test/java/com/seaofnodes/simple/Chapter13Test.java @@ -132,13 +132,13 @@ return n.i; public void testNullRef4() { CodeGen code = new CodeGen("return -null-5/null-5;"); try { code.parse().opto().typeCheck(); fail(); } - catch( Exception e ) { assertEquals("Cannot 'Add' null",e.getMessage()); } + catch( Exception e ) { assertEquals("Cannot '+' null",e.getMessage()); } } @Test public void testNullRef5() { CodeGen code = new CodeGen("return null+42;"); try { code.parse().opto().typeCheck(); fail(); } - catch( Exception e ) { assertEquals("Cannot 'Add' null",e.getMessage()); } + catch( Exception e ) { assertEquals("Cannot '+' null",e.getMessage()); } } @Test diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Chapter18Test.java b/chapter22/src/test/java/com/seaofnodes/simple/Chapter18Test.java index 16634580..cd02fbca 100644 --- a/chapter22/src/test/java/com/seaofnodes/simple/Chapter18Test.java +++ b/chapter22/src/test/java/com/seaofnodes/simple/Chapter18Test.java @@ -33,7 +33,7 @@ while(arg--) { } return a; """); - code.parse().opto().typeCheck().GCM(); + code.parse().opto().typeCheck(); assertEquals("return Phi(Loop,1,Phi(Loop,2,Phi_a));", code._stop.toString()); assertEquals("1", Eval2.eval(code, 0)); assertEquals("2", Eval2.eval(code, 1)); diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Eval2.java b/chapter22/src/test/java/com/seaofnodes/simple/Eval2.java index 03221325..8ad72eaa 100644 --- a/chapter22/src/test/java/com/seaofnodes/simple/Eval2.java +++ b/chapter22/src/test/java/com/seaofnodes/simple/Eval2.java @@ -117,9 +117,7 @@ public abstract class Eval2 { if( code._start.uctrl()==null ) return ""; // The empty program SB trace = null; // new SB(); // TRACE, set to null for off, new SB() for on // Force local scheduling phase - if( code._phase.ordinal() < CodeGen.Phase.TypeCheck .ordinal() ) code.typeCheck(); - if( code._phase.ordinal() < CodeGen.Phase.Schedule .ordinal() ) code.GCM(); - if( code._phase.ordinal() < CodeGen.Phase.LocalSched.ordinal() ) code.localSched(); + code.driver(CodeGen.Phase.LocalSched); // Set global, so don't have to pass everywhere CODE = code; -- cgit v1.2.3