diff options
Diffstat (limited to 'chapter14')
4 files changed, 15 insertions, 15 deletions
diff --git a/chapter14/README.md b/chapter14/README.md index 2ca7d977..7ac1e5e3 100644 --- a/chapter14/README.md +++ b/chapter14/README.md @@ -46,15 +46,15 @@ rounded when assigned, and inflated to 64-bits when loaded. The complete list of primitive types is now: ```java -int, i64; // 64-bits, matching modern hardware -// u64 // NOT implemented, as it hints at some kind of >64 bit behavior +int, i64 // 64-bits, matching modern hardware +// u64 // NOT implemented, as it hints at some kind of >64 bit behavior i32, u32 // 32 bits, sign or zero extended on load i16, u16 // 16 bits, sign or zero extended on load i8, u8 // 8 bits, sign or zero extended on load i1, u1 // 1 bit , sign or zero extended on load bool // Same as u1 -flt, f64 .// IEEE 754 64-bit float, sometimes called a "double" -f32 .// IEEE 754 32-bit float +flt, f64 // IEEE 754 64-bit float, sometimes called a "double" +f32 // IEEE 754 32-bit float ``` diff --git a/chapter14/src/main/java/com/seaofnodes/simple/node/AddNode.java b/chapter14/src/main/java/com/seaofnodes/simple/node/AddNode.java index 6a28e9e6..f3b213fb 100644 --- a/chapter14/src/main/java/com/seaofnodes/simple/node/AddNode.java +++ b/chapter14/src/main/java/com/seaofnodes/simple/node/AddNode.java @@ -111,7 +111,7 @@ public class AddNode extends Node { return null; } - // Rotation is only valid for associative ops, e.g. Add, Mul, And, Or. + // Rotation is only valid for associative ops, e.g. Add, Mul, And, Or, Xor. // Do we have ((phi cons)|(x + (phi cons)) + con|(phi cons)) ? // Push constant up through the phi: x + (phi con0+con0 con1+con1...) static Node phiCon(Node op, boolean rotate) { diff --git a/chapter14/src/main/java/com/seaofnodes/simple/node/OrNode.java b/chapter14/src/main/java/com/seaofnodes/simple/node/OrNode.java index 24577b16..1b32d4fb 100644 --- a/chapter14/src/main/java/com/seaofnodes/simple/node/OrNode.java +++ b/chapter14/src/main/java/com/seaofnodes/simple/node/OrNode.java @@ -36,8 +36,8 @@ public class OrNode extends Node { Type t1 = lhs._type; Type t2 = rhs._type; - // Or of 0. We do not check for (0&x) because this will already - // canonicalize to (x&0) + // Or of 0. We do not check for (0|x) because this will already + // canonicalize to (x|0) if( t2.isConstant() && t2 instanceof TypeInteger i && i.value()==0 ) return lhs; @@ -45,9 +45,9 @@ public class OrNode extends Node { if ( t1.isConstant() && !t2.isConstant() ) return swap12(); - // 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 ((x | (phi cons)) | con) ? + // Do we have ((x | (phi cons)) | (phi cons)) ? + // Push constant up through the phi: x | (phi con0|con0 con1|con1...) Node phicon = AddNode.phiCon(this,true); if( phicon!=null ) return phicon; diff --git a/chapter14/src/main/java/com/seaofnodes/simple/node/XorNode.java b/chapter14/src/main/java/com/seaofnodes/simple/node/XorNode.java index 0e235eae..30a88dca 100644 --- a/chapter14/src/main/java/com/seaofnodes/simple/node/XorNode.java +++ b/chapter14/src/main/java/com/seaofnodes/simple/node/XorNode.java @@ -36,8 +36,8 @@ public class XorNode extends Node { Type t1 = lhs._type; Type t2 = rhs._type; - // Xor of 0. We do not check for (0&x) because this will already - // canonicalize to (x&0) + // Xor of 0. We do not check for (0^x) because this will already + // canonicalize to (x^0) if( t2.isConstant() && t2 instanceof TypeInteger i && i.value()==0 ) return lhs; @@ -45,9 +45,9 @@ public class XorNode extends Node { if ( t1.isConstant() && !t2.isConstant() ) return swap12(); - // 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 ((x ^ (phi cons)) ^ con) ? + // Do we have ((x ^ (phi cons)) ^ (phi cons)) ? + // Push constant up through the phi: x ^ (phi con0^con0 con1^con1...) Node phicon = AddNode.phiCon(this,true); if( phicon!=null ) return phicon; |
