diff options
| author | Cliff Click <cliffc@acm.org> | 2026-09-20 14:49:32 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-09-20 14:49:32 -0700 |
| commit | 0487ef57a2b7f80fd6f9ed3f6aeea0b0ec88e89f (patch) | |
| tree | ce84334450dbe54ca9ea3c7f39419730b4f86678 /chapter20/src/test | |
| parent | 4f3d4859e9096ab8f15c3e9eb02d154c268b108d (diff) | |
| download | Simple-0487ef57a2b7f80fd6f9ed3f6aeea0b0ec88e89f.tar.gz Simple-0487ef57a2b7f80fd6f9ed3f6aeea0b0ec88e89f.zip | |
Add back copy coaleascing in ch21
Minor arm encoding fix.
Diffstat (limited to 'chapter20/src/test')
| -rw-r--r-- | chapter20/src/test/java/com/seaofnodes/simple/Chapter20Test.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/chapter20/src/test/java/com/seaofnodes/simple/Chapter20Test.java b/chapter20/src/test/java/com/seaofnodes/simple/Chapter20Test.java index 8e9b0272..00a8407f 100644 --- a/chapter20/src/test/java/com/seaofnodes/simple/Chapter20Test.java +++ b/chapter20/src/test/java/com/seaofnodes/simple/Chapter20Test.java @@ -10,6 +10,23 @@ import static com.seaofnodes.simple.Main.PORTS; import static org.junit.Assert.*; public class Chapter20Test { + @Test public void testInlinedReturnValue() { + String src = """ +struct S { int x; }; +val f = { S s -> s.x = g(); }; +val g = { -> 123; }; +S !s = new S; +return f(s); +"""; + // The entry of g can disappear before its Return is folded into f. + // Exercise both worklist orders; deleting the entry does not kill 123. + for( int seed=0; seed<64; seed++ ) { + CodeGen code = new CodeGen(src,com.seaofnodes.simple.type.TypeInteger.BOT,seed).parse().opto().typeCheck(); + assertEquals("seed "+seed, "123", Eval2.eval(code,0)); + } + } + + @org.junit.Rule public final org.junit.rules.ErrorCollector _errors = new org.junit.rules.ErrorCollector(); @Test public void testAllocatorMasks() { com.seaofnodes.simple.codegen.RegAllocTestSupport.masks(); } @Test public void testAllocatorUnion() { com.seaofnodes.simple.codegen.RegAllocTestSupport.union(); } |
