diff options
| author | Cliff Click <cliffc@acm.org> | 2026-12-04 14:49:25 -0800 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-12-04 14:49:25 -0800 |
| commit | 29db300e59821b0b9c1abf478aade5f6d36bf408 (patch) | |
| tree | b0755539a502b4c94fc80bac3648067d115bbb7a /chapter33/src/main | |
| parent | d9df5cddeaa20045f1194a4b250041cf88bb8845 (diff) | |
| download | Simple-29db300e59821b0b9c1abf478aade5f6d36bf408.tar.gz Simple-29db300e59821b0b9c1abf478aade5f6d36bf408.zip | |
Start constructor private-memory defaults without escapes
Use the same defaultArg rule for parsed functions and imported summaries, while preserving broad signature bounds and actual call memory. Add source and separately compiled constructor regressions. Full make -k -j8 tests passes.
Diffstat (limited to 'chapter33/src/main')
| -rw-r--r-- | chapter33/src/main/java/com/seaofnodes/simple/codegen/FunctionSummary.java | 2 | ||||
| -rw-r--r-- | chapter33/src/main/java/com/seaofnodes/simple/node/FunNode.java | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/chapter33/src/main/java/com/seaofnodes/simple/codegen/FunctionSummary.java b/chapter33/src/main/java/com/seaofnodes/simple/codegen/FunctionSummary.java index 18bd98e3..37baf926 100644 --- a/chapter33/src/main/java/com/seaofnodes/simple/codegen/FunctionSummary.java +++ b/chapter33/src/main/java/com/seaofnodes/simple/codegen/FunctionSummary.java @@ -15,7 +15,7 @@ record FunctionSummary(TypeFunPtr sig, TypeTuple state, String name, int size, i ParmNode mem = new ParmNode("$mem",1,TypeMem.BOT,fun,cu._start.proj(1)).init(); body.addDef(mem); for( int i = 0; i<sig.nargs(); i++ ) - body.addDef(new ParmNode("arg"+i,i+2,sig.arg(i),fun,code.con(sig.arg(i))).init()); + body.addDef(new ParmNode("arg"+i,i+2,sig.arg(i),fun,code.con(fun.defaultArg(i))).init()); body.init(); Node ctrl = new CProjNode(body,0,"ctrl").init(); Node memory = new ProjNode(body,1,"mem").init(); diff --git a/chapter33/src/main/java/com/seaofnodes/simple/node/FunNode.java b/chapter33/src/main/java/com/seaofnodes/simple/node/FunNode.java index 8b6b347e..896dff05 100644 --- a/chapter33/src/main/java/com/seaofnodes/simple/node/FunNode.java +++ b/chapter33/src/main/java/com/seaofnodes/simple/node/FunNode.java @@ -102,6 +102,10 @@ public class FunNode extends RegionNode { // uniform call syntax, including callbacks forwarded by another class. public Type defaultArg(int idx) { Type t = sig().arg(idx); + // Private construction memory starts without published identities. + // Keep the signature broad: real calls supply their actual memory. + if( t instanceof TypeMem mem && mem._one ) + return mem.makeFrom(TypeSet.EMPTY,TypeSet.EMPTY); if( t instanceof TypeMemPtr ptr && ptr._partial && !(idx==0 && sig().nargs()>1 && sig().arg(1) instanceof TypeMem) ) return ptr.partialBound(); if( idx!=0 || t!=TypePtr.PTR ) return t; |
