summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chapter18/src/main/java/com/seaofnodes/simple/JSViewer.java2
-rw-r--r--chapter18/src/main/java/com/seaofnodes/simple/node/StoreNode.java4
-rw-r--r--chapter18/src/main/java/com/seaofnodes/simple/type/Type.java3
-rw-r--r--chapter18/src/main/java/com/seaofnodes/simple/type/TypeFunPtr.java13
-rw-r--r--chapter18/src/main/java/com/seaofnodes/simple/type/TypeMem.java6
-rw-r--r--chapter18/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java6
-rw-r--r--chapter18/src/main/java/com/seaofnodes/simple/type/TypeStruct.java1
-rw-r--r--chapter18/src/main/java/com/seaofnodes/simple/type/TypeTuple.java6
8 files changed, 37 insertions, 4 deletions
diff --git a/chapter18/src/main/java/com/seaofnodes/simple/JSViewer.java b/chapter18/src/main/java/com/seaofnodes/simple/JSViewer.java
index 15174085..d208fc0c 100644
--- a/chapter18/src/main/java/com/seaofnodes/simple/JSViewer.java
+++ b/chapter18/src/main/java/com/seaofnodes/simple/JSViewer.java
@@ -251,7 +251,7 @@ public class JSViewer implements AutoCloseable {
sb.p(text);
if( n._type!=null ) {
sb.p("<br /><font point-size=\"10\">");
- n._type.print(sb);
+ n._type.gprint(sb);
sb.p("</font>");
}
if( dark ) sb.p("</font>");
diff --git a/chapter18/src/main/java/com/seaofnodes/simple/node/StoreNode.java b/chapter18/src/main/java/com/seaofnodes/simple/node/StoreNode.java
index 284b7464..44a56a93 100644
--- a/chapter18/src/main/java/com/seaofnodes/simple/node/StoreNode.java
+++ b/chapter18/src/main/java/com/seaofnodes/simple/node/StoreNode.java
@@ -79,14 +79,14 @@ public class StoreNode extends MemOpNode {
// Cannot fold a store of a single element over the array body initializer value
!(tmp._obj.isAry() && tmp._obj._fields[1]._alias==_alias) &&
// Very sad strong cutout: val has to be legal to hoist to a New
- // input, which means it cannot depend on the New. Many many
+ // input, which means it cannot depend on the New. Many, many
// things are legal here but difficult to check without doing a
// full dominator check. Example failure:
// "struct C { C? c; }; C self = new C { c=self; }"
val()._type.isHighOrConst() &&
// Must have exactly one use of "this" or you get weird
// non-serializable memory effects in the worse case.
- checkOnlyUse(st) &&
+ //checkOnlyUse(st) &&
// Folding away a broken store
err()==null ) {
nnn.setDef(nnn.findAlias(_alias),val());
diff --git a/chapter18/src/main/java/com/seaofnodes/simple/type/Type.java b/chapter18/src/main/java/com/seaofnodes/simple/type/Type.java
index f44b9b63..70e2dccf 100644
--- a/chapter18/src/main/java/com/seaofnodes/simple/type/Type.java
+++ b/chapter18/src/main/java/com/seaofnodes/simple/type/Type.java
@@ -207,7 +207,8 @@ public class Type {
return print(new SB()).toString();
}
- public SB print(SB sb) { return is_simple() ? sb.p(STRS[_type]) : sb;}
+ public SB print(SB sb) { return is_simple() ? sb.p(STRS[_type]) : sb;}
+ public SB gprint(SB sb) { return print(sb); }
// This is used by error messages, and is a shorted print.
public String str() { return STRS[_type]; }
diff --git a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeFunPtr.java b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeFunPtr.java
index 1906e212..3a0c91ea 100644
--- a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeFunPtr.java
+++ b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeFunPtr.java
@@ -87,6 +87,19 @@ public class TypeFunPtr extends Type {
if( (_fidxs&1)==1 ) sb.p("?");
return sb;
}
+ @Override
+ public SB gprint(SB sb) {
+ if( this== NULLPTR) return sb.p("null");
+ if( this== VOIDPTR) return sb.p("*void");
+ sb.p("{ ");
+ for( int i=1; i<_sig._types.length; i++ )
+ _sig._types[i].gprint(sb).p(" ");
+ _sig._types[0].gprint(sb.p("-> "));
+ sb.p(String.format(" #%X",_fidxs));
+ sb.p("}");
+ if( (_fidxs&1)==1 ) sb.p("?");
+ return sb;
+ }
@Override public String str() {
if( this== NULLPTR) return "null";
diff --git a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMem.java b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMem.java
index 8c0bdca8..007a18d6 100644
--- a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMem.java
+++ b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMem.java
@@ -62,6 +62,12 @@ public class TypeMem extends Type {
if( _alias==0 ) return sb.p(_t._type==TTOP ? "TOP" : "BOT");
return _t.print(sb.p(_alias).p(":"));
}
+ @Override
+ public SB gprint(SB sb) {
+ sb.p("#");
+ if( _alias==0 ) return sb.p(_t._type==TTOP ? "TOP" : "BOT");
+ return _t.gprint(sb.p(_alias).p(":"));
+ }
@Override public String str() { return toString(); }
}
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 a009cc4a..b675eef5 100644
--- a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java
+++ b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeMemPtr.java
@@ -89,6 +89,12 @@ public class TypeMemPtr extends Type {
if( this== VOIDPTR) return sb.p("*void");
return _obj.print(sb.p("*")).p(_nil ? "?" : "");
}
+ @Override
+ public SB gprint(SB sb) {
+ if( this== NULLPTR) return sb.p("null");
+ if( this== VOIDPTR) return sb.p("*void");
+ return _obj.gprint(sb.p("*")).p(_nil ? "?" : "");
+ }
@Override public String str() {
if( this== NULLPTR) return "null";
diff --git a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeStruct.java b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeStruct.java
index 239c6df1..c3ee5eb3 100644
--- a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeStruct.java
+++ b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeStruct.java
@@ -204,6 +204,7 @@ public class TypeStruct extends Type {
f._type.print(sb).p(f._final ? " " : " !").p(f._fname).p("; ");
return sb.p("}");
}
+ @Override public SB gprint( SB sb ) { return sb.p(_name); }
@Override public String str() { return _name; }
diff --git a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeTuple.java b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeTuple.java
index 7e1296e2..be4c18b1 100644
--- a/chapter18/src/main/java/com/seaofnodes/simple/type/TypeTuple.java
+++ b/chapter18/src/main/java/com/seaofnodes/simple/type/TypeTuple.java
@@ -51,6 +51,12 @@ public class TypeTuple extends Type {
t.print(sb).p(", ");
return sb.unchar(2).p("]");
}
+ @Override public SB gprint(SB sb) {
+ sb.p("[ ");
+ for( Type t : _types )
+ t.gprint(sb).p(", ");
+ return sb.unchar(2).p("]");
+ }
@Override public String str() {
SB sb = new SB().p("[ ");