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/CallEndTest.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/CallEndTest.java')
| -rw-r--r-- | src/test/java/com/seaofnodes/simple/CallEndTest.java | 24 |
1 files changed, 24 insertions, 0 deletions
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() { |
