summaryrefslogtreecommitdiff
path: root/src/test/java/com/seaofnodes/simple/SchedulerTest.java
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-08-10 11:11:18 -0700
committerCliff Click <cliffc@acm.org>2026-10-24 15:56:44 -0700
commit741d78b6e840c88b7b183010c812ad982b342da1 (patch)
tree84a75eb7ad351bffd20cd5fb152bab032b74271c /src/test/java/com/seaofnodes/simple/SchedulerTest.java
parent8d90d2292bbdb23596849c3c3d1cda2f6cad783e (diff)
downloadSimple-linear-chapter28a.tar.gz
Simple-linear-chapter28a.zip
Chapter 28a: Modules and Lazy Class Initializationlinear-chapter28a
Co-authored-by: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: fuhsnn <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: Symious <14933944+symious@users.noreply.github.com> Co-authored-by: Jun Kawasaki <jun784@gmail.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/test/java/com/seaofnodes/simple/SchedulerTest.java')
-rw-r--r--src/test/java/com/seaofnodes/simple/SchedulerTest.java94
1 files changed, 0 insertions, 94 deletions
diff --git a/src/test/java/com/seaofnodes/simple/SchedulerTest.java b/src/test/java/com/seaofnodes/simple/SchedulerTest.java
deleted file mode 100644
index 6156700d..00000000
--- a/src/test/java/com/seaofnodes/simple/SchedulerTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.seaofnodes.simple;
-
-import com.seaofnodes.simple.codegen.CodeGen;
-import com.seaofnodes.simple.evaluator.Evaluator;
-import com.seaofnodes.simple.node.StopNode;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class SchedulerTest {
-
- @Test public void testMemoryPhiAcrossSiblingBranch() {
- // The inner memory Phi defines the load's memory. The outer Phi's
- // other input comes from a branch not dominated by that definition.
- String src = """
- struct S { int x; }; !S !a=new S; !S !b=new S;
- a.x=10; b.x=20; !S !p=a; if(arg>3) p=b;
- int result=0;
- if(arg>0) {
- if(arg>2) p.x=30; else p.x=40;
- result=a.x;
- }
- return result;
- """;
- var code = new CodeGen(src).driver(CodeGen.Phase.LocalSched);
- long[] expected = {0,40,40,30,10,10};
- for( int arg=0; arg<expected.length; arg++ )
- assertEquals(Long.toString(expected[arg]),Eval2.eval(code,arg));
- }
-
-
- private static void assertObj(Object obj, String name, Object... fields) {
- assertEquals(Evaluator.Obj.class, obj.getClass());
- var o = (Evaluator.Obj)obj;
- assertEquals(name, o.struct()._name);
- Assert.assertArrayEquals(fields, o.fields());
- }
-
- @Test
- @Ignore
- public void testJig() {
- CodeGen code = new CodeGen("""
-struct S {
- int f;
-}
-!S !v=new S;
-v.f = 2;
-int i=v.f;
-if (arg) v.f=1;
-return i;
-""");
- code.parse();//.iter().opto().iterPostOpto().finalizeIR();
- var eval = new Evaluator(code._stop);
- assertEquals(2L, eval.evaluate(1, 10));
- }
-
- @Test
- public void testStoreInIf() {
- CodeGen code = new CodeGen("""
-struct S {
- int f;
-};
-!S !v0=new S;
-if(arg) v0.f=1;
-return v0;
-""");
- code.driver(CodeGen.Phase.FinalizeIR);
- var eval = new Evaluator(code._stop);
- assertObj(eval.evaluate(0, 10), "S", 0L);
- assertObj(eval.evaluate(1, 10), "S", 1L);
- }
-
- @Test
- public void testStoreInIf2() {
- CodeGen code = new CodeGen("""
-struct S {
- int f;
-};
-!S !v=new S;
-v.f = 2;
-int i=new S.f;
-i=v.f;
-if (arg) v.f=1;
-return i;
-""");
- code.driver(CodeGen.Phase.FinalizeIR);
- var eval = new Evaluator(code._stop);
- assertEquals(2L, eval.evaluate(0, 10));
- assertEquals(2L, eval.evaluate(1, 10));
- }
-
-}