From b5cbc2d6e37b087b0addbdea780fc35291e12ec4 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Fri, 4 Dec 2026 18:16:46 -0800 Subject: 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. --- chapter33/src/main/java/com/seaofnodes/simple/node/FldOffNode.java | 2 +- chapter33/src/test/java/com/seaofnodes/simple/CallEndTest.java | 2 +- chapter33/src/test/java/com/seaofnodes/simple/Chapter23Test.java | 5 +++-- 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 -- cgit v1.2.3