diff options
| author | Cliff Click <cliffc@acm.org> | 2025-03-18 14:25:49 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2025-03-18 14:25:49 -0700 |
| commit | 59173187cc8c01506d1bc25447bd7a7f5fee8604 (patch) | |
| tree | 5179d912b790db73f75e373bfaf2e77a3c324517 /chapter21/src/main/java/com | |
| parent | 3bf52024aee9021521bfb85f7e894a3b343e6c85 (diff) | |
| download | Simple-59173187cc8c01506d1bc25447bd7a7f5fee8604.tar.gz Simple-59173187cc8c01506d1bc25447bd7a7f5fee8604.zip | |
Fix missed peep
only missing when running without asserts.
Diffstat (limited to 'chapter21/src/main/java/com')
| -rw-r--r-- | chapter21/src/main/java/com/seaofnodes/simple/Parser.java | 1 | ||||
| -rw-r--r-- | chapter21/src/main/java/com/seaofnodes/simple/node/CallNode.java | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/chapter21/src/main/java/com/seaofnodes/simple/Parser.java b/chapter21/src/main/java/com/seaofnodes/simple/Parser.java index 07f82625..092c5a9e 100644 --- a/chapter21/src/main/java/com/seaofnodes/simple/Parser.java +++ b/chapter21/src/main/java/com/seaofnodes/simple/Parser.java @@ -1407,6 +1407,7 @@ public class Parser { // Post-call setup CallEndNode cend = (CallEndNode)new CallEndNode(call).peephole(); + call.peephole(); // Rerun peeps after CallEnd, allows early inlining // Control from CallEnd ctrl(new CProjNode(cend,0,ScopeNode.CTRL).peephole()); // Memory from CallEnd diff --git a/chapter21/src/main/java/com/seaofnodes/simple/node/CallNode.java b/chapter21/src/main/java/com/seaofnodes/simple/node/CallNode.java index 484a613e..773716f7 100644 --- a/chapter21/src/main/java/com/seaofnodes/simple/node/CallNode.java +++ b/chapter21/src/main/java/com/seaofnodes/simple/node/CallNode.java @@ -91,6 +91,7 @@ public class CallNode extends CFGNode { // Link: call calls target function. Linking makes the target FunNode // point to this Call, and all his Parms point to the call arguments; // also the CallEnd points to the Return. + Node progress = null; if( fptr()._type instanceof TypeFunPtr tfp && tfp.nargs() == nargs() ) { // If fidxs is negative, then infinite unknown functions long fidxs = tfp.fidxs(); @@ -102,12 +103,12 @@ public class CallNode extends CFGNode { TypeFunPtr tfp0 = tfp.makeFrom(fidx); FunNode fun = CodeGen.CODE.link(tfp0); if( fun!=null && !fun._folding && !linked(fun) ) - link(fun); + progress = link(fun); } } } - return null; + return progress; } // True if Fun is linked to this Call @@ -120,7 +121,7 @@ public class CallNode extends CFGNode { // Link so this calls fun - private void link( FunNode fun ) { + private Node link( FunNode fun ) { assert !linked(fun); fun.addDef(this); for( Node use : fun._outputs ) @@ -128,7 +129,7 @@ public class CallNode extends CFGNode { parm.addDef(parm._idx==0 ? new ConstantNode(cend()._rpc).peephole() : arg(parm._idx)); // Call end points to function return CodeGen.CODE.add(cend()).addDef(fun.ret()); - assert linked(fun); + return this; } // Unlink all linked functions |
