summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSymious <14933944+symious@users.noreply.github.com>2026-09-10 02:59:59 +0800
committerGitHub <noreply@github.com>2026-09-09 11:59:59 -0700
commit4f8ef2140e5c41913f3f2ab49c554c6548609684 (patch)
tree42dd5f1052a68b6cea754f1c7d1a5114ad5d6301
parent8ac5cc6bd3b2d30af64a2c12e38b83af618af3c6 (diff)
downloadSimple-4f8ef2140e5c41913f3f2ab49c554c6548609684.tar.gz
Simple-4f8ef2140e5c41913f3f2ab49c554c6548609684.zip
Fix stale copy-pasted comment on BoolNode's phiCon call (#249)
The three comment lines above `AddNode.phiCon(this, ...)` in BoolNode were copy-pasted from MulNode and never adapted: they use `*` as the operator and describe the rotated shape `(x * (phi cons)) * con`. For BoolNode neither is right. The operator is a compare, and in chapters 6-9 `rotate` is hard-coded `false`, so the rotated shape is never matched; the shapes actually handled are `(phi cons) cmp con` and `(phi cons) cmp (phi cons)`. Reword the comment accordingly, and in chapters 6-9 add a line noting why rotate is off. Chapters 10-25 pass `this instanceof EQ`, so no such claim is made there. Comment-only change; no code is touched. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
-rw-r--r--chapter06/src/main/java/com/seaofnodes/simple/node/BoolNode.java7
-rw-r--r--chapter07/src/main/java/com/seaofnodes/simple/node/BoolNode.java7
-rw-r--r--chapter08/src/main/java/com/seaofnodes/simple/node/BoolNode.java7
-rw-r--r--chapter09/src/main/java/com/seaofnodes/simple/node/BoolNode.java7
-rw-r--r--chapter10/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter11/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter12/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter13/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter15/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter16/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter17/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter18/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter19/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter20/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter21/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter23/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter24/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
-rw-r--r--chapter25/src/main/java/com/seaofnodes/simple/node/BoolNode.java6
19 files changed, 61 insertions, 57 deletions
diff --git a/chapter06/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter06/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index a9ec6838..79c65c60 100644
--- a/chapter06/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter06/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -43,9 +43,10 @@ abstract public class BoolNode extends Node {
if( in(1)==in(2) )
return new ConstantNode(TypeInteger.constant(doOp(3,3)?1:0));
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
+ // No rotate: compares are not associative.
Node phicon = AddNode.phiCon(this,false);
if( phicon!=null ) return phicon;
diff --git a/chapter07/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter07/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index 0c32d50d..5948a1d3 100644
--- a/chapter07/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter07/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -45,9 +45,10 @@ abstract public class BoolNode extends Node {
if( in(1)==in(2) )
return new ConstantNode(TypeInteger.constant(doOp(3,3)?1:0));
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
+ // No rotate: compares are not associative.
Node phicon = AddNode.phiCon(this,false);
if( phicon!=null ) return phicon;
diff --git a/chapter08/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter08/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index 0c32d50d..5948a1d3 100644
--- a/chapter08/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter08/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -45,9 +45,10 @@ abstract public class BoolNode extends Node {
if( in(1)==in(2) )
return new ConstantNode(TypeInteger.constant(doOp(3,3)?1:0));
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
+ // No rotate: compares are not associative.
Node phicon = AddNode.phiCon(this,false);
if( phicon!=null ) return phicon;
diff --git a/chapter09/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter09/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index d3fcec95..ee643bf5 100644
--- a/chapter09/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter09/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -44,9 +44,10 @@ abstract public class BoolNode extends Node {
if( in(1)==in(2) )
return new ConstantNode(TypeInteger.constant(doOp(3,3)?1:0));
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
+ // No rotate: compares are not associative.
Node phicon = AddNode.phiCon(this,false);
if( phicon!=null ) return phicon;
diff --git a/chapter10/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter10/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index 9c15f01b..8719e4d5 100644
--- a/chapter10/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter10/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -60,9 +60,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index 9c15f01b..8719e4d5 100644
--- a/chapter11/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter11/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -60,9 +60,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter12/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter12/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index a31bd963..f202b263 100644
--- a/chapter12/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter12/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -67,9 +67,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter13/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter13/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index a31bd963..f202b263 100644
--- a/chapter13/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter13/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -67,9 +67,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter15/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter15/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index aa9fd312..06c10a79 100644
--- a/chapter15/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter15/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -69,9 +69,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter16/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter16/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index aa9fd312..06c10a79 100644
--- a/chapter16/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter16/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -69,9 +69,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter17/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter17/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index aa9fd312..06c10a79 100644
--- a/chapter17/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter17/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -69,9 +69,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter18/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter18/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index 83893968..dc57f7b4 100644
--- a/chapter18/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter18/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -70,9 +70,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter19/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter19/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index 93e5e4e9..0d255cb2 100644
--- a/chapter19/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter19/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -69,9 +69,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter20/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter20/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index e6b87ce8..3f959e75 100644
--- a/chapter20/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter20/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -71,9 +71,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter21/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter21/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index fd6448a2..5f96c591 100644
--- a/chapter21/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter21/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -71,9 +71,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index 301e1517..0cf8b87e 100644
--- a/chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -71,9 +71,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter23/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter23/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index 2765c308..513f8d31 100644
--- a/chapter23/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter23/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -71,9 +71,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter24/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter24/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index 2765c308..513f8d31 100644
--- a/chapter24/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter24/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -71,9 +71,9 @@ abstract public class BoolNode extends Node {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;
diff --git a/chapter25/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter25/src/main/java/com/seaofnodes/simple/node/BoolNode.java
index c8722f67..ef71983e 100644
--- a/chapter25/src/main/java/com/seaofnodes/simple/node/BoolNode.java
+++ b/chapter25/src/main/java/com/seaofnodes/simple/node/BoolNode.java
@@ -102,9 +102,9 @@ abstract public class BoolNode extends Node implements ModeNode {
return new NotNode(in(1));
}
- // Do we have ((x * (phi cons)) * con) ?
- // Do we have ((x * (phi cons)) * (phi cons)) ?
- // Push constant up through the phi: x * (phi con0*con0 con1*con1...)
+ // Do we have ((phi cons) cmp con) ?
+ // Do we have ((phi cons) cmp (phi cons)) ?
+ // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...)
Node phicon = AddNode.phiCon(this,this instanceof EQ);
if( phicon!=null ) return phicon;