Skip to content

Commit

Permalink
Cleanup (#162)
Browse files Browse the repository at this point in the history
* remove unused method lazyFRef

* remove unused method copyF(Node, Node)

* make TypeMemPtr constants final

* make ConstantNode value final
  • Loading branch information
RobertObkircher authored Feb 16, 2025
1 parent 9d6e0fd commit 5345233
Show file tree
Hide file tree
Showing 37 changed files with 68 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ private TypeMemPtr(TypeStruct obj, boolean nil) {
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<Type> ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ private TypeMemPtr(TypeStruct obj, boolean nil) {
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<Type> ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public Type compute() {

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ private TypeMemPtr(TypeStruct obj, boolean nil) {
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<Type> ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public Type compute() {

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ private TypeMemPtr(TypeStruct obj, boolean nil) {
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<Type> ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public TypeInteger compute() {

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ private TypeMemPtr(TypeStruct obj, boolean nil) {
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<Type> ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public TypeInteger compute() {

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ private TypeMemPtr(TypeStruct obj, boolean nil) {

// 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<Type> ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public TypeInteger compute() {

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ private TypeMemPtr(TypeStruct obj, boolean nil) {

// 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<Type> ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
10 changes: 0 additions & 10 deletions chapter17/src/main/java/com/seaofnodes/simple/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -729,16 +729,6 @@ private TypeMemPtr typeAry( Type t ) {
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:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public TypeInteger compute() {

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ private TypeMemPtr(TypeStruct obj, boolean nil) {

// 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<Type> ts) { ts.add(NULLPTR); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public TypeInteger compute() {

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ private TypeMemPtr(byte nil, TypeStruct obj) {

// 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<Type> ts) { ts.add(NOTBOT); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public TypeInteger compute() {

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ private TypeMemPtr(byte nil, TypeStruct obj) {

// 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<Type> ts) { ts.add(NOTBOT); ts.add(BOT); ts.add(TEST); }

@Override
Expand Down
Loading

0 comments on commit 5345233

Please sign in to comment.