Skip to content

Commit 94e4a77

Browse files
Sync with final ch21
1 parent 6c9ca8e commit 94e4a77

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

seaofnodes/src/main/java/com/compilerprogramming/ezlang/compiler/nodes/CallEndNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public Node idealize() {
5959

6060
// Trivial inlining: call site calls a single function; single function
6161
// is only called by this call site.
62-
if( !_folding && nIns()==2 && in(0) instanceof CallNode call ) {
62+
if( false && !_folding && nIns()==2 && in(0) instanceof CallNode call ) {
6363
Node fptr = call.fptr();
6464
if( fptr.nOuts() == 1 && // Only user is this call
6565
fptr instanceof ConstantNode && // We have an immediate call

seaofnodes/src/main/java/com/compilerprogramming/ezlang/compiler/nodes/CallNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void unlink_all() {
138138
assert linked(fun);
139139
int idx = fun._inputs.find(this);
140140
for( Node use : fun._outputs )
141-
if( use instanceof ParmNode parm )
141+
if( use instanceof ParmNode )
142142
use.delDef(idx);
143143
fun.delDef(idx);
144144
cend().delDef(cend()._inputs.find(fun.ret()));

seaofnodes/src/main/java/com/compilerprogramming/ezlang/compiler/nodes/FunNode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public Node idealize() {
8888

8989
// Upgrade inferred or user-written return type to actual
9090
if( _ret!=null && _ret._type instanceof SONTypeTuple tt && tt.ret() != _sig.ret() )
91+
// FIXME Dibyendu
9192
//throw Utils.TODO();
9293
return null;
9394

seaofnodes/src/main/java/com/compilerprogramming/ezlang/compiler/nodes/ReturnNode.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ public SONType compute() {
6161
if( inProgress () ) return null;
6262
if( _fun.isDead() ) return null;
6363

64-
// // Upgrade signature based on return type
64+
// Upgrade signature based on return type
65+
// FIXME Dibyendu - EZ lang does not support modifying function signature
66+
// but we should probably do the checking?
6567
// SONType ret = expr()._type;
6668
// SONTypeFunPtr fcn = _fun.sig();
6769
// assert ret.isa(fcn.ret());

seaofnodes/src/main/java/com/compilerprogramming/ezlang/compiler/sontypes/SONTypeMemPtr.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public SONTypeMemPtr(byte nil, SONTypeStruct obj) {
4343

4444
// An abstract pointer, pointing to either a Struct or an Array.
4545
// Can also be null or not, so 4 choices {TOP,BOT} x {nil,not}
46-
public static SONTypeMemPtr BOT = make((byte)3, SONTypeStruct.BOT);
47-
public static SONTypeMemPtr TOP = BOT.dual();
48-
public static SONTypeMemPtr NOTBOT = make((byte)2, SONTypeStruct.BOT);
46+
public static final SONTypeMemPtr BOT = make((byte)3, SONTypeStruct.BOT);
47+
public static final SONTypeMemPtr TOP = BOT.dual();
48+
public static final SONTypeMemPtr NOTBOT = make((byte)2, SONTypeStruct.BOT);
4949

5050
//public static SONTypeMemPtr TEST= make((byte)2, SONTypeStruct.TEST);
5151
public static void gather(ArrayList<SONType> ts) { ts.add(NOTBOT); ts.add(BOT); /* ts.add(TEST); */ }
@@ -79,7 +79,7 @@ public SONTypeNil xmeet(SONType t) {
7979
// Is forward-reference
8080
@Override public boolean isFRef() { return _obj.isFRef(); }
8181

82-
@Override public int log_size() { return 2; } // (1<<2)==4-byte pointers
82+
@Override public int log_size() { return 3; } // (1<<3)==8-byte pointers
8383

8484
@Override int hash() { return _obj.hashCode() ^ super.hash(); }
8585

seaofnodes/src/main/java/com/compilerprogramming/ezlang/compiler/sontypes/SONTypeStruct.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,12 @@ int hash() {
192192

193193
@Override
194194
public SB print(SB sb) {
195+
if( _fields == null ) return sb.p(_name); // Forward reference struct, just print the name
196+
if( isAry() ) {
197+
if( !isFinal() ) sb.p("!");
198+
return sb.p(_name); // Skip printing generic array fields
199+
}
195200
sb.p(_name);
196-
if( _fields == null ) return sb; // Forward reference struct, just print the name
197-
if( isAry() ) return sb; // Skip printing generic array fields
198201
sb.p(" {");
199202
for( Field f : _fields )
200203
f._type.print(sb).p(f._final ? " " : " !").p(f._fname).p("; ");

0 commit comments

Comments
 (0)