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/CallEndTest.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/test/java/com/seaofnodes/simple/CallEndTest.java') diff --git a/src/test/java/com/seaofnodes/simple/CallEndTest.java b/src/test/java/com/seaofnodes/simple/CallEndTest.java index f57fd96a..bba3a2c8 100644 --- a/src/test/java/com/seaofnodes/simple/CallEndTest.java +++ b/src/test/java/com/seaofnodes/simple/CallEndTest.java @@ -7,6 +7,30 @@ import org.junit.Test; import static org.junit.Assert.*; public class CallEndTest { + // Inlining unlinks the original call before cloning. Each edited Parm + // needs a visit even when removing the argument leaves its type unchanged. + @Test public void testUnlinkSchedulesParameters() { + CodeGen code = new CodeGen("val f = { int x -> x+1; }; return f(arg);").parse(); + FunNode fun = null; + for( FunNode f : code._linker ) + if( f!=null && "f".equals(f._name) ) fun=f; + assertNotNull(fun); + CallNode call = null; + for( Node in : fun._inputs ) + if( in instanceof CallNode c ) call=c; + assertNotNull(call); + Node[] uses = fun._outputs.asAry(); + code._iter._work.clear(); + call.unlink(fun,fun._inputs.find(call)); + int parms = 0; + for( Node use : uses ) + if( use instanceof ParmNode && !use.isDead() ) { + assertTrue(code._iter._work.on(use)); + parms++; + } + assertTrue(parms>0); + } + // An unknown value can become a private object or callback. Both escape // sinks must reserve those possibilities before the value is known. @Test public void testUnknownEscapesRefineToPrivateValues() { -- cgit v1.2.3