From 53452331d8e69dc3bcd40a56a4f00f9380140e73 Mon Sep 17 00:00:00 2001 From: RobertObkircher Date: Sun, 16 Feb 2025 20:31:23 +0100 Subject: Cleanup (#162) * remove unused method lazyFRef * remove unused method copyF(Node, Node) * make TypeMemPtr constants final * make ConstantNode value final --- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 10 +++++----- .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 10 +++++----- .../src/main/java/com/seaofnodes/simple/node/BoolNode.java | 1 - .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 10 +++++----- .../src/main/java/com/seaofnodes/simple/node/BoolNode.java | 1 - .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 10 +++++----- .../src/main/java/com/seaofnodes/simple/node/BoolNode.java | 1 - .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 10 +++++----- .../src/main/java/com/seaofnodes/simple/node/BoolNode.java | 1 - .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 10 +++++----- .../src/main/java/com/seaofnodes/simple/node/BoolNode.java | 1 - .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 10 +++++----- chapter17/src/main/java/com/seaofnodes/simple/Parser.java | 10 ---------- .../src/main/java/com/seaofnodes/simple/node/BoolNode.java | 1 - .../src/main/java/com/seaofnodes/simple/node/ConstantNode.java | 2 +- .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 10 +++++----- .../src/main/java/com/seaofnodes/simple/node/BoolNode.java | 1 - .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 8 ++++---- .../src/main/java/com/seaofnodes/simple/node/BoolNode.java | 1 - .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 8 ++++---- .../src/main/java/com/seaofnodes/simple/node/BoolNode.java | 1 - .../src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java | 8 ++++---- 37 files changed, 68 insertions(+), 87 deletions(-) diff --git a/chapter02/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter02/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index e4d7f412..671de049 100644 --- a/chapter02/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter02/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -16,7 +16,7 @@ import com.seaofnodes.simple.type.Type; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter03/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter03/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index e4d7f412..671de049 100644 --- a/chapter03/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter03/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -16,7 +16,7 @@ import com.seaofnodes.simple.type.Type; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter04/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter04/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 1086037d..23bc4d1a 100644 --- a/chapter04/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter04/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -16,7 +16,7 @@ import com.seaofnodes.simple.type.Type; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter05/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter05/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 1086037d..23bc4d1a 100644 --- a/chapter05/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter05/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -16,7 +16,7 @@ import com.seaofnodes.simple.type.Type; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter06/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter06/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 1086037d..23bc4d1a 100644 --- a/chapter06/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter06/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -16,7 +16,7 @@ import com.seaofnodes.simple.type.Type; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter07/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter07/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 13006bfb..49bb30ea 100644 --- a/chapter07/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter07/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter08/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter08/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 13006bfb..49bb30ea 100644 --- a/chapter08/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter08/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter09/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter09/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 9e45198c..2012a30a 100644 --- a/chapter09/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter09/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter10/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter10/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index ca42c2dc..e4c084d4 100644 --- a/chapter10/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter10/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter10/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter10/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index 65352402..9392da20 100644 --- a/chapter10/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter10/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -29,11 +29,11 @@ public class TypeMemPtr extends Type { public static TypeMemPtr make(TypeStruct obj, boolean nil) { return new TypeMemPtr(obj, nil).intern(); } public static TypeMemPtr make(TypeStruct obj) { return TypeMemPtr.make(obj, false); } - public static TypeMemPtr BOT = make(TypeStruct.BOT,true); - public static TypeMemPtr TOP = BOT.dual(); - public static TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); - public static TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null - public static TypeMemPtr TEST= make(TypeStruct.TEST,false); + public static final TypeMemPtr BOT = make(TypeStruct.BOT,true); + public static final TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); + public static final TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null + public static final TypeMemPtr TEST= make(TypeStruct.TEST,false); public static void gather(ArrayList ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); } @Override diff --git a/chapter11/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter11/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index cf1a76b0..31edb848 100644 --- a/chapter11/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter11/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter11/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter11/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index 65352402..9392da20 100644 --- a/chapter11/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter11/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -29,11 +29,11 @@ public class TypeMemPtr extends Type { public static TypeMemPtr make(TypeStruct obj, boolean nil) { return new TypeMemPtr(obj, nil).intern(); } public static TypeMemPtr make(TypeStruct obj) { return TypeMemPtr.make(obj, false); } - public static TypeMemPtr BOT = make(TypeStruct.BOT,true); - public static TypeMemPtr TOP = BOT.dual(); - public static TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); - public static TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null - public static TypeMemPtr TEST= make(TypeStruct.TEST,false); + public static final TypeMemPtr BOT = make(TypeStruct.BOT,true); + public static final TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); + public static final TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null + public static final TypeMemPtr TEST= make(TypeStruct.TEST,false); public static void gather(ArrayList ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); } @Override 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 48faefd2..a31bd963 100644 --- a/chapter12/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter12/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -47,7 +47,6 @@ abstract public class BoolNode extends Node { boolean doOp(long lhs, long rhs) { throw Utils.TODO(); } boolean doOp(double lhs, double rhs) { throw Utils.TODO(); } - Node copyF(Node lhs, Node rhs) { throw Utils.TODO(); } @Override public Node idealize() { diff --git a/chapter12/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter12/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index cf1a76b0..31edb848 100644 --- a/chapter12/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter12/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter12/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter12/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index 65352402..9392da20 100644 --- a/chapter12/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter12/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -29,11 +29,11 @@ public class TypeMemPtr extends Type { public static TypeMemPtr make(TypeStruct obj, boolean nil) { return new TypeMemPtr(obj, nil).intern(); } public static TypeMemPtr make(TypeStruct obj) { return TypeMemPtr.make(obj, false); } - public static TypeMemPtr BOT = make(TypeStruct.BOT,true); - public static TypeMemPtr TOP = BOT.dual(); - public static TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); - public static TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null - public static TypeMemPtr TEST= make(TypeStruct.TEST,false); + public static final TypeMemPtr BOT = make(TypeStruct.BOT,true); + public static final TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); + public static final TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null + public static final TypeMemPtr TEST= make(TypeStruct.TEST,false); public static void gather(ArrayList ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); } @Override 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 48faefd2..a31bd963 100644 --- a/chapter13/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter13/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -47,7 +47,6 @@ abstract public class BoolNode extends Node { boolean doOp(long lhs, long rhs) { throw Utils.TODO(); } boolean doOp(double lhs, double rhs) { throw Utils.TODO(); } - Node copyF(Node lhs, Node rhs) { throw Utils.TODO(); } @Override public Node idealize() { diff --git a/chapter13/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter13/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 016b0b9b..bbd0ce8a 100644 --- a/chapter13/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter13/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter13/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter13/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index e671c584..81725a87 100644 --- a/chapter13/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter13/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -35,11 +35,11 @@ public class TypeMemPtr extends Type { public static TypeMemPtr make(TypeStruct obj) { return make(obj, false); } public TypeMemPtr make_from(TypeStruct obj) { return make(obj, _nil); } - public static TypeMemPtr BOT = make(TypeStruct.BOT,true); - public static TypeMemPtr TOP = BOT.dual(); - public static TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); - public static TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null - public static TypeMemPtr TEST= make(TypeStruct.TEST,false); + public static final TypeMemPtr BOT = make(TypeStruct.BOT,true); + public static final TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); + public static final TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null + public static final TypeMemPtr TEST= make(TypeStruct.TEST,false); public static void gather(ArrayList ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); } @Override diff --git a/chapter14/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter14/src/main/java/com/seaofnodes/simple/node/BoolNode.java index f0cca1e2..ae042f30 100644 --- a/chapter14/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter14/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -52,7 +52,6 @@ abstract public class BoolNode extends Node { TypeInteger doOp(TypeInteger t1, TypeInteger t2) { throw Utils.TODO(); } boolean doOp(double lhs, double rhs) { throw Utils.TODO(); } - Node copyF(Node lhs, Node rhs) { return null; } @Override public Node idealize() { diff --git a/chapter14/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter14/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 016b0b9b..bbd0ce8a 100644 --- a/chapter14/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter14/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter14/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter14/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index 06fe2963..c93c3074 100644 --- a/chapter14/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter14/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -35,11 +35,11 @@ public class TypeMemPtr extends Type { public static TypeMemPtr make(TypeStruct obj) { return make(obj, false); } public TypeMemPtr make_from(TypeStruct obj) { return make(obj, _nil); } - public static TypeMemPtr BOT = make(TypeStruct.BOT,true); - public static TypeMemPtr TOP = BOT.dual(); - public static TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); - public static TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null - public static TypeMemPtr TEST= make(TypeStruct.TEST,false); + public static final TypeMemPtr BOT = make(TypeStruct.BOT,true); + public static final TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); + public static final TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null + public static final TypeMemPtr TEST= make(TypeStruct.TEST,false); public static void gather(ArrayList ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); } @Override 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 238be00e..aa9fd312 100644 --- a/chapter15/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter15/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -49,7 +49,6 @@ abstract public class BoolNode extends Node { TypeInteger doOp(TypeInteger t1, TypeInteger t2) { throw Utils.TODO(); } boolean doOp(double lhs, double rhs) { throw Utils.TODO(); } - Node copyF(Node lhs, Node rhs) { return null; } @Override public Node idealize() { diff --git a/chapter15/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter15/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 845b9d08..d760c0df 100644 --- a/chapter15/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter15/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter15/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter15/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index 8b484235..4b70546c 100644 --- a/chapter15/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter15/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -37,13 +37,13 @@ public class TypeMemPtr extends Type { // An abstract pointer, pointing to either a Struct or an Array. // Can also be null or not. - public static TypeMemPtr BOT = make(TypeStruct.BOT,true); - public static TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr BOT = make(TypeStruct.BOT,true); + public static final TypeMemPtr TOP = BOT.dual(); // An abstract null (can be Struct or Array) or not-null C void* - public static TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); - public static TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null + public static final TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); + public static final TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null - public static TypeMemPtr TEST= make(TypeStruct.TEST,false); + public static final TypeMemPtr TEST= make(TypeStruct.TEST,false); public static void gather(ArrayList ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); } @Override 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 238be00e..aa9fd312 100644 --- a/chapter16/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter16/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -49,7 +49,6 @@ abstract public class BoolNode extends Node { TypeInteger doOp(TypeInteger t1, TypeInteger t2) { throw Utils.TODO(); } boolean doOp(double lhs, double rhs) { throw Utils.TODO(); } - Node copyF(Node lhs, Node rhs) { return null; } @Override public Node idealize() { diff --git a/chapter16/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter16/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 845b9d08..d760c0df 100644 --- a/chapter16/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter16/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter16/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter16/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index ec059b8f..ebcda0d8 100644 --- a/chapter16/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter16/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -37,13 +37,13 @@ public class TypeMemPtr extends Type { // An abstract pointer, pointing to either a Struct or an Array. // Can also be null or not. - public static TypeMemPtr BOT = make(TypeStruct.BOT,true); - public static TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr BOT = make(TypeStruct.BOT,true); + public static final TypeMemPtr TOP = BOT.dual(); // An abstract null (can be Struct or Array) or not-null C void* - public static TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); - public static TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null + public static final TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); + public static final TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null - public static TypeMemPtr TEST= make(TypeStruct.TEST,false); + public static final TypeMemPtr TEST= make(TypeStruct.TEST,false); public static void gather(ArrayList ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); } @Override diff --git a/chapter17/src/main/java/com/seaofnodes/simple/Parser.java b/chapter17/src/main/java/com/seaofnodes/simple/Parser.java index 5a44b63e..adc47edc 100644 --- a/chapter17/src/main/java/com/seaofnodes/simple/Parser.java +++ b/chapter17/src/main/java/com/seaofnodes/simple/Parser.java @@ -729,16 +729,6 @@ public class Parser { return tary; } - // Fixup forward refs lazily. Basically a Union-Find flavored read - // barrier. - Type lazyFRef(Type t) { - //if( !t.isFRef() ) return t; - //Type def = Parser.TYPES.get(((TypeMemPtr)t)._obj._name); - throw Utils.TODO(); - - } - - /** * Parse an expression of the form: * 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 238be00e..aa9fd312 100644 --- a/chapter17/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter17/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -49,7 +49,6 @@ abstract public class BoolNode extends Node { TypeInteger doOp(TypeInteger t1, TypeInteger t2) { throw Utils.TODO(); } boolean doOp(double lhs, double rhs) { throw Utils.TODO(); } - Node copyF(Node lhs, Node rhs) { return null; } @Override public Node idealize() { diff --git a/chapter17/src/main/java/com/seaofnodes/simple/node/ConstantNode.java b/chapter17/src/main/java/com/seaofnodes/simple/node/ConstantNode.java index 845b9d08..d760c0df 100644 --- a/chapter17/src/main/java/com/seaofnodes/simple/node/ConstantNode.java +++ b/chapter17/src/main/java/com/seaofnodes/simple/node/ConstantNode.java @@ -18,7 +18,7 @@ import java.util.BitSet; * The Constant's value is the value stored in it. */ public class ConstantNode extends Node { - Type _con; + final Type _con; public ConstantNode( Type type ) { super(Parser.START); _con = type; diff --git a/chapter17/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter17/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index 786a7be5..c24fccf3 100644 --- a/chapter17/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter17/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -40,13 +40,13 @@ public class TypeMemPtr extends Type { // An abstract pointer, pointing to either a Struct or an Array. // Can also be null or not. - public static TypeMemPtr BOT = make(TypeStruct.BOT,true); - public static TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr BOT = make(TypeStruct.BOT,true); + public static final TypeMemPtr TOP = BOT.dual(); // An abstract null (can be Struct or Array) or not-null C void* - public static TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); - public static TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null + public static final TypeMemPtr NULLPTR = make(TypeStruct.TOP,true); + public static final TypeMemPtr VOIDPTR = NULLPTR.dual(); // A bottom mix of not-null ptrs, like C's void* but not null - public static TypeMemPtr TEST= make(TypeStruct.TEST,false); + public static final TypeMemPtr TEST= make(TypeStruct.TEST,false); public static void gather(ArrayList ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); } @Override 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 ae968ca1..83893968 100644 --- a/chapter18/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter18/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -50,7 +50,6 @@ abstract public class BoolNode extends Node { TypeInteger doOp(TypeInteger t1, TypeInteger t2) { throw Utils.TODO(); } boolean doOp(double lhs, double rhs) { throw Utils.TODO(); } - Node copyF(Node lhs, Node rhs) { return null; } @Override public Node idealize() { diff --git a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index d7a8b17d..7e607838 100644 --- a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -42,11 +42,11 @@ public class TypeMemPtr extends TypeNil { // An abstract pointer, pointing to either a Struct or an Array. // Can also be null or not, so 4 choices {TOP,BOT} x {nil,not} - public static TypeMemPtr BOT = make((byte)3, TypeStruct.BOT); - public static TypeMemPtr TOP = BOT.dual(); - public static TypeMemPtr NOTBOT = make((byte)2,TypeStruct.BOT); + public static final TypeMemPtr BOT = make((byte)3, TypeStruct.BOT); + public static final TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr NOTBOT = make((byte)2,TypeStruct.BOT); - public static TypeMemPtr TEST= make((byte)2, TypeStruct.TEST); + public static final TypeMemPtr TEST= make((byte)2, TypeStruct.TEST); public static void gather(ArrayList ts) { ts.add(NOTBOT); ts.add(BOT); ts.add(TEST); } @Override 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 84be11a9..93e5e4e9 100644 --- a/chapter19/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter19/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -49,7 +49,6 @@ abstract public class BoolNode extends Node { TypeInteger doOp(TypeInteger t1, TypeInteger t2) { throw Utils.TODO(); } boolean doOp(double lhs, double rhs) { throw Utils.TODO(); } - Node copyF(Node lhs, Node rhs) { return null; } @Override public Node idealize() { diff --git a/chapter19/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter19/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index d7a8b17d..7e607838 100644 --- a/chapter19/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter19/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -42,11 +42,11 @@ public class TypeMemPtr extends TypeNil { // An abstract pointer, pointing to either a Struct or an Array. // Can also be null or not, so 4 choices {TOP,BOT} x {nil,not} - public static TypeMemPtr BOT = make((byte)3, TypeStruct.BOT); - public static TypeMemPtr TOP = BOT.dual(); - public static TypeMemPtr NOTBOT = make((byte)2,TypeStruct.BOT); + public static final TypeMemPtr BOT = make((byte)3, TypeStruct.BOT); + public static final TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr NOTBOT = make((byte)2,TypeStruct.BOT); - public static TypeMemPtr TEST= make((byte)2, TypeStruct.TEST); + public static final TypeMemPtr TEST= make((byte)2, TypeStruct.TEST); public static void gather(ArrayList ts) { ts.add(NOTBOT); ts.add(BOT); ts.add(TEST); } @Override 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 84be11a9..93e5e4e9 100644 --- a/chapter20/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter20/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -49,7 +49,6 @@ abstract public class BoolNode extends Node { TypeInteger doOp(TypeInteger t1, TypeInteger t2) { throw Utils.TODO(); } boolean doOp(double lhs, double rhs) { throw Utils.TODO(); } - Node copyF(Node lhs, Node rhs) { return null; } @Override public Node idealize() { diff --git a/chapter20/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java b/chapter20/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java index d7a8b17d..7e607838 100644 --- a/chapter20/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java +++ b/chapter20/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java @@ -42,11 +42,11 @@ public class TypeMemPtr extends TypeNil { // An abstract pointer, pointing to either a Struct or an Array. // Can also be null or not, so 4 choices {TOP,BOT} x {nil,not} - public static TypeMemPtr BOT = make((byte)3, TypeStruct.BOT); - public static TypeMemPtr TOP = BOT.dual(); - public static TypeMemPtr NOTBOT = make((byte)2,TypeStruct.BOT); + public static final TypeMemPtr BOT = make((byte)3, TypeStruct.BOT); + public static final TypeMemPtr TOP = BOT.dual(); + public static final TypeMemPtr NOTBOT = make((byte)2,TypeStruct.BOT); - public static TypeMemPtr TEST= make((byte)2, TypeStruct.TEST); + public static final TypeMemPtr TEST= make((byte)2, TypeStruct.TEST); public static void gather(ArrayList ts) { ts.add(NOTBOT); ts.add(BOT); ts.add(TEST); } @Override -- cgit v1.2.3