summaryrefslogtreecommitdiff
path: root/chapter08/src
diff options
context:
space:
mode:
authorSymious <14933944+symious@users.noreply.github.com>2026-09-10 02:52:50 +0800
committerGitHub <noreply@github.com>2026-09-09 11:52:50 -0700
commit8ac5cc6bd3b2d30af64a2c12e38b83af618af3c6 (patch)
tree4ace65ed63d22cf19eb6a74ac508c7cc1b87ebc2 /chapter08/src
parent7f3b8856119da7e4fd6fc0a9c0c740d7b0b3170f (diff)
downloadSimple-8ac5cc6bd3b2d30af64a2c12e38b83af618af3c6.tar.gz
Simple-8ac5cc6bd3b2d30af64a2c12e38b83af618af3c6.zip
Fix typo: spline -> spine in AddNode (chapters 4-8) (#248)
The add canonicalization builds a left-leaning chain of AddNodes -- the "spine" -- with off-spine operands hanging off each in(2). The comparator and its comments were spelled "spline" (a curve / mechanical part), which was already inconsistent with the goal comment in the same method: // Goal: a left-spine set of adds, with constants on the rhs Chapters 9 and later already use "spine" / "spine_cmp"; this brings the earlier chapters in line. Comment and private-method-name only, no behavior change. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'chapter08/src')
-rw-r--r--chapter08/src/main/java/com/seaofnodes/simple/node/AddNode.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/chapter08/src/main/java/com/seaofnodes/simple/node/AddNode.java b/chapter08/src/main/java/com/seaofnodes/simple/node/AddNode.java
index 84a368fd..0c66422d 100644
--- a/chapter08/src/main/java/com/seaofnodes/simple/node/AddNode.java
+++ b/chapter08/src/main/java/com/seaofnodes/simple/node/AddNode.java
@@ -66,7 +66,7 @@ public class AddNode extends Node {
// Now we might see (add add non) or (add non non) but never (add non add) nor (add add add)
if( !(lhs instanceof AddNode) )
// Rotate; look for (add (phi cons) con/(phi cons))
- return spline_cmp(lhs,rhs) ? swap12() : phiCon(this,true);
+ return spine_cmp(lhs,rhs) ? swap12() : phiCon(this,true);
// Now we only see (add add non)
@@ -87,11 +87,11 @@ public class AddNode extends Node {
Node phicon = phiCon(this,true);
if( phicon!=null ) return phicon;
- // Now we sort along the spline via rotates, to gather similar things together.
+ // Now we sort along the spine via rotates, to gather similar things together.
// Do we rotate (x + y) + z
// into (x + z) + y ?
- if( spline_cmp(lhs.in(2),rhs) )
+ if( spine_cmp(lhs.in(2),rhs) )
return new AddNode(new AddNode(lhs.in(1),rhs).peephole(),lhs.in(2));
return null;
@@ -138,12 +138,12 @@ public class AddNode extends Node {
return op instanceof PhiNode phi && phi.allCons() ? phi : null;
}
- // Compare two off-spline nodes and decide what order they should be in.
+ // Compare two off-spine nodes and decide what order they should be in.
// Do we rotate ((x + hi) + lo) into ((x + lo) + hi) ?
// Generally constants always go right, then Phi-of-constants, then muls, then others.
// Ties with in a category sort by node ID.
// TRUE if swapping hi and lo.
- static boolean spline_cmp( Node hi, Node lo ) {
+ static boolean spine_cmp( Node hi, Node lo ) {
if( lo._type.isConstant() ) return false;
if( hi._type.isConstant() ) return true ;