diff options
| author | Symious <14933944+symious@users.noreply.github.com> | 2026-09-10 02:59:59 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-09 11:59:59 -0700 |
| commit | 4f8ef2140e5c41913f3f2ab49c554c6548609684 (patch) | |
| tree | 42dd5f1052a68b6cea754f1c7d1a5114ad5d6301 /chapter06/src/main/java | |
| parent | 8ac5cc6bd3b2d30af64a2c12e38b83af618af3c6 (diff) | |
| download | Simple-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>
Diffstat (limited to 'chapter06/src/main/java')
| -rw-r--r-- | chapter06/src/main/java/com/seaofnodes/simple/node/BoolNode.java | 7 |
1 files changed, 4 insertions, 3 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; |
