diff options
| author | Cliff Click <cliffc@acm.org> | 2026-08-10 11:11:18 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-11-16 16:23:52 -0800 |
| commit | 0b263f550d5e54d050f58f6b315b092944c9eff9 (patch) | |
| tree | aff564cf11711c41a6f94f17ffbc480e1b228da1 /src/test/java/com/seaofnodes/simple/EscapeFlowTest.java | |
| parent | 790268f4a1f6122376c34059f1633c1017436363 (diff) | |
| download | Simple-linear-chapter32.tar.gz Simple-linear-chapter32.zip | |
Chapter 32: Compiler Internal Speedupslinear-chapter32linear
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/EscapeFlowTest.java')
| -rw-r--r-- | src/test/java/com/seaofnodes/simple/EscapeFlowTest.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/java/com/seaofnodes/simple/EscapeFlowTest.java b/src/test/java/com/seaofnodes/simple/EscapeFlowTest.java index 12634f24..ee7406c6 100644 --- a/src/test/java/com/seaofnodes/simple/EscapeFlowTest.java +++ b/src/test/java/com/seaofnodes/simple/EscapeFlowTest.java @@ -113,6 +113,37 @@ public class EscapeFlowTest { assertTrue(XInt.bit(((TypeFunPtr)after.ret()).fidxs(),7)); } + // Ordinary arguments do not read Start, but a later opaque argument must + // subscribe both the summary and consumers of its exposed escapes. + @Test public void testSummaryOutsideDependency() { + CodeGen code = new CodeGen("return 0;").parse(); + code._phase = CodeGen.Phase.Opto; + TypeTuple state = TypeTuple.make(Type.CONTROL,TypeMem.START,TypeInteger.BOT); + code._start._type = TypeTuple.make(Type.CONTROL,TypeMem.BOT,TypeInteger.BOT); + Node ctrl = ConstantNode.raw(Type.CONTROL), mem = ConstantNode.raw(TypeMem.START); + Node arg = ConstantNode.raw(Type.BOTTOM); + SummaryNode summary = new SummaryNode(state,new int[0],ctrl,mem,arg).init(); + SummaryNode observer = new SummaryNode(state,new int[0],ctrl,mem).init(); + summary.exposed(observer); + code._iter._work.clear(); + code._start.setType(TypeTuple.make(Type.CONTROL,TypeMem.START.makeFrom(XInt.make(XInt.make(7),8),XInt.EMPTY),TypeInteger.BOT)); + assertFalse(code._iter._work.on(summary)); + assertFalse(code._iter._work.on(observer)); + + arg.setType(TypeMemPtr.makeNullable(TypeStruct.forward("OpaqueSummary"))); + assertTrue(code._iter._work.on(summary)); + assertTrue(code._iter._work.on(observer)); + assertTrue(XInt.bit(((TypeTuple)summary.compute()).mem()._escFs,7)); + assertTrue(XInt.bit(summary.exposed(observer)._escFs,7)); + code._iter._work.clear(); + code._start.setType(TypeTuple.make(Type.CONTROL,TypeMem.START.makeFrom(XInt.make(8),XInt.EMPTY),TypeInteger.BOT)); + assertTrue(code._iter._work.on(summary)); + assertTrue(code._iter._work.on(observer)); + assertTrue(XInt.bit(((TypeTuple)summary.compute()).mem()._escFs,8)); + assertTrue(XInt.bit(summary.exposed(observer)._escFs,8)); + assertFalse(XInt.bit(summary.exposed(observer)._escFs,7)); + } + // Public construction exposes the allocator; private-memory helpers // remain internal and can inline into it. @Test public void testPublicAllocator() { |
