From 0b263f550d5e54d050f58f6b315b092944c9eff9 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Mon, 10 Aug 2026 11:11:18 -0700 Subject: Chapter 32: Compiler Internal Speedups 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 Co-authored-by: Claude Opus 5 --- .../java/com/seaofnodes/simple/EscapeFlowTest.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/test/java/com/seaofnodes/simple/EscapeFlowTest.java') 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() { -- cgit v1.2.3