summaryrefslogtreecommitdiff
path: root/chapter25/src/test/java/com/seaofnodes
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-09-12 16:10:33 -0700
committerCliff Click <cliffc@acm.org>2026-09-12 16:10:33 -0700
commitb1e1045173c4bc2525ffe9366c90549f5a325933 (patch)
treed5d2808a9e5793cf8d698a4922a703953f7c9068 /chapter25/src/test/java/com/seaofnodes
parent385db70abc590215a6af0ef53cbb9eefc5405759 (diff)
downloadSimple-b1e1045173c4bc2525ffe9366c90549f5a325933.tar.gz
Simple-b1e1045173c4bc2525ffe9366c90549f5a325933.zip
Major bugfix around unscheduable graphs
Robust assert about all data ops are schedulable. Utiltiies for several places domionator-like stuff is used. Removing a Phi with matching null/not-null values is now more robust; removes a major source if scheduling misalignment. Big comments about what gets covered by a null check, or not. Permanent list of fuzzer seeds that used to fail
Diffstat (limited to 'chapter25/src/test/java/com/seaofnodes')
-rw-r--r--chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java8
-rw-r--r--chapter25/src/test/java/com/seaofnodes/simple/fuzzer/Fuzzer.java18
2 files changed, 26 insertions, 0 deletions
diff --git a/chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java b/chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java
index f5e3d752..2677de5e 100644
--- a/chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java
+++ b/chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java
@@ -83,6 +83,14 @@ public class Chapter25Test {
assertEquals("return 0;",code.print());
}
+ @Test
+ public void testFuzzerBadLCA() {
+ new CodeGen("""
+ int v0=arg;
+ if(v0&&--v0?0:arg) {}
+ """).driver(CodeGen.Phase.LocalSched);
+ }
+
@Test @Ignore
public void testModule0() throws IOException {
String MODDIR = "src/test/java/com/seaofnodes/simple/test0";
diff --git a/chapter25/src/test/java/com/seaofnodes/simple/fuzzer/Fuzzer.java b/chapter25/src/test/java/com/seaofnodes/simple/fuzzer/Fuzzer.java
index 37fa03a6..223515f8 100644
--- a/chapter25/src/test/java/com/seaofnodes/simple/fuzzer/Fuzzer.java
+++ b/chapter25/src/test/java/com/seaofnodes/simple/fuzzer/Fuzzer.java
@@ -163,6 +163,24 @@ public class Fuzzer {
check(sb.toString(), valid, seed);
}
+ /**
+ * Run one seed as a regression test. Unlike the exploratory fuzzer path,
+ * this deliberately does not reduce on failure; old bad seeds should fail
+ * fast with the seed visible in the JUnit assertion.
+ */
+ public void fuzzPeepsRegression(long seed) {
+ var rand = new Random(seed);
+ var sb = new StringBuilder();
+ var valid = new ScriptGenerator(rand, sb, true).genProgram();
+ try {
+ runCheck(sb.toString(), valid);
+ } catch( Throwable e ) {
+ AssertionError ae = new AssertionError("Fuzzer regression seed failed: "+seed);
+ ae.initCause(e);
+ throw ae;
+ }
+ }
+
/**
* Check that no exceptions happened.