summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-12-04 18:16:46 -0800
committerCliff Click <cliffc@acm.org>2026-12-04 18:16:46 -0800
commitb5cbc2d6e37b087b0addbdea780fc35291e12ec4 (patch)
tree623b181af781996f4e7605a65cf17c8a7815959a
parent3ee976d77d3d500320215c98e046321fac5ad50b (diff)
downloadSimple-b5cbc2d6e37b087b0addbdea780fc35291e12ec4.tar.gz
Simple-b5cbc2d6e37b087b0addbdea780fc35291e12ec4.zip
Keep unresolved field offsets integer typed
An unknown layout offset is still an integer, even before its receiver type resolves. Update the existing inline-body regression and spill baseline; add native execution coverage for forward field accesses. Full make -k -j8 tests passes.
-rw-r--r--chapter33/src/main/java/com/seaofnodes/simple/node/FldOffNode.java2
-rw-r--r--chapter33/src/test/java/com/seaofnodes/simple/CallEndTest.java2
-rw-r--r--chapter33/src/test/java/com/seaofnodes/simple/Chapter23Test.java5
3 files changed, 5 insertions, 4 deletions
diff --git a/chapter33/src/main/java/com/seaofnodes/simple/node/FldOffNode.java b/chapter33/src/main/java/com/seaofnodes/simple/node/FldOffNode.java
index e49162f4..93f2baf9 100644
--- a/chapter33/src/main/java/com/seaofnodes/simple/node/FldOffNode.java
+++ b/chapter33/src/main/java/com/seaofnodes/simple/node/FldOffNode.java
@@ -31,7 +31,7 @@ public class FldOffNode extends TypeNode {
}
@Override public Type compute() {
- return Type.BOTTOM;
+ return TypeInteger.BOT;
}
@Override public Node idealize() {
diff --git a/chapter33/src/test/java/com/seaofnodes/simple/CallEndTest.java b/chapter33/src/test/java/com/seaofnodes/simple/CallEndTest.java
index 7983141d..26e479b2 100644
--- a/chapter33/src/test/java/com/seaofnodes/simple/CallEndTest.java
+++ b/chapter33/src/test/java/com/seaofnodes/simple/CallEndTest.java
@@ -78,7 +78,7 @@ public class CallEndTest {
// with its data parameter, not share it with the old body.
FldOffNode off = new FldOffNode(fun.parm(3),"<<",null).init();
fun.ret().setDef(2,off);
- assertSame(Type.BOTTOM,off._type);
+ assertSame(TypeInteger.BOT,off._type);
assertTrue("Unresolved field offset belongs to the function",fun.body().get(off._nid));
return;
}
diff --git a/chapter33/src/test/java/com/seaofnodes/simple/Chapter23Test.java b/chapter33/src/test/java/com/seaofnodes/simple/Chapter23Test.java
index 8667c0bd..8fb781f9 100644
--- a/chapter33/src/test/java/com/seaofnodes/simple/Chapter23Test.java
+++ b/chapter33/src/test/java/com/seaofnodes/simple/Chapter23Test.java
@@ -252,7 +252,7 @@ return (a && sq_noInline(0))
@Test
- public void testFRefFields() {
+ public void testFRefFields() throws IOException {
String src = """
// A hypothetical scanner class
struct _Scan {
@@ -279,7 +279,8 @@ return _s.peek('q');
CodeGen code = new CodeGen(src).driver(CodeGen.Phase.TypeCheck);
assertEquals("return Phi(Region,0,1);", code.print());
assertEquals("1", Eval2.eval(code, 0));
- testCPU(src,"x86_64_v2", "win64",23,null);
+ testCPU(src,"x86_64_v2", "win64",31,null);
+ TestC.runSF(src.replace("return _s.peek('q');","return _s.peek('q') != 1;"),"frefFields","",-1);
};
@Test