diff options
Diffstat (limited to 'chapter33/docs')
| -rw-r--r-- | chapter33/docs/33-grammar.md | 10 | ||||
| -rw-r--r-- | chapter33/docs/AllocationSurvey.java | 138 | ||||
| -rw-r--r-- | chapter33/docs/ArrayDeleteSurvey.java | 107 | ||||
| -rw-r--r-- | chapter33/docs/allocation-survey-functions.tsv | 262 | ||||
| -rw-r--r-- | chapter33/docs/allocation-survey.md | 256 | ||||
| -rw-r--r-- | chapter33/docs/array-delete-survey.md | 141 | ||||
| -rw-r--r-- | chapter33/docs/growing-array-rewrites.md | 259 | ||||
| -rw-r--r-- | chapter33/docs/growing-arrays-survey.md | 230 | ||||
| -rw-r--r-- | chapter33/docs/ownership-analysis-architecture-review.md | 79 |
9 files changed, 1478 insertions, 4 deletions
diff --git a/chapter33/docs/33-grammar.md b/chapter33/docs/33-grammar.md index 7e9ef8cd..a336d2f5 100644 --- a/chapter33/docs/33-grammar.md +++ b/chapter33/docs/33-grammar.md @@ -85,14 +85,16 @@ bindingModifier : '!' | '~' ; initializer : assignment ; // The prefix qualifies the named struct reference, not an enclosing array. -// Each [] / [~] suffix qualifies its own array layer. ? requires a reference. +// Each [] / [~] / [^] suffix qualifies its own array layer. ? requires a reference. type : functionType | primitiveType typeSuffix* | accessModifier? typeName typeSuffix* ; accessModifier : '!' | '~' ; -typeSuffix : '?' | '[]' | '[~]' ; +typeSuffix : '?' | '[]' | '[~]' | '[^]' ; +// [^] permits checked .del(); it is not a promise of uniqueness. +// .del() uses ordinary member/call syntax. Runtime recycling is not implemented. typeName : IDENTIFIER ('.' IDENTIFIER)* ; primitiveType @@ -187,9 +189,9 @@ argumentList : assignment (',' assignment)* ','? ; // Allocation invokes the declared constructor; inline initializer blocks from // earlier chapters are replaced by constructor arguments. newExpression - : 'new' type ('[' '~'? assignment ']' arrayInitializer? | arrayInitializer | callSuffix)? + : 'new' type ('[' ('~' | '^')? assignment ']' arrayInitializer? | arrayInitializer | callSuffix)? ; -// With no explicit length, type must end in [] or [~] and the initializer is a list. +// With no explicit length, type ends in [], [~], or [^]; the initializer is a list. arrayInitializer : '{' (assignment (',' assignment)* ','?)? '}' | '{' ('int' | 'i32' | 'i64' | 'u32') IDENTIFIER '->' statement* '}' diff --git a/chapter33/docs/AllocationSurvey.java b/chapter33/docs/AllocationSurvey.java new file mode 100644 index 00000000..108cbfb3 --- /dev/null +++ b/chapter33/docs/AllocationSurvey.java @@ -0,0 +1,138 @@ +import com.seaofnodes.simple.codegen.*; +import com.seaofnodes.simple.node.*; +import com.seaofnodes.simple.type.*; +import com.seaofnodes.simple.util.Ary; +import java.nio.file.*; +import java.lang.reflect.Field; +import java.util.*; + +// Standalone survey, not a test or a compiler option. Run from chapter33. +public class AllocationSurvey { + static Object field(Object object, String name) throws Exception { + Field f=object.getClass().getDeclaredField(name); + f.setAccessible(true); + return f.get(object); + } + static String clean(Object s) { return s==null ? "" : s.toString().replace('\t',' ').replace('\n',' '); } + static String category(String reason) { + if( reason==null ) return "supported"; + if( reason.contains("opaque body") ) return "opaque body"; + if( reason.contains("opaque or indirect") ) return "indirect call"; + if( reason.contains("recursive call") ) return "recursion"; + if( reason.contains("raw address") ) return "raw address"; + if( reason.contains("variable-size") ) return "variable size"; + if( reason.contains("across its backedge") ) return "loop retention"; + if( reason.contains("cyclic field-path") ) return "field paths"; + if( reason.contains("reference origin") ) return "reference origin"; + if( reason.contains("native result storage") ) return "native result"; + return "other"; + } + static String probe(String name) { + return switch(name) { + case "LocalArray" -> """ + val work_noInline={ u32 n -> + val xs=new i64[n]; + for( u32 i=0; i<n; i++ ) xs[i]=i; + return n ? xs[n-1] : 0; + }; + u32 len=arg; + return work_noInline(len); + """; + case "ReturnedArray" -> """ + val make_noInline={ u32 n -> new i64[n]; }; + u32 len=arg; + return make_noInline(len)#; + """; + case "OverwrittenSlot" -> """ + struct Thing { i64 !x; new Thing={i64 n -> x=n;}; }; + struct Holder { Thing? !c=null; }; + val work_noInline={i64 n -> + val h=new Holder; + while(n>0) { h.c=new Thing(n); n--; } + return h.c ? h.c.x : 0; + }; + return work_noInline(arg); + """; + case "ReusedObject" -> """ + struct Thing { i64 !x; new Thing={i64 n -> x=n;}; }; + val read_noInline={Thing t -> t.x;}; + val work_noInline={i64 n -> + val t=new Thing(0); + i64 sum=0; + while(n>0) { t.x=n; sum+=read_noInline(t); n--; } + return sum; + }; + return work_noInline(arg); + """; + default -> throw new IllegalArgumentException(name); + }; + } + @SuppressWarnings("unchecked") + public static void main(String[] args) throws Exception { + String name=args[0], mode=args.length>1 ? args[1] : "source"; + Path out=Path.of("build/allocation-survey",name+"-"+mode); + Files.createDirectories(out); + for( String file : new String[]{"error.txt","dump.txt","functions.tsv","sites.tsv","allocations.tsv","calls.tsv"} ) + Files.deleteIfExists(out.resolve(file)); + String src=mode.equals("probe") ? probe(name) : name.equals("sys") ? null : + name.equals("RuntimeArgs") ? Files.readString(Path.of("src/main/smp/sys/rt/simple_args.smp")) : + Files.readString(Path.of("docs/examples",name+".smp")); + if( src!=null && !name.equals("RuntimeArgs") && mode.equals("source") ) src="val _survey_sys=sys;\n"+src; + String root=mode.equals("source") ? "src/main/smp" : "docs/examples"; + Ary<String> libs=mode.equals("object") ? new Ary<>(new String[]{"build/release/x86_64_v2_win64"}) : null; + CodeGen code=new CodeGen(root,out.resolve("objects").toString(),libs,name,src,456,true,TypeInteger.BOT); + long start=System.nanoTime(); + try { code.driver(CodeGen.Phase.TypeCheck); } + catch(Throwable t) { + StringBuilder error=new StringBuilder(t.toString()+"\nphase="+code._phase+"\n"); + if( t instanceof com.seaofnodes.simple.parser.Parser.ParseException p ) error.append(p.diagnostic()).append('\n'); + for( StackTraceElement frame : t.getStackTrace() ) error.append(frame).append('\n'); + Files.writeString(out.resolve("error.txt"),error); + System.out.println(name+" "+mode+" ERROR "+t); + return; + } + Allocation.Summary[] summaries=(Allocation.Summary[])field(code._allocation,"_summaries"); + Files.writeString(out.resolve("dump.txt"),code._allocation.toString()); + StringBuilder rows=new StringBuilder("program\tmode\tunit\tfunction\tid\tstatus\tcategory\troot_function\troot_id\troot_unit\tnew_user\tnew_class\tvariable\tplaced_user\tplaced_class\tloops\treason\n"); + StringBuilder sites=new StringBuilder("program\tmode\tunit\tfunction\tsite\ttype\tbytes\tdestination\n"); + StringBuilder nodes=new StringBuilder("program\tmode\tunit\tfunction\tnode\tsize\ttype\n"); + StringBuilder calls=new StringBuilder("program\tmode\tunit\tfunction\tnode\ttarget\tsignature\n"); + int total=0,pass=0,allocated=0; + for( Allocation.Summary sum : summaries ) { + if( sum==null ) continue; + FunNode fun=sum._fun; + String unit=fun._compunit==null ? "" : fun._compunit._cname; + Allocation.Summary cause=sum; + HashSet<Allocation.Summary> seen=new HashSet<>(); + while( cause._reject!=null && cause._reject.startsWith("call #") && seen.add(cause) ) { + int id=Integer.parseInt(cause._reject.substring(6,cause._reject.indexOf(' ',6))); + Allocation.Summary next=null; + for( CallNode call : (ArrayList<CallNode>)field(cause,"_calls") ) + if( call._nid==id && call.fptr()._type instanceof TypeFunPtr fp && fp.isConstant() ) next=summaries[fp.fidx()]; + if( next==null ) break; + cause=next; + } + int local=0,clz=0,variable=0,placed=0,placedClz=0; + for( CallNode call : (ArrayList<CallNode>)field(sum,"_calls") ) + calls.append(name).append('\t').append(mode).append('\t').append(clean(unit)).append('\t').append(clean(fun._name)).append('\t').append(call._nid).append('\t').append(clean(call.name())).append('\t').append(clean(call.fptr()._type)).append('\n'); + for( Node n : (ArrayList<Node>)field(sum,"_nodes") ) if( n instanceof NewNode a ) { + if( TypeStruct.startsClzPrefix(a._ts._name) ) clz++; else local++; + if( !(a.size()._type instanceof TypeInteger sz) || !sz.isConstant() ) variable++; + nodes.append(name).append('\t').append(mode).append('\t').append(clean(unit)).append('\t').append(clean(fun._name)).append('\t').append(a._nid).append('\t').append(clean(a.size()._type)).append('\t').append(clean(a._ts._name)).append('\n'); + } + if( sum.supported() ) for( Allocation.Site site : sum._sites ) if( site._allocation!=null ) { + if( TypeStruct.startsClzPrefix(site._allocation._ts._name) ) placedClz++; else placed++; + sites.append(name).append('\t').append(mode).append('\t').append(clean(unit)).append('\t').append(clean(fun._name)).append('\t').append(clean(site._name)).append('\t').append(clean(site._allocation._ts._name)).append('\t').append(site._bytes).append('\t').append(clean(site.destination())).append('\n'); + } + String status=sum.supported() ? "pass" : sum._reject.startsWith("call #") ? "blocked" : "direct"; + rows.append(name).append('\t').append(mode).append('\t').append(clean(unit)).append('\t').append(clean(fun._name)).append('\t').append(fun.sig().fidx()).append('\t').append(status).append('\t').append(category(cause._reject)).append('\t').append(clean(cause._fun._name)).append('\t').append(cause._fun.sig().fidx()).append('\t').append(clean(cause._fun._compunit==null ? null : cause._fun._compunit._cname)).append('\t').append(local).append('\t').append(clz).append('\t').append(variable).append('\t').append(placed).append('\t').append(placedClz).append('\t').append(((IdentityHashMap<?,?>)field(sum,"_loops")).size()).append('\t').append(clean(sum._reject)).append('\n'); + total++; + if( sum.supported() ) { pass++; if( placed>0 ) allocated++; } + } + Files.writeString(out.resolve("functions.tsv"),rows); + Files.writeString(out.resolve("sites.tsv"),sites); + Files.writeString(out.resolve("allocations.tsv"),nodes); + Files.writeString(out.resolve("calls.tsv"),calls); + System.out.println(name+" "+mode+": "+pass+"/"+total+" pass, "+allocated+" with user allocations; "+((System.nanoTime()-start)/1000000)+" ms"); + } +} diff --git a/chapter33/docs/ArrayDeleteSurvey.java b/chapter33/docs/ArrayDeleteSurvey.java new file mode 100644 index 00000000..7e549048 --- /dev/null +++ b/chapter33/docs/ArrayDeleteSurvey.java @@ -0,0 +1,107 @@ +import com.seaofnodes.simple.codegen.*; +import com.seaofnodes.simple.parser.Parser; +import com.seaofnodes.simple.type.TypeInteger; +import com.seaofnodes.simple.util.SB; +import java.nio.file.*; +import java.util.ArrayDeque; + +/** Compile-only source migrations. Originals are never changed. Run from chapter33. */ +public class ArrayDeleteSurvey { + private static String change(String src, String from, String to) { + if( !src.contains(from) ) throw new IllegalArgumentException("Survey source changed: "+from); + return src.replace(from,to); + } + + private static String migrate(String name, String src) { + switch(name) { + case "aryu8": + src=change(src,"u8[] !buf;","u8[^] !buf;"); + src=change(src,"new u8[1]","new u8[^1]"); + src=change(src,"u8[] !buf2 = new u8[newlen];","val old = buf;\n u8[^] !buf2 = new u8[^newlen];"); + return change(src,"buf = buf2;","buf = buf2;\n old.del();"); + case "aryi64": + src=change(src,"i64[] !buf;","i64[^] !buf;"); + src=change(src,"i64[] b ->","i64[^] b ->"); + src=change(src,"new i64[","new i64[^"); + src=change(src,"i64[] !buf2 =","val old = buf;\n i64[^] !buf2 ="); + return change(src,"buf = buf2;","buf = buf2;\n old.del();"); + case "bitset": + src=change(src,"i64[] !_bits;","i64[^] !_bits;"); + src=change(src,"new i64[","new i64[^"); + src=change(src,"var bits =","val old = _bits;\n var bits ="); + return change(src,"_bits = bits;","_bits = bits;\n old.del();"); + case "Timers": + src=change(src,"u32[]","u32[^]"); + src=change(src,"i64[]","i64[^]"); + src=change(src,"new u32[","new u32[^"); + src=change(src,"new i64[","new i64[^"); + src=change(src,"val ids =","val oldIds = _ids, oldDue = _due_ms, oldPeriod = _period_ms;\n val ids ="); + return change(src,"_period_ms = periods_ms;","_period_ms = periods_ms;\n oldIds.del(); oldDue.del(); oldPeriod.del();"); + case "Canvas": + src=change(src,"u32[] !pixels;","u32[^] !pixels;"); + src=change(src,"new u32[","new u32[^"); + return change(src,"pixels = new u32[^capacity];", + "val old = pixels;\n pixels = new u32[^capacity];\n old.del();"); + default: throw new IllegalArgumentException(name); + } + } + + private static void copyTree(Path src, Path dst) throws Exception { + ArrayDeque<Path> work=new ArrayDeque<>(); + work.push(src); + while( !work.isEmpty() ) { + Path path=work.pop(), target=dst.resolve(src.relativize(path)); + if( Files.isDirectory(path) ) { + Files.createDirectories(target); + try( DirectoryStream<Path> children=Files.newDirectoryStream(path) ) { + for( Path child : children ) work.push(child); + } + } else Files.copy(path,target); + } + } + + private static String clean(String s) { return s.replace('\t',' ').replace('\n',' ').replace('\r',' '); } + + public static void main(String[] args) throws Exception { + Path build=Path.of("build/array-delete-survey"); + Files.createDirectories(build); + Path run=Files.createTempDirectory(build,"run-"); + SB report=new SB().p("case\tfunction\tstatus\tdetail\n"); + String[] names={"aryu8","aryi64","bitset","Timers","Canvas"}; + String[] files={"sys/aryu8.smp","sys/aryi64.smp","sys/adt/bitset.smp","sys/time/Timers.smp","sys/draw/Canvas.smp"}; + for( int i=0; i<names.length; i++ ) { + String name=names[i]; + Path out=run.resolve(name), src=out.resolve("src"); + copyTree(Path.of("src/main/smp"),src); + Path file=src.resolve(files[i]); + Files.writeString(file,migrate(name,Files.readString(file))); + CodeGen code=new CodeGen(src.toString(),out.resolve("objects").toString(),null,"sys",null,456,true,TypeInteger.BOT); + try { + code.driver(CodeGen.Phase.Allocation); + if( Boolean.getBoolean("simple.delete.graph") ) { + Files.writeString(out.resolve("graph.txt"),code.toString()); + Files.writeString(out.resolve("allocation.txt"),code._allocation.toString()); + } + for( ArrayDelete deletion : code._allocation._deletes ) { + String status=deletion._reject!=null ? "REJECT" : deletion._unique!=null ? "NEEDS UNIQUE ENTRY" : "PASS"; + report.p(name).p('\t').p(deletion._call.fun()._name).p('\t').p(status).p('\t').p(clean(deletion.toString())).p('\n'); + } + if( code._allocation._deletes.isEmpty() ) throw new IllegalStateException("No deletion sites found"); + code.driver(CodeGen.Phase.TypeCheck); + System.out.println(name+": TypeCheck PASS"); + } catch( Parser.ParseException e ) { + Files.writeString(out.resolve("rejection.txt"),e.diagnostic()); + report.p(name).p("\t<TypeCheck>\tREJECT\t").p(clean(e.getMessage())).p('\n'); + System.out.println(name+": REJECT at "+code._phase+": "+e.getMessage()); + } catch( Throwable e ) { + SB stack=new SB().p(e.toString()).p('\n'); + for( StackTraceElement frame : e.getStackTrace() ) stack.p(frame.toString()).p('\n'); + Files.writeString(out.resolve("crash.txt"),stack.toString()); + report.p(name).p("\t<compiler>\tCRASH\t").p(clean(e.toString())).p('\n'); + System.out.println(name+": CRASH at "+code._phase+": "+e); + } + } + Files.writeString(run.resolve("results.tsv"),report.toString()); + System.out.println("Results: "+run.resolve("results.tsv")); + } +} diff --git a/chapter33/docs/allocation-survey-functions.tsv b/chapter33/docs/allocation-survey-functions.tsv new file mode 100644 index 00000000..80f22547 --- /dev/null +++ b/chapter33/docs/allocation-survey-functions.tsv @@ -0,0 +1,262 @@ +"program" "mode" "unit" "function" "id" "status" "category" "root_function" "root_id" "root_unit" "new_user" "new_class" "variable" "placed_user" "placed_class" "loops" "reason" +"sys" "source" "sys" "class:sys.<clinit>" "2" "pass" "supported" "class:sys.<clinit>" "2" "sys" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.adt" "class:sys.adt.<clinit>" "3" "pass" "supported" "class:sys.adt.<clinit>" "3" "sys.adt" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.audio" "class:sys.audio.<clinit>" "4" "pass" "supported" "class:sys.audio.<clinit>" "4" "sys.audio" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.audio" "sys.audio.open" "11" "direct" "indirect call" "sys.audio.open" "11" "sys.audio" "0" "0" "0" "0" "0" "0" "opaque or indirect call #257" +"sys" "source" "sys.audio" "sys.audio.load" "12" "direct" "raw address" "sys.audio.load" "12" "sys.audio" "0" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #274" +"sys" "source" "sys.audio" "sys.audio.play" "13" "direct" "indirect call" "sys.audio.play" "13" "sys.audio" "0" "0" "0" "0" "0" "0" "opaque or indirect call #321" +"sys" "source" "sys.audio" "sys.audio.boop" "14" "direct" "indirect call" "sys.audio.boop" "14" "sys.audio" "0" "0" "0" "0" "0" "0" "opaque or indirect call #361" +"sys" "source" "sys.audio" "sys.audio.win" "15" "direct" "indirect call" "sys.audio.win" "15" "sys.audio" "0" "0" "0" "0" "0" "0" "opaque or indirect call #401" +"sys" "source" "sys.audio" "sys.audio.lose" "16" "direct" "indirect call" "sys.audio.lose" "16" "sys.audio" "0" "0" "0" "0" "0" "0" "opaque or indirect call #441" +"sys" "source" "sys.audio" "sys.audio.stop" "17" "direct" "indirect call" "sys.audio.stop" "17" "sys.audio" "0" "0" "0" "0" "0" "0" "opaque or indirect call #468" +"sys" "source" "sys.audio" "sys.audio.playing" "18" "direct" "indirect call" "sys.audio.playing" "18" "sys.audio" "0" "0" "0" "0" "0" "0" "opaque or indirect call #495" +"sys" "source" "sys.audio" "sys.audio.close" "19" "direct" "indirect call" "sys.audio.close" "19" "sys.audio" "0" "0" "0" "0" "0" "0" "opaque or indirect call #522" +"sys" "source" "sys.ary" "class:sys.ary.<clinit>" "20" "pass" "supported" "class:sys.ary.<clinit>" "20" "sys.ary" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.ary" "sys.ary.capacity" "21" "pass" "supported" "sys.ary.capacity" "21" "sys.ary" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.ary" "sys.ary.copy" "22" "pass" "supported" "sys.ary.copy" "22" "sys.ary" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.ary" "sys.ary.cmp" "23" "pass" "supported" "sys.ary.cmp" "23" "sys.ary" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.aryi64" "class:sys.aryi64.<clinit>" "24" "pass" "supported" "class:sys.aryi64.<clinit>" "24" "sys.aryi64" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.aryi64" "sys.aryi64.<init>" "25" "pass" "supported" "sys.aryi64.<init>" "25" "sys.aryi64" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.aryi64" "sys.aryi64._grow" "26" "direct" "indirect call" "sys.aryi64._grow" "26" "sys.aryi64" "1" "0" "1" "0" "0" "1" "opaque or indirect call #1392" +"sys" "source" "sys.aryi64" "sys.aryi64.add" "27" "blocked" "indirect call" "sys.aryi64._grow" "26" "sys.aryi64" "0" "0" "0" "0" "0" "0" "call #1495 -> sys.aryi64._grow: opaque or indirect call #1392" +"sys" "source" "sys.aryi64" "sys.aryi64.get" "28" "pass" "supported" "sys.aryi64.get" "28" "sys.aryi64" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.aryi64" "sys.aryi64.str" "29" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "2" "0" "0" "0" "0" "1" "call #27695 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.aryi64" "sys.aryi64.swap" "30" "pass" "supported" "sys.aryi64.swap" "30" "sys.aryi64" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.aryi64" "sys.aryi64.<new>" "32" "pass" "supported" "sys.aryi64.<new>" "32" "sys.aryi64" "1" "0" "0" "1" "0" "0" "" +"sys" "source" "sys.aryi64" "sys.aryi64.parseAryI64" "33" "blocked" "indirect call" "sys.aryi64._grow" "26" "sys.aryi64" "3" "0" "0" "0" "0" "6" "call #27372 -> sys.aryi64._grow: opaque or indirect call #1392" +"sys" "source" "sys.aryi64" "sys.aryi64.copy" "34" "pass" "supported" "sys.aryi64.copy" "34" "sys.aryi64" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.aryu8" "class:sys.aryu8.<clinit>" "35" "pass" "supported" "class:sys.aryu8.<clinit>" "35" "sys.aryu8" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.aryu8" "sys.aryu8.<init>" "36" "pass" "supported" "sys.aryu8.<init>" "36" "sys.aryu8" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.aryu8" "sys.aryu8._grow" "37" "direct" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "1" "0" "1" "0" "0" "0" "opaque or indirect call #2466" +"sys" "source" "sys.aryu8" "sys.aryu8.clear" "38" "pass" "supported" "sys.aryu8.clear" "38" "sys.aryu8" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.aryu8" "sys.aryu8.add" "39" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "0" "0" "0" "0" "0" "0" "call #2559 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.aryu8" "sys.aryu8.addAry" "40" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "0" "0" "0" "0" "0" "0" "call #2607 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.aryu8" "sys.aryu8.undo" "41" "pass" "supported" "sys.aryu8.undo" "41" "sys.aryu8" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.aryu8" "sys.aryu8.num" "42" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "0" "0" "0" "0" "0" "0" "call #2705 -> sys.text.integer: call #5950 -> sys.text.string: call #23308 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.aryu8" "sys.aryu8.write" "43" "blocked" "raw address" "sys.io.writeOff" "68" "sys.io" "0" "0" "0" "0" "0" "0" "call #2738 -> sys.io.writeOff: raw address escapes lifetime tracking #4102" +"sys" "source" "sys.aryu8" "sys.aryu8.<new>" "45" "pass" "supported" "sys.aryu8.<new>" "45" "sys.aryu8" "2" "0" "0" "2" "0" "0" "" +"sys" "source" "sys.aryu8" "sys.aryu8.atoi" "46" "pass" "supported" "sys.aryu8.atoi" "46" "sys.aryu8" "0" "0" "0" "0" "0" "2" "" +"sys" "source" "sys.aryu8" "sys.aryu8.str0" "47" "direct" "indirect call" "sys.aryu8.str0" "47" "sys.aryu8" "1" "0" "1" "0" "0" "1" "opaque or indirect call #3085" +"sys" "source" "sys.char" "class:sys.char.<clinit>" "48" "pass" "supported" "class:sys.char.<clinit>" "48" "sys.char" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.char" "sys.char.toupper" "49" "pass" "supported" "sys.char.toupper" "49" "sys.char" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.char" "sys.char.tolower" "50" "pass" "supported" "sys.char.tolower" "50" "sys.char" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.integer" "class:sys.integer.<clinit>" "51" "pass" "supported" "class:sys.integer.<clinit>" "51" "sys.integer" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.math" "class:sys.math.<clinit>" "52" "pass" "supported" "class:sys.math.<clinit>" "52" "sys.math" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.math" "sys.math.max" "60" "pass" "supported" "sys.math.max" "60" "sys.math" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.math" "sys.math.min" "61" "pass" "supported" "sys.math.min" "61" "sys.math" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.io" "class:sys.io.<clinit>" "62" "pass" "supported" "class:sys.io.<clinit>" "62" "sys.io" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.io" "sys.io.p" "63" "blocked" "raw address" "sys.io.writeOff" "68" "sys.io" "0" "0" "0" "0" "0" "0" "call #24576 -> sys.io.writeOff: raw address escapes lifetime tracking #4102" +"sys" "source" "sys.io" "sys.io.p_noInline" "64" "blocked" "raw address" "sys.io.writeOff" "68" "sys.io" "0" "0" "0" "0" "0" "0" "call #23093 -> sys.io.writeOff: raw address escapes lifetime tracking #4102" +"sys" "source" "sys.io" "sys.io.err" "65" "blocked" "raw address" "sys.io.writeOff" "68" "sys.io" "0" "0" "0" "0" "0" "0" "call #27466 -> sys.io.writeOff: raw address escapes lifetime tracking #4102" +"sys" "source" "sys.io" "sys.io.read" "66" "direct" "raw address" "sys.io.read" "66" "sys.io" "4" "0" "1" "0" "0" "1" "raw address escapes lifetime tracking #3695" +"sys" "source" "sys.io" "sys.io.write" "67" "blocked" "raw address" "sys.io.writeOff" "68" "sys.io" "0" "0" "0" "0" "0" "0" "call #4008 -> sys.io.writeOff: raw address escapes lifetime tracking #4102" +"sys" "source" "sys.io" "sys.io.writeOff" "68" "direct" "raw address" "sys.io.writeOff" "68" "sys.io" "0" "0" "0" "0" "0" "1" "raw address escapes lifetime tracking #4102" +"sys" "source" "sys.io" "sys.io.stdin" "69" "blocked" "raw address" "sys.io.read" "66" "sys.io" "0" "0" "0" "0" "0" "0" "call #4301 -> sys.io.read: raw address escapes lifetime tracking #3695" +"sys" "source" "sys.io" "sys.io.getch" "70" "direct" "indirect call" "sys.io.getch" "70" "sys.io" "0" "0" "0" "0" "0" "0" "opaque or indirect call #4326" +"sys" "source" "sys.io" "sys.io.create" "71" "direct" "raw address" "sys.io.create" "71" "sys.io" "0" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #26751" +"sys" "source" "sys.io" "sys.io.open" "72" "direct" "raw address" "sys.io.open" "72" "sys.io" "0" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #25971" +"sys" "source" "sys.io" "sys.io.close" "73" "direct" "indirect call" "sys.io.close" "73" "sys.io" "0" "0" "0" "0" "0" "0" "opaque or indirect call #4495" +"sys" "source" "sys.io" "sys.io.remove" "74" "direct" "raw address" "sys.io.remove" "74" "sys.io" "0" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #26389" +"sys" "source" "sys.gfx" "class:sys.gfx.<clinit>" "75" "pass" "supported" "class:sys.gfx.<clinit>" "75" "sys.gfx" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.gfx" "sys.gfx.open" "88" "direct" "raw address" "sys.gfx.open" "88" "sys.gfx" "0" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #4719" +"sys" "source" "sys.gfx" "sys.gfx.present" "89" "direct" "raw address" "sys.gfx.present" "89" "sys.gfx" "0" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #4751" +"sys" "source" "sys.gfx" "sys.gfx.width" "90" "direct" "indirect call" "sys.gfx.width" "90" "sys.gfx" "0" "0" "0" "0" "0" "0" "opaque or indirect call #4796" +"sys" "source" "sys.gfx" "sys.gfx.height" "91" "direct" "indirect call" "sys.gfx.height" "91" "sys.gfx" "0" "0" "0" "0" "0" "0" "opaque or indirect call #4823" +"sys" "source" "sys.gfx" "sys.gfx.presentSize" "92" "direct" "raw address" "sys.gfx.presentSize" "92" "sys.gfx" "0" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #4990" +"sys" "source" "sys.gfx" "sys.gfx.poll" "93" "direct" "indirect call" "sys.gfx.poll" "93" "sys.gfx" "0" "0" "0" "0" "0" "0" "opaque or indirect call #5042" +"sys" "source" "sys.gfx" "sys.gfx.mouseX" "94" "direct" "indirect call" "sys.gfx.mouseX" "94" "sys.gfx" "0" "0" "0" "0" "0" "0" "opaque or indirect call #5069" +"sys" "source" "sys.gfx" "sys.gfx.mouseY" "95" "direct" "indirect call" "sys.gfx.mouseY" "95" "sys.gfx" "0" "0" "0" "0" "0" "0" "opaque or indirect call #5096" +"sys" "source" "sys.gfx" "sys.gfx.button" "96" "direct" "indirect call" "sys.gfx.button" "96" "sys.gfx" "0" "0" "0" "0" "0" "0" "opaque or indirect call #5125" +"sys" "source" "sys.gfx" "sys.gfx.key" "97" "direct" "indirect call" "sys.gfx.key" "97" "sys.gfx" "0" "0" "0" "0" "0" "0" "opaque or indirect call #5154" +"sys" "source" "sys.gfx" "sys.gfx.close" "98" "direct" "indirect call" "sys.gfx.close" "98" "sys.gfx" "0" "0" "0" "0" "0" "0" "opaque or indirect call #5181" +"sys" "source" "sys.gfx" "sys.gfx.wait" "99" "direct" "indirect call" "sys.gfx.wait" "99" "sys.gfx" "0" "0" "0" "0" "0" "0" "opaque or indirect call #5210" +"sys" "source" "sys.draw" "class:sys.draw.<clinit>" "100" "pass" "supported" "class:sys.draw.<clinit>" "100" "sys.draw" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw" "sys.draw.rgb" "101" "pass" "supported" "sys.draw.rgb" "101" "sys.draw" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.text" "class:sys.text.<clinit>" "102" "pass" "supported" "class:sys.text.<clinit>" "102" "sys.text" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.text" "sys.text.begin" "103" "pass" "supported" "sys.text.begin" "103" "sys.text" "2" "0" "0" "2" "0" "0" "" +"sys" "source" "sys.text" "sys.text.end" "104" "direct" "variable size" "sys.text.end" "104" "sys.text" "1" "0" "1" "0" "0" "1" "variable-size allocation #5612" +"sys" "source" "sys.text" "sys.text._pad" "105" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "0" "0" "0" "0" "0" "1" "call #22342 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.text" "sys.text.string" "106" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "0" "0" "0" "0" "0" "3" "call #23308 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.text" "sys.text.integer" "107" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "1" "0" "0" "0" "0" "8" "call #5950 -> sys.text.string: call #23308 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.text" "sys.text.floating" "109" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "0" "0" "0" "0" "0" "0" "call #23862 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.text" "sys.text.int" "110" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "3" "0" "1" "0" "0" "1" "call #7146 -> sys.text.integer: call #5950 -> sys.text.string: call #23308 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.text" "sys.text.flt" "111" "direct" "indirect call" "sys.text.flt" "111" "sys.text" "3" "0" "1" "0" "0" "1" "opaque or indirect call #23783" +"sys" "source" "sys.text" "sys.text.f32" "112" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "3" "0" "1" "0" "0" "1" "call #24296 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.text" "sys.text.f64" "113" "direct" "indirect call" "sys.text.f64" "113" "sys.text" "3" "0" "1" "0" "0" "1" "opaque or indirect call #22964" +"sys" "source" "sys.text" "sys.text.char" "114" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "3" "0" "1" "0" "0" "1" "call #7450 -> sys.text.integer: call #5950 -> sys.text.string: call #23308 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.text" "sys.text.bool" "115" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "3" "0" "1" "0" "0" "1" "call #7526 -> sys.text.integer: call #5950 -> sys.text.string: call #23308 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.text" "sys.text.hex" "116" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "3" "0" "1" "0" "0" "1" "call #7602 -> sys.text.integer: call #5950 -> sys.text.string: call #23308 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.text" "sys.text.time" "117" "blocked" "raw address" "sys.time.local" "148" "sys.time" "0" "0" "0" "0" "0" "0" "call #27428 -> sys.time._format: call #10394 -> sys.time.local: raw address escapes lifetime tracking #9945" +"sys" "source" "sys.time" "class:sys.time.<clinit>" "118" "pass" "supported" "class:sys.time.<clinit>" "118" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.now" "125" "direct" "indirect call" "sys.time.now" "125" "sys.time" "0" "0" "0" "0" "0" "0" "opaque or indirect call #7965" +"sys" "source" "sys.time" "sys.time.monotonic" "126" "direct" "indirect call" "sys.time.monotonic" "126" "sys.time" "0" "0" "0" "0" "0" "0" "opaque or indirect call #7992" +"sys" "source" "sys.time" "sys.time.nanoTime" "127" "direct" "indirect call" "sys.time.nanoTime" "127" "sys.time" "0" "0" "0" "0" "0" "0" "opaque or indirect call #8019" +"sys" "source" "sys.time" "sys.time.sleep" "128" "direct" "indirect call" "sys.time.sleep" "128" "sys.time" "0" "0" "0" "0" "0" "0" "opaque or indirect call #8049" +"sys" "source" "sys.time" "sys.time.sleepUntil" "129" "direct" "indirect call" "sys.time.sleepUntil" "129" "sys.time" "0" "0" "0" "0" "0" "0" "opaque or indirect call #8079" +"sys" "source" "sys.time" "sys.time._scale" "130" "pass" "supported" "sys.time._scale" "130" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.seconds" "131" "pass" "supported" "sys.time.seconds" "131" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.minutes" "132" "pass" "supported" "sys.time.minutes" "132" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.hours" "133" "pass" "supported" "sys.time.hours" "133" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.days" "134" "pass" "supported" "sys.time.days" "134" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.toSeconds" "135" "pass" "supported" "sys.time.toSeconds" "135" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.toMinutes" "136" "pass" "supported" "sys.time.toMinutes" "136" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.toHours" "137" "pass" "supported" "sys.time.toHours" "137" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.toDays" "138" "pass" "supported" "sys.time.toDays" "138" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.fromNanos" "139" "pass" "supported" "sys.time.fromNanos" "139" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.toNanos" "140" "pass" "supported" "sys.time.toNanos" "140" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.remaining" "141" "pass" "supported" "sys.time.remaining" "141" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.leap" "142" "pass" "supported" "sys.time.leap" "142" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.monthDays" "143" "pass" "supported" "sys.time.monthDays" "143" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time._days" "144" "pass" "supported" "sys.time._days" "144" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.valid" "145" "pass" "supported" "sys.time.valid" "145" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.makeUTC" "146" "pass" "supported" "sys.time.makeUTC" "146" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.utc" "147" "pass" "supported" "sys.time.utc" "147" "sys.time" "1" "0" "0" "1" "0" "0" "" +"sys" "source" "sys.time" "sys.time.local" "148" "direct" "raw address" "sys.time.local" "148" "sys.time" "2" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #9945" +"sys" "source" "sys.time" "sys.time.zoneName" "149" "direct" "raw address" "sys.time.zoneName" "149" "sys.time" "4" "0" "1" "0" "0" "2" "raw address escapes lifetime tracking #10204" +"sys" "source" "sys.time" "sys.time._digits" "150" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "0" "0" "0" "0" "0" "0" "call #10353 -> sys.text.integer: call #5950 -> sys.text.string: call #23308 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.time" "sys.time._format" "151" "blocked" "raw address" "sys.time.local" "148" "sys.time" "3" "0" "1" "0" "0" "1" "call #10394 -> sys.time.local: raw address escapes lifetime tracking #9945" +"sys" "source" "sys.time" "sys.time.elapsed" "152" "blocked" "indirect call" "sys.aryu8._grow" "37" "sys.aryu8" "3" "0" "1" "0" "0" "1" "call #22941 -> sys.text.integer: call #5950 -> sys.text.string: call #23308 -> sys.aryu8._grow: opaque or indirect call #2466" +"sys" "source" "sys.time" "sys.time.format" "153" "blocked" "raw address" "sys.time.local" "148" "sys.time" "0" "0" "0" "0" "0" "0" "call #11574 -> sys.time._format: call #10394 -> sys.time.local: raw address escapes lifetime tracking #9945" +"sys" "source" "sys.time" "sys.time.formatLocal" "154" "blocked" "raw address" "sys.time.local" "148" "sys.time" "0" "0" "0" "0" "0" "0" "call #11663 -> sys.time._format: call #10394 -> sys.time.local: raw address escapes lifetime tracking #9945" +"sys" "source" "sys.time" "sys.time._number" "155" "pass" "supported" "sys.time._number" "155" "sys.time" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.time" "sys.time._parseZone" "156" "pass" "supported" "sys.time._parseZone" "156" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time" "sys.time.parse" "157" "pass" "supported" "sys.time.parse" "157" "sys.time" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.libc" "class:sys.libc.<clinit>" "158" "pass" "supported" "class:sys.libc.<clinit>" "158" "sys.libc" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.libc" "sys.libc.errno" "167" "direct" "indirect call" "sys.libc.errno" "167" "sys.libc" "0" "0" "0" "0" "0" "0" "opaque or indirect call #13351" +"sys" "source" "sys.libc" "sys.libc.set_errno" "169" "direct" "indirect call" "sys.libc.set_errno" "169" "sys.libc" "0" "0" "0" "0" "0" "0" "opaque or indirect call #13383" +"sys" "source" "sys.rt" "class:sys.rt.<clinit>" "172" "pass" "supported" "class:sys.rt.<clinit>" "172" "sys.rt" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.scan" "class:sys.scan.<clinit>" "173" "pass" "supported" "class:sys.scan.<clinit>" "173" "sys.scan" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.scan" "sys.scan.<init>" "174" "pass" "supported" "sys.scan.<init>" "174" "sys.scan" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.scan" "sys.scan.skip" "175" "pass" "supported" "sys.scan.skip" "175" "sys.scan" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.scan" "sys.scan.match" "176" "pass" "supported" "sys.scan.match" "176" "sys.scan" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.scan" "sys.scan.number" "177" "pass" "supported" "sys.scan.number" "177" "sys.scan" "0" "0" "0" "0" "0" "3" "" +"sys" "source" "sys.scan" "sys.scan.<new>" "179" "pass" "supported" "sys.scan.<new>" "179" "sys.scan" "1" "0" "0" "1" "0" "0" "" +"sys" "source" "sys.adt.bitset" "class:sys.adt.bitset.<clinit>" "180" "pass" "supported" "class:sys.adt.bitset.<clinit>" "180" "sys.adt.bitset" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.adt.bitset" "sys.adt.bitset.<init>" "181" "pass" "supported" "sys.adt.bitset.<init>" "181" "sys.adt.bitset" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.adt.bitset" "sys.adt.bitset.get" "182" "pass" "supported" "sys.adt.bitset.get" "182" "sys.adt.bitset" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.adt.bitset" "sys.adt.bitset._grow" "183" "direct" "variable size" "sys.adt.bitset._grow" "183" "sys.adt.bitset" "1" "0" "1" "0" "0" "2" "variable-size allocation #14313" +"sys" "source" "sys.adt.bitset" "sys.adt.bitset.set" "184" "blocked" "variable size" "sys.adt.bitset._grow" "183" "sys.adt.bitset" "0" "0" "0" "0" "0" "0" "call #14413 -> sys.adt.bitset._grow: variable-size allocation #14313" +"sys" "source" "sys.adt.bitset" "sys.adt.bitset.tset" "185" "blocked" "variable size" "sys.adt.bitset._grow" "183" "sys.adt.bitset" "0" "0" "0" "0" "0" "0" "call #14465 -> sys.adt.bitset._grow: variable-size allocation #14313" +"sys" "source" "sys.adt.bitset" "sys.adt.bitset.clr" "186" "pass" "supported" "sys.adt.bitset.clr" "186" "sys.adt.bitset" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.adt.bitset" "sys.adt.bitset.clear" "187" "pass" "supported" "sys.adt.bitset.clear" "187" "sys.adt.bitset" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.adt.bitset" "sys.adt.bitset.<new>" "189" "pass" "supported" "sys.adt.bitset.<new>" "189" "sys.adt.bitset" "2" "0" "0" "2" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "class:sys.draw.Canvas.<clinit>" "190" "pass" "supported" "class:sys.draw.Canvas.<clinit>" "190" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.<init>" "191" "pass" "supported" "sys.draw.Canvas.<init>" "191" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.resize" "192" "direct" "indirect call" "sys.draw.Canvas.resize" "192" "sys.draw.Canvas" "1" "0" "1" "0" "0" "0" "opaque or indirect call #15078" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.localX" "193" "pass" "supported" "sys.draw.Canvas.localX" "193" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.localY" "194" "pass" "supported" "sys.draw.Canvas.localY" "194" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.clear" "195" "pass" "supported" "sys.draw.Canvas.clear" "195" "sys.draw.Canvas" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.pixel" "196" "pass" "supported" "sys.draw.Canvas.pixel" "196" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.fillRect" "197" "pass" "supported" "sys.draw.Canvas.fillRect" "197" "sys.draw.Canvas" "0" "0" "0" "0" "0" "2" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.rect" "198" "pass" "supported" "sys.draw.Canvas.rect" "198" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.fillCircle" "199" "pass" "supported" "sys.draw.Canvas.fillCircle" "199" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.circle" "200" "pass" "supported" "sys.draw.Canvas.circle" "200" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas._circle" "201" "pass" "supported" "sys.draw.Canvas._circle" "201" "sys.draw.Canvas" "0" "0" "0" "0" "0" "2" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.line" "202" "pass" "supported" "sys.draw.Canvas.line" "202" "sys.draw.Canvas" "0" "0" "0" "0" "0" "2" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.text" "203" "pass" "supported" "sys.draw.Canvas.text" "203" "sys.draw.Canvas" "0" "0" "0" "0" "0" "3" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.Canvas" "204" "direct" "indirect call" "sys.draw.Canvas.Canvas" "204" "sys.draw.Canvas" "1" "0" "1" "0" "0" "0" "opaque or indirect call #17231" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas.<new>" "205" "blocked" "indirect call" "sys.draw.Canvas.Canvas" "204" "sys.draw.Canvas" "1" "0" "0" "0" "0" "0" "call #17399 -> sys.draw.Canvas.Canvas: opaque or indirect call #17231" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas._glyph" "206" "pass" "supported" "sys.draw.Canvas._glyph" "206" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Canvas" "sys.draw.Canvas._onLine" "207" "pass" "supported" "sys.draw.Canvas._onLine" "207" "sys.draw.Canvas" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Button" "class:sys.draw.Button.<clinit>" "208" "pass" "supported" "class:sys.draw.Button.<clinit>" "208" "sys.draw.Button" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Button" "sys.draw.Button.<init>" "209" "pass" "supported" "sys.draw.Button.<init>" "209" "sys.draw.Button" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Button" "sys.draw.Button.contains" "210" "pass" "supported" "sys.draw.Button.contains" "210" "sys.draw.Button" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Button" "sys.draw.Button.update" "211" "pass" "supported" "sys.draw.Button.update" "211" "sys.draw.Button" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Button" "sys.draw.Button.draw" "212" "pass" "supported" "sys.draw.Button.draw" "212" "sys.draw.Button" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.draw.Button" "sys.draw.Button.<new>" "214" "pass" "supported" "sys.draw.Button.<new>" "214" "sys.draw.Button" "1" "0" "0" "1" "0" "0" "" +"sys" "source" "sys.time.DateTime" "class:sys.time.DateTime.<clinit>" "215" "pass" "supported" "class:sys.time.DateTime.<clinit>" "215" "sys.time.DateTime" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time.DateTime" "sys.time.DateTime.<new>" "217" "pass" "supported" "sys.time.DateTime.<new>" "217" "sys.time.DateTime" "1" "0" "0" "1" "0" "0" "" +"sys" "source" "sys.time.DateTime" "sys.time.DateTime.empty" "218" "pass" "supported" "sys.time.DateTime.empty" "218" "sys.time.DateTime" "1" "0" "0" "1" "0" "0" "" +"sys" "source" "sys.time.Timers" "class:sys.time.Timers.<clinit>" "219" "pass" "supported" "class:sys.time.Timers.<clinit>" "219" "sys.time.Timers" "0" "0" "0" "0" "0" "0" "" +"sys" "source" "sys.time.Timers" "sys.time.Timers.<init>" "220" "pass" "supported" "sys.time.Timers.<init>" "220" "sys.time.Timers" "3" "0" "0" "3" "0" "0" "" +"sys" "source" "sys.time.Timers" "sys.time.Timers._add" "221" "direct" "recursion" "sys.time.Timers._add" "221" "sys.time.Timers" "3" "0" "3" "0" "0" "2" "recursive call component" +"sys" "source" "sys.time.Timers" "sys.time.Timers.afterAt" "222" "blocked" "recursion" "sys.time.Timers._add" "221" "sys.time.Timers" "0" "0" "0" "0" "0" "0" "call #20364 -> sys.time.Timers._add: recursive call component" +"sys" "source" "sys.time.Timers" "sys.time.Timers.everyAt" "223" "blocked" "recursion" "sys.time.Timers._add" "221" "sys.time.Timers" "0" "0" "0" "0" "0" "0" "call #20399 -> sys.time.Timers._add: recursive call component" +"sys" "source" "sys.time.Timers" "sys.time.Timers.after" "224" "direct" "indirect call" "sys.time.Timers.after" "224" "sys.time.Timers" "0" "0" "0" "0" "0" "0" "opaque or indirect call #22597" +"sys" "source" "sys.time.Timers" "sys.time.Timers.every" "225" "direct" "indirect call" "sys.time.Timers.every" "225" "sys.time.Timers" "0" "0" "0" "0" "0" "0" "opaque or indirect call #23115" +"sys" "source" "sys.time.Timers" "sys.time.Timers.cancel" "226" "pass" "supported" "sys.time.Timers.cancel" "226" "sys.time.Timers" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.time.Timers" "sys.time.Timers.nextDeadline" "227" "pass" "supported" "sys.time.Timers.nextDeadline" "227" "sys.time.Timers" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.time.Timers" "sys.time.Timers.poll" "228" "pass" "supported" "sys.time.Timers.poll" "228" "sys.time.Timers" "0" "0" "0" "0" "0" "1" "" +"sys" "source" "sys.time.Timers" "sys.time.Timers.<new>" "229" "pass" "supported" "sys.time.Timers.<new>" "229" "sys.time.Timers" "1" "0" "0" "4" "0" "0" "" +"RuntimeArgs" "source" "RuntimeArgs" "class:RuntimeArgs.<clinit>" "2" "pass" "supported" "class:RuntimeArgs.<clinit>" "2" "RuntimeArgs" "0" "0" "0" "0" "0" "0" "" +"RuntimeArgs" "source" "RuntimeArgs" "simple_args" "6" "direct" "raw address" "simple_args" "6" "RuntimeArgs" "2" "0" "2" "0" "0" "1" "raw address escapes lifetime tracking #248" +"A_helloWorld" "object" "A_helloWorld" "class:A_helloWorld.<clinit>" "2" "blocked" "raw address" "sys.io.writeOff" "95" "sys.io" "0" "0" "0" "0" "0" "0" "call #4079 -> sys.io.writeOff: raw address escapes lifetime tracking #3733" +"BubbleSort" "object" "BubbleSort" "class:BubbleSort.<clinit>" "2" "pass" "supported" "class:BubbleSort.<clinit>" "2" "BubbleSort" "0" "0" "0" "0" "0" "0" "" +"BubbleSort" "object" "BubbleSort" "sort" "202" "pass" "supported" "sort" "202" "BubbleSort" "0" "0" "0" "0" "0" "2" "" +"BubbleSort" "object" "BubbleSort" "main" "203" "blocked" "raw address" "sys.io.writeOff" "95" "sys.io" "0" "0" "0" "0" "0" "0" "call #5100 -> sys.io.writeOff: raw address escapes lifetime tracking #4714" +"BubbleSort" "object" "BubbleSort" "usage" "204" "blocked" "raw address" "sys.io.writeOff" "95" "sys.io" "0" "0" "0" "0" "0" "0" "call #5978 -> sys.io.writeOff: raw address escapes lifetime tracking #4714" +"Capitalize" "object" "Capitalize" "class:Capitalize.<clinit>" "2" "pass" "supported" "class:Capitalize.<clinit>" "2" "Capitalize" "0" "0" "0" "0" "0" "0" "" +"Capitalize" "object" "Capitalize" "main" "3" "blocked" "raw address" "sys.io.writeOff" "96" "sys.io" "1" "0" "1" "0" "0" "0" "call #4536 -> sys.io.writeOff: raw address escapes lifetime tracking #4076" +"FileIO" "object" "FileIO" "class:FileIO.<clinit>" "2" "pass" "supported" "class:FileIO.<clinit>" "2" "FileIO" "0" "0" "0" "0" "0" "0" "" +"FileIO" "object" "FileIO" "main" "3" "direct" "raw address" "main" "3" "FileIO" "2" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #6573" +"FileIO" "object" "FileIO" "_error2" "203" "direct" "raw address" "_error2" "203" "FileIO" "2" "0" "0" "0" "0" "0" "raw address escapes lifetime tracking #6670" +"FileIO" "object" "FileIO" "_error" "204" "direct" "indirect call" "_error" "204" "FileIO" "0" "0" "0" "0" "0" "0" "opaque or indirect call #6874" +"Dijkstra" "object" "Dijkstra" "class:Dijkstra.<clinit>" "2" "pass" "supported" "class:Dijkstra.<clinit>" "2" "Dijkstra" "0" "0" "0" "0" "0" "0" "" +"Dijkstra" "object" "Dijkstra" "shortestPath" "202" "blocked" "variable size" "sys.adt.bitset._grow" "48" "sys.adt.bitset" "3" "0" "1" "0" "0" "4" "call #7543 -> sys.adt.bitset._grow: variable-size allocation #6202" +"Dijkstra" "object" "Dijkstra" "usage" "203" "blocked" "raw address" "sys.io.writeOff" "95" "sys.io" "0" "0" "0" "0" "0" "0" "call #7528 -> sys.io.writeOff: raw address escapes lifetime tracking #6699" +"Dijkstra" "object" "Dijkstra" "main" "204" "blocked" "raw address" "sys.io.writeOff" "95" "sys.io" "2" "0" "0" "0" "0" "2" "call #7568 -> sys.io.writeOff: raw address escapes lifetime tracking #6699" +"Graphics" "object" "Graphics" "class:Graphics.<clinit>" "2" "pass" "supported" "class:Graphics.<clinit>" "2" "Graphics" "0" "0" "0" "0" "0" "0" "" +"Graphics" "object" "Graphics" "main" "3" "direct" "raw address" "main" "3" "Graphics" "1" "0" "0" "0" "0" "3" "raw address escapes lifetime tracking #6220" +"Clock" "object" "Clock" "class:Clock.<clinit>" "2" "pass" "supported" "class:Clock.<clinit>" "2" "Clock" "0" "0" "0" "0" "0" "0" "" +"Clock" "object" "Clock" "main" "3" "direct" "raw address" "main" "3" "Clock" "3" "0" "0" "0" "0" "1" "raw address escapes lifetime tracking #11014" +"Clock" "object" "Clock" "_draw" "203" "blocked" "raw address" "sys.time.local" "185" "sys.time" "3" "0" "1" "0" "0" "2" "call #1002 -> sys.time.local: raw address escapes lifetime tracking #12253" +"Clock" "object" "Clock" "_digit" "208" "pass" "supported" "_digit" "208" "Clock" "0" "0" "0" "0" "0" "1" "" +"Clock" "object" "Clock" "_digital" "209" "pass" "supported" "_digital" "209" "Clock" "0" "0" "0" "0" "0" "1" "" +"Clock" "object" "Clock" "_hand" "210" "direct" "indirect call" "_hand" "210" "Clock" "0" "0" "0" "0" "0" "0" "opaque or indirect call #2302" +"Clock" "object" "Clock" "_analog" "211" "direct" "indirect call" "_analog" "211" "Clock" "0" "0" "0" "0" "0" "1" "opaque or indirect call #2540" +"Breakout" "object" "Breakout" "class:Breakout.<clinit>" "2" "pass" "supported" "class:Breakout.<clinit>" "2" "Breakout" "1" "0" "0" "1" "0" "0" "" +"Breakout" "object" "Breakout" "Breakout.Game.<init>" "3" "pass" "supported" "Breakout.Game.<init>" "3" "Breakout" "1" "0" "0" "1" "0" "1" "" +"Breakout" "object" "Breakout" "_tick" "4" "pass" "supported" "_tick" "4" "Breakout" "0" "0" "0" "0" "0" "3" "" +"Breakout" "object" "Breakout" "_cue" "5" "pass" "supported" "_cue" "5" "Breakout" "0" "0" "0" "0" "0" "0" "" +"Breakout" "object" "Breakout" "_speed" "6" "pass" "supported" "_speed" "6" "Breakout" "0" "0" "0" "0" "0" "0" "" +"Breakout" "object" "Breakout" "_paddle" "7" "pass" "supported" "_paddle" "7" "Breakout" "0" "0" "0" "0" "0" "0" "" +"Breakout" "object" "Breakout" "_rebound" "8" "pass" "supported" "_rebound" "8" "Breakout" "0" "0" "0" "0" "0" "1" "" +"Breakout" "object" "Breakout" "_brick" "9" "pass" "supported" "_brick" "9" "Breakout" "0" "0" "0" "0" "0" "0" "" +"Breakout" "object" "Breakout" "_lostBall" "10" "pass" "supported" "_lostBall" "10" "Breakout" "0" "0" "0" "0" "0" "0" "" +"Breakout" "object" "Breakout" "_reset" "11" "pass" "supported" "_reset" "11" "Breakout" "0" "0" "0" "0" "0" "1" "" +"Breakout" "object" "Breakout" "_hud" "211" "pass" "supported" "_hud" "211" "Breakout" "0" "0" "0" "0" "0" "4" "" +"Breakout" "object" "Breakout" "_bricks" "212" "pass" "supported" "_bricks" "212" "Breakout" "0" "0" "0" "0" "0" "1" "" +"Breakout" "object" "Breakout" "_overlay" "213" "pass" "supported" "_overlay" "213" "Breakout" "0" "0" "0" "0" "0" "0" "" +"Breakout" "object" "Breakout" "_draw" "214" "pass" "supported" "_draw" "214" "Breakout" "0" "0" "0" "0" "0" "1" "" +"Breakout" "object" "Breakout" "_input" "215" "direct" "indirect call" "_input" "215" "Breakout" "0" "0" "0" "0" "0" "0" "opaque or indirect call #18288" +"Breakout" "object" "Breakout" "debounce" "216" "direct" "indirect call" "debounce" "216" "Breakout" "0" "0" "0" "0" "0" "0" "opaque or indirect call #6273" +"Breakout" "object" "Breakout" "_serve" "217" "pass" "supported" "_serve" "217" "Breakout" "0" "0" "0" "0" "0" "1" "" +"Breakout" "object" "Breakout" "" "218" "direct" "indirect call" "" "218" "Breakout" "0" "0" "0" "0" "0" "0" "opaque or indirect call #18379" +"Breakout" "object" "Breakout" "" "219" "pass" "supported" "" "219" "Breakout" "0" "0" "0" "0" "0" "0" "" +"Breakout" "object" "Breakout" "Breakout.Game.<new>" "220" "pass" "supported" "Breakout.Game.<new>" "220" "Breakout" "1" "0" "0" "2" "0" "0" "" +"Breakout" "object" "Breakout" "_number" "221" "pass" "supported" "_number" "221" "Breakout" "0" "0" "0" "0" "0" "1" "" +"Breakout" "object" "Breakout" "_tone" "222" "direct" "raw address" "_tone" "222" "Breakout" "1" "0" "0" "0" "0" "1" "raw address escapes lifetime tracking #18921" +"Breakout" "object" "Breakout" "_sqrt" "223" "pass" "supported" "_sqrt" "223" "Breakout" "0" "0" "0" "0" "0" "1" "" +"Breakout" "object" "Breakout" "main" "224" "direct" "raw address" "main" "224" "Breakout" "4" "0" "1" "0" "0" "3" "raw address escapes lifetime tracking #19167" +"TicTacToe" "object" "TicTacToe" "class:TicTacToe.<clinit>" "2" "pass" "supported" "class:TicTacToe.<clinit>" "2" "TicTacToe" "0" "0" "0" "0" "0" "0" "" +"TicTacToe" "object" "TicTacToe" "main" "3" "blocked" "raw address" "sys.io.writeOff" "96" "sys.io" "4" "0" "1" "0" "0" "3" "call #9529 -> sys.io.writeOff: raw address escapes lifetime tracking #7910" +"TicTacToe" "object" "TicTacToe" "_validMove" "207" "direct" "indirect call" "_validMove" "207" "TicTacToe" "3" "0" "1" "0" "0" "2" "opaque or indirect call #9266" +"TicTacToe" "object" "TicTacToe" "_winner" "208" "pass" "supported" "_winner" "208" "TicTacToe" "0" "0" "0" "0" "0" "1" "" +"TicTacToe" "object" "TicTacToe" "_finished" "209" "blocked" "raw address" "sys.io.writeOff" "96" "sys.io" "0" "0" "0" "0" "0" "1" "call #9491 -> sys.io.writeOff: raw address escapes lifetime tracking #7910" +"TicTacToe" "object" "TicTacToe" "_threat" "210" "pass" "supported" "_threat" "210" "TicTacToe" "0" "0" "0" "0" "0" "1" "" +"TicTacToe" "object" "TicTacToe" "_cpu" "211" "pass" "supported" "_cpu" "211" "TicTacToe" "0" "0" "0" "0" "0" "2" "" +"TicTacToe" "object" "TicTacToe" "_draw" "212" "blocked" "opaque body" "sys.ary.capacity" "64" "sys.ary" "2" "0" "0" "0" "0" "2" "call #8785 -> sys.aryu8._grow: call #8389 -> sys.ary.capacity: opaque body: allocation contract unavailable" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "class:TicTacToeGraphical.<clinit>" "2" "pass" "supported" "class:TicTacToeGraphical.<clinit>" "2" "TicTacToeGraphical" "0" "0" "0" "0" "0" "0" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "main" "3" "direct" "raw address" "main" "3" "TicTacToeGraphical" "2" "0" "0" "0" "0" "4" "raw address escapes lifetime tracking #9861" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_sound" "203" "pass" "supported" "_sound" "203" "TicTacToeGraphical" "0" "0" "0" "0" "0" "0" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_reset" "204" "pass" "supported" "_reset" "204" "TicTacToeGraphical" "0" "0" "0" "0" "0" "1" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_square" "205" "pass" "supported" "_square" "205" "TicTacToeGraphical" "0" "0" "0" "0" "0" "0" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_move" "206" "pass" "supported" "_move" "206" "TicTacToeGraphical" "0" "0" "0" "0" "0" "2" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_finished" "207" "pass" "supported" "_finished" "207" "TicTacToeGraphical" "0" "0" "0" "0" "0" "1" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_winningLine" "208" "pass" "supported" "_winningLine" "208" "TicTacToeGraphical" "0" "0" "0" "0" "0" "1" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_winner" "209" "pass" "supported" "_winner" "209" "TicTacToeGraphical" "0" "0" "0" "0" "0" "0" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_threat" "210" "pass" "supported" "_threat" "210" "TicTacToeGraphical" "0" "0" "0" "0" "0" "1" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_cpu" "211" "pass" "supported" "_cpu" "211" "TicTacToeGraphical" "0" "0" "0" "0" "0" "2" "" +"TicTacToeGraphical" "object" "TicTacToeGraphical" "_draw" "212" "pass" "supported" "_draw" "212" "TicTacToeGraphical" "0" "0" "0" "0" "0" "4" "" +"LocalArray" "probe" "LocalArray" "class:LocalArray.<clinit>" "2" "blocked" "variable size" "work_noInline" "3" "LocalArray" "0" "0" "0" "0" "0" "0" "call #111 -> work_noInline: variable-size allocation #36" +"LocalArray" "probe" "LocalArray" "work_noInline" "3" "direct" "variable size" "work_noInline" "3" "LocalArray" "1" "0" "1" "0" "0" "1" "variable-size allocation #36" +"ReturnedArray" "probe" "ReturnedArray" "class:ReturnedArray.<clinit>" "2" "blocked" "variable size" "make_noInline" "3" "ReturnedArray" "0" "0" "0" "0" "0" "0" "call #53 -> make_noInline: variable-size allocation #36" +"ReturnedArray" "probe" "ReturnedArray" "make_noInline" "3" "direct" "variable size" "make_noInline" "3" "ReturnedArray" "1" "0" "1" "0" "0" "0" "variable-size allocation #36" +"OverwrittenSlot" "probe" "OverwrittenSlot" "class:OverwrittenSlot.<clinit>" "2" "blocked" "loop retention" "work_noInline" "8" "OverwrittenSlot" "0" "0" "0" "0" "0" "0" "call #206 -> work_noInline: loop#148 carries new#277:OverwrittenSlot.Thing across its backedge; collection/overlap destinations not implemented" +"OverwrittenSlot" "probe" "OverwrittenSlot" "OverwrittenSlot.Thing.<new>" "5" "pass" "supported" "OverwrittenSlot.Thing.<new>" "5" "OverwrittenSlot" "1" "0" "0" "1" "0" "0" "" +"OverwrittenSlot" "probe" "OverwrittenSlot" "OverwrittenSlot.Holder.<new>" "7" "pass" "supported" "OverwrittenSlot.Holder.<new>" "7" "OverwrittenSlot" "1" "0" "0" "1" "0" "0" "" +"OverwrittenSlot" "probe" "OverwrittenSlot" "work_noInline" "8" "direct" "loop retention" "work_noInline" "8" "OverwrittenSlot" "2" "0" "0" "0" "0" "1" "loop#148 carries new#277:OverwrittenSlot.Thing across its backedge; collection/overlap destinations not implemented" +"ReusedObject" "probe" "ReusedObject" "class:ReusedObject.<clinit>" "2" "pass" "supported" "class:ReusedObject.<clinit>" "2" "ReusedObject" "0" "0" "0" "0" "0" "0" "" +"ReusedObject" "probe" "ReusedObject" "ReusedObject.Thing.<new>" "5" "pass" "supported" "ReusedObject.Thing.<new>" "5" "ReusedObject" "1" "0" "0" "1" "0" "0" "" +"ReusedObject" "probe" "ReusedObject" "read_noInline" "6" "pass" "supported" "read_noInline" "6" "ReusedObject" "0" "0" "0" "0" "0" "0" "" +"ReusedObject" "probe" "ReusedObject" "work_noInline" "7" "pass" "supported" "work_noInline" "7" "ReusedObject" "1" "0" "0" "1" "0" "1" "" diff --git a/chapter33/docs/allocation-survey.md b/chapter33/docs/allocation-survey.md new file mode 100644 index 00000000..eb803c78 --- /dev/null +++ b/chapter33/docs/allocation-survey.md @@ -0,0 +1,256 @@ +# Allocation survey: existing Simple programs + +Measured 2026-11-21, at TypeCheck with assertions enabled. This surveys the +current analysis; it does not implement or validate stack allocation at runtime. + +The fixed-size plans handle useful object graphs and native borrowing. +Variable-sized storage is now the broadest limitation; the original baseline +below records the earlier native-call and raw-address blockers. + +## Update: lexical KeepAlive + +The parser now retains converted addresses through their lexical scope exits. +This admits integer arguments forwarded through Simple wrappers and addresses +stored and reloaded within that scope. Conditional conversions, overwritten +locals, return/break/continue paths, implicit branch scopes, forward calls, and +imported bodies are covered by the chapter tests. A returned integer does not +promote its backing storage into the caller's lifetime. + +The large-program totals remain 134/179 accepted for `sys` source and +52/68 for the examples' own functions. Those programs had already passed +the simpler borrowing checks or encountered another blocker first. + +The current first-cause breakdown for the 45 rejected `sys` functions is: + +| Cause | Direct | Blocked callers | +|---|---:|---:| +| Variable-size allocation | 7 | 32 | +| Recursion | 1 | 4 | +| Native pointer result without an allocation contract | 1 | 0 | + +First-cause counts can change with optimization order when a function has several +blockers. The native-result requirement remains; this is not permission to assume +that a native-produced pointer is borrowed. The examples' remaining failures +are eleven missing imported bodies, four variable-size plans, and one indirect +callback. + +The next substantial gains need variable-size plans and allocation contracts +for imported bodies. Recursion and Breakout's indirect callback remain separate +work. `_exit` still needs the agreed nonreturning handling. KeepAlive is erased +before scheduling; storage placement still uses function/iteration frames and +does not yet change runtime allocation. + +## Update: native borrowing + +After adopting the native non-retention rule and tracking pointer-derived +integer SSA values through calls, the same cohorts improve as follows. The +remaining sections preserve the original survey and its baseline snapshot. + +| Cohort | Accepted before | Accepted now | With user allocations now | +|---|---:|---:|---:| +| `sys` source, 179 functions | 98 | 134 | 12 | +| Examples' own 68 functions | 43 | 52 | 4 | + +Hello world's executable initializer now gets a supported plan. Clock's `_hand` +and `_analog` pass. Breakout improves from 19/24 to 22/24; its `_tone` buffer is +now accepted as scratch. `sys.time.local` now accepts the DateTime result and +its temporary native buffer. + +Of the remaining 45 `sys` rejections, 38 stop at variable-sized allocation +(seven direct, 31 callers), five at recursion (one direct, four callers), and +two at native-produced Simple pointers without allocation contracts. No call +or raw-address rejection remains the first cause in that source cohort. +Precompiled-library examples still expose missing imported summaries, such as +`sys.ary.capacity`, `sys.ary.copy`, and `sys.aryu8.str0`. Breakout's `debounce` +also contains a genuinely indirect callback. + +This change is analysis-only. `_exit` is accepted under the native borrowing +rule, but is not yet a nonreturning intrinsic. The ABI, allocation lowering, +and default runtime allocation behavior are unchanged. + +## Original baseline + +| Cohort | Function summaries | Accepted | Accepted with user allocations | +|---|---:|---:|---:| +| `sys`, compiled from source | 179 | 98 | 11 | +| Ten examples, their own functions only | 68 | 43 | 3 | +| Native argument conversion, compiled separately | 2 | 1 | 0 | + +These counts include retained/exported functions and class initializers, not +just functions reachable by direct calls from an entry point. Native declarations +without a Simple body are not separate function summaries. A passing function +can still call other passing functions that allocate. The last column counts +fresh storage represented in that function's plan, including imported callee +sites; it excludes compiler class objects. It is not a count of dynamic objects. +All 87 other accepted `sys` functions have no remaining allocation sites. + +## What passes + +The accepted `sys` plans include 19 user-storage sites: 16 with result destinations +and three retained through constructor receiver `arg2`. + +- `sys.time.utc` builds and returns a DateTime: a real fixed-size factory, with + calendar computation and conditional paths. +- `sys.time.Timers.<new>` returns a timer object and its three fixed initial + arrays. The initializer puts the arrays in the receiver's lifetime; the factory + composes that into the returned graph. +- `sys.aryu8.<new>` and `sys.text.begin` return a byte-vector object plus its + initial backing array. Growing that array is a separate, rejected operation. +- Bitset construction, Button construction, and scanner construction pass. +- All six `sys.scan` summaries and all six `sys.draw.Button` summaries pass. + Canvas has 15 passing summaries out of 18: the drawing operations work on + borrowed storage; construction and resizing encounter allocation/call barriers. +- Breakout's Game factory returns the Game and its 192-element brick array. + Its initializer correctly gives the array the receiver's lifetime. Most game + logic and drawing routines pass too. + +The accepted `sys` functions contain 26 loop summaries. Ordinary loops over +existing storage are not the main obstacle. + +## Where the library stops + +The pass records the first rejection in a function. A caller can then inherit +that rejection. Following those call chains gives: + +| First underlying reason | Directly rejected functions | Blocked callers | Total | +|---|---:|---:|---:| +| Opaque or indirect call | 35 | 18 | 53 | +| Raw-address conversion | 11 | 10 | 21 | +| Variable-size allocation | 2 | 2 | 4 | +| Recursion | 1 | 2 | 3 | +| Total | 49 | 32 | 81 | + +These are first-cause counts, not independent fixes or predicted acceptance +after removing a barrier. For example, `sys.aryu8._grow` accounts for 16 rejected +summaries including itself. Its first rejection is the `_exit(1)` call used for +overflow failure, but it also allocates a variable-sized array. Accepting that +call alone would not make growth work. + +Independent inspection of the collected IR finds 21 variable-sized NewNodes +across 19 `sys` functions. Only two functions currently report that as their +first direct failure: `sys.text.end` and `sys.adt.bitset._grow`. + +There were no first-reported loop-retention, cyclic-field-path, or unmapped-origin +failures in this library cohort. Earlier rejection barriers can hide them. + +## The examples + +These use the normal precompiled `sys` library. Counts include only each +example's own functions, avoiding repeated counts of imported library exports. +The compiler may load and inline imported bodies; some others remain opaque. + +| Example | Accepted / total | Accepted with allocations | Representative failure | +|---|---:|---:|---| +| Hello world | 0 / 1 | 0 | String address passed to output | +| BubbleSort | 2 / 4 | 0 | Output; sorting itself passes | +| Capitalize | 1 / 2 | 0 | Output; main also has a variable-sized array | +| FileIO | 1 / 4 | 0 | Native I/O and raw addresses | +| Dijkstra | 1 / 4 | 0 | Bitset growth; output | +| Graphics | 1 / 2 | 0 | Raw address passed to graphics | +| Clock | 3 / 7 | 0 | Graphics/time pointers; scalar libm calls | +| Breakout | 19 / 24 | 3 | Input/audio/graphics calls | +| TicTacToe | 4 / 8 | 0 | I/O, growth, an opaque imported `sys.ary.capacity` | +| TicTacToeGraphical | 11 / 12 | 0 | Main's graphics boundary | + +No example's `main` receives a complete supported plan; hello world's executable +class initializer is rejected too. High per-function acceptance is not yet a +working automatically managed program. + +## Analysis improvements versus storage decisions + +| Case | What is missing | Likely action | +|---|---|---| +| Clock's `sin`/`cos`, clocks, input polling, `_exit` | Known native behavior is treated as opaque | Targeted native contracts/recognition; no application rewrite should be needed | +| Array passed to synchronous I/O or copying audio loader | Lifetime/provenance is lost at conversion to `i64` | Wrapper contract and provenance tracking through the native call | +| Opaque imported Simple function | No serialized allocation summary | Export/import lifetime summaries; avoid changing source merely to force inlining | +| Runtime-sized local scratch array | Immediate rejection of nonconstant size | Keep the lifetime result and represent a runtime size; later lower a local reservation | +| Finished variable-sized result, such as `sys.text.end` | Caller needs storage whose size the callee discovers | Destination/buffer/region choice under the agreed design; possibly a small library rewrite | +| Replaced vector/Canvas backing array | Dynamic sizing plus proof that old aliases are no longer usable | Analysis for reclaiming old buffers; explicit storage policy where proof fails | +| Fixed-size object repeatedly replacing `Holder.c` | Weak updates never kill the old reference | Overwrite/liveness analysis; this is not inherently unbounded storage | +| `Timers._add` retries recursively after growing | SCC support, plus three variable-sized arrays | Defer SCCs; changing the retry to a loop alone would not solve storage | + +Native scalar signatures must not be accepted indiscriminately: an `i64` may +carry a raw pointer. Contracts must describe the actual wrapper, including +whether it retains a passed address or creates returned storage. + +One concrete native allocation requires attention: +[`simple_text_float`](../src/main/c/simple_crt.c) uses `malloc` to create a +Simple-format byte array and returns it. There is no Simple NewNode for that +allocation. A non-retaining-call annotation is insufficient: the result needs +an allocation/ownership contract, or the wrapper should write into caller-provided +storage. This is a useful first native-interface design case. + +The separately compiled [`simple_args`](../src/main/smp/sys/rt/simple_args.smp) +has two variable-sized allocation sites: an outer reference array and byte +arrays created inside its initializer loop. Its first rejection is the raw +destination passed to `memcpy`. Beyond that contract, it exercises the planned +collection destination and variable-sized returned graph. + +## Small reductions + +The survey probe also compiles four isolated cases, without native calls: + +| Probe | Result | +|---|---| +| Allocate `i64[n]`, fill/read it, return a scalar | Rejected: variable-size allocation | +| Return a freshly allocated `i64[n]` | Rejected for the same reason, despite a different storage problem | +| Repeatedly replace `h.c` with a fresh fixed-size Thing, then read the last one | Rejected: Thing survives the backedge | +| Allocate one mutable Thing before the loop, overwrite its scalar field, borrow it each iteration | Accepted: one Thing in the function frame | + +The overwrite reduction has no saved reference to an older Thing. It needs an +analysis improvement, not a language prohibition. Reusing one mutable object +is a possible rewrite for that particular program, not a general replacement +for allocations with distinct observable identities. + +## Suggested next work + +First, admit a small audited set of scalar native calls and specify borrowing +for the common array wrappers. Preserve those contracts across imported calls. +That removes the largest observational barrier without tackling SCCs. + +Then distinguish local variable-sized scratch from returned/growing storage, +and tackle the fixed-size overwrite proof. Re-run this survey after those steps; +the first-cause distribution should become much more informative. + +For an initial lowering implementation, the passing Game, Timers, byte-vector, +and DateTime factories already supply useful fixed-size object graphs. Use them +alongside the existing scratch/winner poster children. Do not wait for every +library operation to pass before validating real storage placement. + +## Reproduction and limitations + +[`AllocationSurvey.java`](AllocationSurvey.java) is a standalone observational +probe. It reads private analysis collections by reflection rather than adding +production compiler APIs. It does not change contracts, suppress rejections, +link native code, run games, or lower allocation plans. +The [function-level snapshot](allocation-survey-functions.tsv) contains the +cohorts above and the four reductions, with first-cause chains and site counts. +Full dumps, allocation sites, and call lists are written under +`build/allocation-survey/<name>-<mode>/`. + +From `chapter33`, after building the Java compiler and the normal `sys` objects: + +```powershell +javac -cp build/classes/main -d build/allocation-survey docs/AllocationSurvey.java +java -ea -Xss16m -Xmx2g -XX:ActiveProcessorCount=2 -cp 'build/classes/main;build/allocation-survey' AllocationSurvey sys source +java -ea -Xss16m -Xmx2g -XX:ActiveProcessorCount=2 -cp 'build/classes/main;build/allocation-survey' AllocationSurvey Clock object +java -ea -Xss16m -Xmx2g -XX:ActiveProcessorCount=2 -cp 'build/classes/main;build/allocation-survey' AllocationSurvey OverwrittenSlot probe +``` + +Use each example's filename without `.smp`; modes are `source` and `object`. +`RuntimeArgs source` compiles the native-startup helper. Probe names are +`LocalArray`, `ReturnedArray`, `OverwrittenSlot`, and `ReusedObject`. +On bash use `:` instead of `;` in the classpath. + +The auxiliary all-source run succeeds for hello world, BubbleSort, Capitalize, +and Breakout. Breakout's own 19/24 result is unchanged with library source visible. +The other six examples stop in Parse on qualified `sys` types, before Allocation; +they are not counted as lifetime failures. The source-mode probe prepends a +private `sys` binding to request library discovery; that does not resolve those +type-name failures. A first all-source Breakout run exhausted the default Java +stack in `Node._walk`; all reported runs use `-Xss16m`. + +Counts use seed 456 and optimized IR, so inlining and dead-code removal affect +which sites and functions remain. They measure the current conservative analysis, +not runtime allocation frequency, memory saved, or proof that future lowering is +correct. Existing compiler files were not changed for this survey. diff --git a/chapter33/docs/array-delete-survey.md b/chapter33/docs/array-delete-survey.md new file mode 100644 index 00000000..82303acb --- /dev/null +++ b/chapter33/docs/array-delete-survey.md @@ -0,0 +1,141 @@ +# Deletable-array source survey + +2026-11-23. Five production resize implementations, seven source deletion sites. +The compiler now accepts `E[^]`, `new E[^N]`, and `.del()` and requires an ownership +proof at TypeCheck. Runtime recycling remains unimplemented. + +| Source | Local deletion check | Full TypeCheck | +|---|---|---| +| [aryu8._grow](../src/main/smp/sys/aryu8.smp) | Grow/add/append, string/integer formatting, and `aryi64.str` compose | Reject: native boundaries in file input, floating formatting, and calendar formatting | +| [aryi64._grow](../src/main/smp/sys/aryi64.smp) | Initializer and repeated `add` calls compose | Pass, including `parseAryI64` | +| [bitset._grow](../src/main/smp/sys/adt/bitset.smp) | Contract propagates through `set` and `tset` | Pass | +| [Timers._add](../src/main/smp/sys/time/Timers.smp) | Consuming recursion not supported | Reject | +| [Canvas.resize](../src/main/smp/sys/draw/Canvas.smp) | Consuming `self.pixels` contract inferred | Pass | + +No compiler crashes remain in the final sweep. Initially four cases asserted on +an array `.del` field offset: the receiver became an array only after parsing. +Deferred member resolution now folds that load to the intrinsic. The added +generic receiver signature also exposed an abstract-pointer type-upgrade bug; +abstract struct bounds now remain bounds instead of being looked up as classes. + +The source-level poster children in Chapter33Test pass: local arrays, replacement +of a locally constructed owner's buffer, borrowing helpers, list/generator +initializers, and serialized/imported deletion bodies. Saved aliases and +double deletion reject. Extracting an element reference does not retain its +backing array. Incoming ownership becomes a checked function requirement; callers +must discharge it or propagate it in their own contract. A library can therefore +pass TypeCheck while retaining requirements for future callers. + +## What the failures tell us + +Known native `_exit` calls now retain normal call control but return `TypeMem.TOP` +memory and `TypeScalar.TOP` values. The machine call remains; mixed or unknown +targets remain conservative. This removes `_exit` from the merged memory effects +without adding an exceptional CFG edge. + +The earlier reduced case's redundant `Test.$init` guard is handled: loads recover +the initialized flag through whole-memory parameters when every live incoming +path proves it. Variable-sized `[^]` allocations are planned as buddy storage. + +Its replacement, `testArrayDeleteAryu8IntegerInit`, reads `sys.integer.MAX_U32` +directly and imports the release library, isolating remote initialization from +`ary.capacity` and `ary.copy`. The saved summary now records the function's own +written aliases, reference-write flag, and escaping identities. Incoming memory +and unrelated functions' escapes are not part of that contract. Effects compose +through calls, including recursive and nonreturning paths. The initializer has +no reference writes. The local proof produces a consuming requirement, and the +fresh-wrapper caller discharges it; the test now passes TypeCheck. + +This removes `sys.ary.capacity` and `sys.integer` as blockers in the production +sweep. Allocation contracts now survive serialization too: `ary.copy` returns +its `dst` argument, allocates no storage, and writes no references. The deletion +checker follows returned argument aliases, allowing this copy while still +rejecting uses of an old array through a returned alias after deletion. +`testArrayDeleteAryu8Copy` exercises the actual imported contract without loading +the copy implementation; its fresh-wrapper caller now passes too. Caller checks +use the buffer's entry identity: saved aliases reject, but a reload of the +replaced field is valid. Requirements survive forwarding and serialization. + +The repeated-checkpoint restriction is now removed. `testArrayConsumeGrowLoop` +passes, as do nested loops, breaks, fresh allocation/deletion per iteration, and +loops calling an imported forwarder. The backedge check rejects saved array +references and verifies the callee preserves an exclusive owning field. A helper +that publishes an alias of its replacement cannot satisfy that proof. +Copies of the replacement crossing the backedge are conservatively rejected, +even when the next iteration could use and discard them before its next grow. + +The two-grow example now passes (`testArrayConsumeTwoGrows`). The checker follows +memory SSA; it substitutes each call's field stores and returned origins at that +call's memory output. A proven unique outgoing field provides a new ownership +version, even on a no-growth path. Loop heads provide iteration-entry versions, +so several grows per iteration do not confuse prior and current buffers. The +initializer-specific proof was replaced by this general call substitution. + +String formatting needs both a writable builder and a borrowed input array. +Its unique-buffer requirement excludes an alias in that input parameter; callers +check their actual arguments. Passing the builder's own buffer rejects. Distinct +wrapper parameters are still allowed to alias, so their field paths cannot gain +this disjointness assumption merely by having different names. + +## Checkpoint for design review + +The latest sweep passes the complete `aryi64`, `bitset`, and `Canvas` migrations. +Within the `aryu8` migration, `_grow`, `add`, `addAry`, `num`, padding, string and +integer formatting, `aryi64.str`, and elapsed-time formatting pass their checks. +The remaining failures are: + +| Boundary | Current rejection | +|---|---| +| `sys.io.read` | Native `read` has no usable pointer-memory effect contract | +| Floating formatting | `simple_text_float` returns storage with unknown origin | +| Calendar formatting | `sys.time.local` carries unmodeled native effects | +| Timers | Recursive consuming groups lack allocation/ownership contracts | + +The storage graph is still flow-insensitive. It supplies conservative may-stores +and the proof of unique outgoing fields; the deletion checker applies those +facts in memory order. Arbitrary callee overwrites do not yet prove an alias was +cleared. Other conservative limits remain: replacement aliases carried across +iterations, cyclic reference queries, multiple incoming ownership paths, and +array-element ownership slots requiring index proofs. These are useful targets +for the architecture review rather than more library-specific exceptions. + +IR format 8 records whether raw/native/initialization effects are absent from +the field graph. Such summaries remain opaque to ownership composition, also +after serialization. Tests cover unsafe saved aliases, helper retention, actual +argument aliasing, multiple grows per iteration, imported forwarders, and an +imported raw-address store. The headless test suite passes. No compiler crashes +occurred in the sweep. Runtime recycling remains unimplemented. + +## Reproducing the sweep + +[ArrayDeleteSurvey.java](ArrayDeleteSurvey.java) copies `src/main/smp` into a fresh +directory under `build/array-delete-survey`, changes one library per case, then +compiles the whole source `sys`. It does not alter production files or run Simple +code. Each migration marks backing arrays and their allocations `[^]`, saves the +old references, publishes replacements, and calls `.del()` on the old buffers. +For aryi64 it also changes the owning constructor parameter and its factory's +initial allocation; arbitrary caller arrays cannot simply acquire the capability. + +From chapter33, compile the runner: + +```text +javac -cp build/classes/main -d build/array-delete-survey docs/ArrayDeleteSurvey.java +``` + +PowerShell or cmd: + +```text +java -ea -Xss16m -Xmx2g -XX:ActiveProcessorCount=2 -cp "build/classes/main;build/array-delete-survey" ArrayDeleteSurvey +``` + +Bash on Unix: + +```sh +java -ea -Xss16m -Xmx2g -XX:ActiveProcessorCount=2 -cp 'build/classes/main:build/array-delete-survey' ArrayDeleteSurvey +``` + +The runner prints the output directory. It contains migrated sources, a +`results.tsv` with every deletion result, and source diagnostics for rejected +compilations. Java exceptions/assertions are recorded separately as crashes. +Adding `-Dsimple.delete.graph=true` also saves the IR and allocation dump for each +case. Quote that option in PowerShell. diff --git a/chapter33/docs/growing-array-rewrites.md b/chapter33/docs/growing-array-rewrites.md new file mode 100644 index 00000000..cd9257d3 --- /dev/null +++ b/chapter33/docs/growing-array-rewrites.md @@ -0,0 +1,259 @@ +# Growing arrays: first source rewrites + +Design notes, 2026-11-21. Writable array length and the constructor return rules +below are agreed; the parser and allocator do not implement these examples yet. +They follow the +[growing-array survey](growing-arrays-survey.md). + +The proposed rule is: `new E[]` creates an initially empty array whose growth +belongs to the allocating lexical scope. Leaving that scope ends growth, +including returning the array. Its storage can outlive that scope; its permission +to grow cannot. Element mutation remains allowed. Returning from a helper that +merely borrows someone else's builder does not end the owner's growth phase. + +## BrainFuck + +The interpreter body stays the same. The relevant old code in +[BrainFuckTest](../src/test/java/com/seaofnodes/simple/BrainFuckTest.java) is: + +```text +val output = new sys.aryu8(); +u8[] !data = new u8[100]; +// ... interpreter loop ... +output.add(data[d]); // the '.' command +// ... +return output; // a growable wrapper +``` + +Proposed replacement: + +```text +val data = new u8[100]; // fixed tape, before the growing tail +val output = new u8[]; +// ... same interpreter loop ... +output += data[d]; // the '.' command +// ... +return output; // ends this scope: result has fixed length +``` + +The caller changes from `brain_fuck().write(sys.libc.STDOUT)` to +`sys.io.write(sys.libc.STDOUT, brain_fuck())`. +`+=` appends to the existing array; it does not reassign the `val` binding. +There is no wrapper, final trim-copy, or explicit finish operation. + +The proposed whole-array constructor gives the boundary a dedicated body: + +```text +val data = new u8[100]; +val output = new u8[]{ -> + // ... interpreter; '.' does self += data[d] ... +}; // length is now fixed +sys.io.write(sys.libc.STDOUT, output); +``` + +The tape is scratch, while the output survives. Their placement still needs to +permit reclaiming scratch without invalidating the output; ending growth alone +does not establish that layout. The existing frozen BrainFuck workloads remain +useful compiler regressions and need not be rewritten with the new example. + +## Agreed constructor scope and exits + +The whole-array body executes immediately as a lexical construction scope. +It can read and write outer-scope variables, subject to their ordinary mutability +and lifetime rules. It has its own return target and result destination, as if +it were a function, but does not impose ordinary function capture restrictions. +`self` is a fixed binding to the array being constructed. + +| Within `new E[]{ -> ... }` | Meaning | +|---|---| +| Reach the closing brace | Finish growth and yield `self`, regardless of the last statement's value | +| `return self;` | Finish successfully now, skipping remaining constructor statements | +| `return null;` | Abandon construction now and yield null | +| `return anythingElse;` | Error in this context; the explicit result choices are self and null | +| `return;` | Use `return self;` for explicit successful completion | +| `break;` | Exit the innermost loop in this constructor; continue after that loop | +| `continue;` | Continue the innermost loop in this constructor | + +The nearest function-like body owns a return. A constructor-local return does +not return from the enclosing function. Conversely, returning from a helper +called by the constructor returns only from the helper. Break and continue +cannot cross the constructor boundary to a surrounding loop; without a local +loop they are errors. EOF can therefore use `break` to reach final trimming, +while a read failure uses `return null` to bypass the successful completion path. + +This fits the existing indexed generator's return scope: + +```text +new int[N]{i -> if(i==0) return 7; return i*i;} +``` + +There, `return` supplies one element and the generator proceeds to the next +index. In the zero-argument body it supplies the outcome of the whole-array +construction. A null return in a generator of nullable elements remains a null +element, not cancellation of the array. That distinction follows which body is +executing; it must not depend on whether a loop happens to surround the return. +The current indexed-generator parser rejects assignments to captured locals; +that existing implementation restriction must not be carried over to the new +whole-array construction scope. + +A whole-array body with a possible null exit has a nullable result. A body +with no possible null exit has a non-null result. This does not change +allocation-failure behavior or make every `new Foo` expression nullable. +Generalizing fallible construction to ordinary classes is a separate choice; +successful class construction would still have to satisfy initialization rules. + +Failure abandons the private construction storage, not its earlier side effects: +file bytes already read remain consumed, and writes to outer locals and external +state remain. +Cleanup must preserve errno. References into abandoned storage must not survive +its reclamation; the lifetime check includes the failure edge. + +### Other exit spellings considered + +- `self = null` with an implicit exit hides control flow in assignment; rejected. +- `self = null; break` separates the failure marker from the exit, makes self + nullable inside the body, and normally breaks only the innermost loop. Avoid it. +- `self# = -1; break` violates the valid-length invariant and overloads an unsigned + length with an error sentinel. Negative lengths remain invalid. +- `break null` could be part of a general value-producing loop/block design, but + here it needs a new target rule: does it exit the loop or the constructor? + A labeled value-break could disambiguate it, at the cost of more syntax. + +The chosen forms are `return self` / `return null`, ordinary loop breaks, and implicit +successful completion at the constructor's closing brace. No magic assignment, +negative-length sentinel, or dedicated finish keyword is required. + +## Growing and trimming with `#` + +Try extending the existing length notation rather than adding a finish keyword: + +| Expression | Proposed meaning during construction | +|---|---| +| `buf#` | Current accessible element count | +| `buf# = n` | Extend or trim the tail to checked length `n` | +| `buf# += n` | Add `n` accessible elements at the end | +| `buf# -= n` | Remove `n` elements; reject/check underflow | +| `buf += value` | Append one initialized element | + +Length changes are permitted only while the allocating scope still owns growth, +and when placement permits the tail adjustment. Exiting that scope removes the +permission through all aliases. Ordinary `new E[N]` arrays never acquire it. +Zero-length and same-length updates are legal; neither underflow nor length +overflow wraps. Even a zero-length request to change a finished array's length +uses an operation for which the growth permission is absent. + +For `u8`, extending the length gives initialized, zero-valued elements, consistent +with current array construction. That keeps the entire visible array safe to +read before the native call. A later optimization may omit initialization when +it proves the bytes are overwritten or trimmed before observation. Zero-copy +does not itself promise zero initialization cost. For inline objects without a +default initializer, increasing `#` alone cannot construct valid elements; those +arrays need append/construction into the new element destinations. + +## `io.read`: direct read into the growing tail + +The [current implementation](../src/main/smp/sys/io.smp) has three buffers over +its lifetime: a fixed 8 KiB read chunk, the builder's replacement buffers, and +the final exact-length array. Its data path is: + +```text +libc.read(fd, chunkAddress, chunk#); +buf._grow(count); +ary.copy(buf.buf, buf.len, chunk, 0, count); +buf.len += count; +// At EOF: +val out = new u8[buf.len]; +return ary.copy(out, 0, buf.buf, 0, buf.len); +``` + +Proposed replacement, including short reads, interrupts, errors, and the array +length limit: + +```text +val read = { i32 fd -> + return new u8[]{ -> + u32 used = 0; + while( true ) { + i64 room = sys.integer.MAX_U32 - used; + if( room > 8192 ) room = 8192; + + // An exactly maximum-sized stream can still end successfully. + // Only this boundary case needs a separate byte for the EOF probe. + if( room == 0 ) { + val probe = new u8[1]; + i64 ptr = probe; + i64 got = libc.read(fd, ptr, 1); + if( got < 0 ) { + if( libc.errno() == libc.EINTR ) continue; + return null; + } + if( got != 0 ) { + libc.set_errno(libc.EOVERFLOW); + return null; + } + break; + } + + self# = used + room; // space for the next block, without moving self + i64 got = 0; + { + i64 ptr = self; + got = libc.read(fd, ptr + used, room); + } // end this raw-address borrowing scope + if( got < 0 ) { + if( libc.errno() == libc.EINTR ) continue; + return null; // abort this constructor + } + if( got == 0 ) break; + used += got; // native read promises 0 <= got <= room + } + self# = used; // drop unwritten tail; no data copy + }; // implicit success: yield finished self +}; +``` + +Here `used` counts input bytes and `self#` includes the writable tail. A short read +advances `used` without shrinking on every iteration. The next length assignment +restores up to 8 KiB of free tail. EINTR leaves `used` unchanged, so retry does not +accumulate more space. EOF trims once. Empty input returns an empty array. +The one-byte limit probe preserves acceptance of a stream whose length equals +the maximum; reporting overflow before probing would wrongly reject it. On an +oversized stream this version consumes one extra byte before failing, rather +than the old implementation's possible full extra chunk. + +No regular read chunk and no final copy remain. Physical alignment or mapped-page +slack can remain after trimming; the logical result length is exactly `used`. + +## What these examples settle, and what they do not + +Floating formatting uses the same extend/fill/trim pattern as direct I/O: +remember the current length, extend by enough space for the requested format, +let a bounded C helper fill that tail and return the actual count, then trim to +the old length plus that count. This is an agreed interface direction; the helper +name and signature are not yet implemented. Any snprintf terminator needs space +in the writable tail but is excluded from the published length. No temporary +formatted-string allocation or final copy is needed. + +An arbitrary expression within interpolation is ordinary code running while an +array is growing. It must satisfy the same stack-allocation rules and leave the +growing end free for the next extension; interpolation adds no special exemption +or additional lifetime mechanism. + +Both examples have a natural end of growth, so neither needs `finish(buf)` or +`stop growing` syntax. The proposed new operation is a checked, writable `#` +while growth is allowed. Scope exit does not guess the number of bytes a native +call wrote: `io.read` must explicitly set the final length from `used`. + +The agreed placement is a parallel growable data stack, separate from the control +stack. Its top is hidden call state; the updated top returns with the finished +array. The caller's owning lifetime eventually restores the saved data-stack +mark. A contiguous reserved address range lets the array grow without moving, +subject to a checked capacity limit. This resolves the result destination without +a final copy or relocating return addresses and spills. Actual lowering is still +pending; retained inner results can still block an outer builder's growth. + +Growing a non-moving array preserves existing interior references. Trimming is +different: references into the removed tail must be gone before that storage is +reclaimed or reused. For these byte programs there are no typed interior +references, and the native borrow ends before the final trim. Future inline +objects need that restriction; non-moving alone does not make shrinking safe. diff --git a/chapter33/docs/growing-arrays-survey.md b/chapter33/docs/growing-arrays-survey.md new file mode 100644 index 00000000..13fd93d0 --- /dev/null +++ b/chapter33/docs/growing-arrays-survey.md @@ -0,0 +1,230 @@ +# Growing arrays: where grow-in-place fits + +Surveyed 2026-11-21. Most current byte builders have a single construction +phase and could finish as ordinary arrays. The persistent counterexamples are +bitsets, timers, and canvas buffers. The choice belongs to a use of a collection, +not to every instance of `aryu8` or `aryi64`. + +This is a source survey, not an implemented placement proof or a runtime profile. +It covers chapter33's Simple library, examples, Simple programs embedded in Java +tests, and retained regression workloads. Earlier chapter copies are not counted +again. Compiler Java collections appear separately as future Simple-in-Simple +requirements. No language or library behavior changed during the survey. +The [first source rewrites](growing-array-rewrites.md) show BrainFuck and direct +block reads using scope-ended growth and a proposed writable array length. + +## Construction that finishes + +“Candidate” below means growth has a recognizable end. It does not yet prove +that the physical allocation end is free, or solve returning variable-sized data. + +| Code | Observed growth and subsequent use | Grow-in-place assessment | +|---|---|---| +| [Interpolation](../src/main/java/com/seaofnodes/simple/parser/Strings.java), [text.integer/string](../src/main/smp/sys/text.smp) | Parser creates one builder, appends literal pieces and formatted expressions, then calls `end`. Integer formatting uses a fixed 22-byte digit scratch array. | Strong candidate. Fixed scratch needs placement before/beside the growing storage; formatting helpers need to borrow the active builder. Arbitrary interpolation expressions can introduce nested allocation. | +| [text.floating/time](../src/main/smp/sys/text.smp) | Both obtain a temporary string and append it to the outer builder. `floating` gets a native allocation; `time` calls another Simple formatter. | Candidate after arranging temporary storage or changing to destination-writing helpers. Not automatically one free growing end; see below. | +| [aryi64.str](../src/main/smp/sys/aryi64.smp) | Appends brackets, numbers, and separators, removes the final separator, then returns the builder. [BubbleSort](examples/BubbleSort.smp) and [StreamIOTest](../src/test/java/com/seaofnodes/simple/StreamIOTest.java) append a newline afterwards. | Construction is localized, but its present API returns a still-growable value. Prefer an append-into-destination formatter, with the caller adding the newline before finishing. | +| [parseAryI64](../src/main/smp/sys/aryi64.smp) | One scanner and one result vector; append parsed numbers, validate closing syntax, return. BubbleSort sorts the result; Dijkstra only reads it. Neither appends more numbers. | Strong candidate for a finished mutable `i64[]`. Freeze length, not element stores. Returned variable-sized storage still needs a destination. | +| [io.read](../src/main/smp/sys/io.smp) | Allocates an 8 KiB scratch chunk before starting the builder. Reads until EOF, appends each received prefix, then copies to an exact-length result. Errors discard the partial result. | Strong candidate. The scratch buffer is already separate from the growing output. Finish could avoid the final copy if the result's lifetime and placement permit it. Keep short-read/EINTR/error behavior. | +| [BrainFuckTest](../src/test/java/com/seaofnodes/simple/BrainFuckTest.java) | One output builder, one fixed 100-byte tape, no other growing collection in the interpreter. Output is consumed only after execution finishes. | Strong candidate. Place the fixed tape before the growing output, or in reserved fixed storage. Finish at interpreter exit; the current wrapper-return API needs changing or an explicit result destination. | +| [TicTacToe._draw](examples/TicTacToe.smp) | Builds one board rendering and immediately writes it. No builder escapes. | Simplest local candidate. This particular rendering is exactly 60 bytes, so a fixed array also suffices. | +| [FileIO](examples/FileIO.smp), [Dijkstra's diagnostic output](examples/Dijkstra.smp) | FileIO builds its message before opening/writing/reading the file, then compares it with the readback. Diagnostics build and write once. | Finish FileIO's message before later I/O allocations; its storage remains live for comparison. The literal message can also be sized exactly. Diagnostics are local builders. | +| [time._format/elapsed/zoneName](../src/main/smp/sys/time.smp) | Formatters build and finish one result. `zoneName` first fills a fixed 128-byte buffer, learns `n`, then builds another buffer and copies again in `text.end`. | `_format`/`elapsed` are localized builders. `zoneName` needs no growing array: after the native call, allocate exactly `n` bytes and copy once. All returned results retain the destination question. | + +The [original BrainFuck workload](../src/test/java/com/seaofnodes/simple/spill/BrainFuckTest-testBrainFuck.smp) +does `new u8[output# + 1]` and copies the old output on every `.` command. +For N emitted bytes that copies N(N-1)/2 old bytes, in addition to writing the +N new bytes. It is the clearest avoidable-copy example. The aryu8 version already +uses geometric growth. Keep the historical workload if its purpose remains +cross-target compiler comparison; add a new builder version alongside it. + +## Growth interleaved with continued use + +The production Simple library has five implementations that replace backing +arrays to increase capacity: `aryu8`, `aryi64`, `bitset`, `Timers`, and `Canvas`. +Timers replaces three arrays together. The first two support the construction +cases above; the other three illustrate why we still need another storage choice. + +| Code | Why a single temporary construction scope is insufficient | Suitable direction | +|---|---|---| +| [adt.bitset](../src/main/smp/sys/adt/bitset.smp) | Random indexed `set`/`tset` can increase capacity between reads, clears, and other work. | General instance: retain a replaceable backing array or use chunks. [Dijkstra](examples/Dijkstra.smp) knows the bit universe from `nodes`, so reserve `(nodes+63)/64` words before its loop instead. | +| [time.Timers](../src/main/smp/sys/time/Timers.smp) | IDs, deadlines, and periods grow together; registration, cancellation, and polling interleave. [TimeTest](../src/test/java/com/seaofnodes/simple/TimeTest.java) forces growth past eight slots. Clock itself registers only one timer. | A mini-arena owned by the Timers instance can hold replacement arrays. Alternatively, fixed chunks of inline timer entries would avoid copying and exercise value objects; that is a representation change, not just append syntax. Three independent arrays cannot all own one contiguous growing end. | +| [draw.Canvas.resize](../src/main/smp/sys/draw/Canvas.smp) | Capacity increases across window events, interleaved with drawing, timers, and text formatting. Smaller sizes reuse capacity. On growth the old pixels are discarded, not copied. | Retain replacement-buffer behavior in the Canvas lifetime group. A deliberately reserved non-moving region is plausible for a small number of windows, but should be an explicit choice. Chunking pixels directly would change the contiguous graphics interface. | + +The generic aryu8 API also permits `clear`, `undo`, reads, and later appends. +[StreamIOTest](../src/test/java/com/seaofnodes/simple/StreamIOTest.java) exercises +that mutable-container behavior. The small `_Vec` in +[Chapter21Test.testArmVectorGrowth](../src/test/java/com/seaofnodes/simple/Chapter21Test.java) +is another explicit doubling/copy implementation outside sys. Its particular +caller builds five integers in one expression; the generic type allows later +growth. The frozen BubbleSort and seed-reproduction sources contain older copies +of the same byte/integer vector pattern. + +## Two constraints exposed by the survey + +### Explicit containers for interleaved growth + +Discussion direction: infer one active growing end, with properly nested +temporary work allowed. If multiple live arrays need interleaved extension at +that end, reject with a concrete rewrite path. Do not automatically synthesize +independent regions or a general collector to preserve the source representation. + +A proposed diagnostic at the failed extension: + +```text +Cannot extend 'ids' here: live storage for 'due_ms' follows it. + 'ids' starts growing at ... + 'due_ms' is allocated at ... and is still needed at ... +Use one array of inline timer entries, or explicit resizable containers +such as aryu32 and aryi64 for independently growing buffers. +``` + +This diagnoses unavailable tail space while growth is still permitted. Trying +to grow an array whose constructor has already ended instead reports that its +length is fixed, with the constructor boundary and the attempted growth shown. + +For Timers the programmer can choose either representation: + +- Array of inline Timer entries containing id, due, and period, with explicit + resize logic. Under the previously agreed notation this is `new *Timer[8]` + (with appropriate element initialization), rather than an array of Timer + references. No per-entry object allocation or pointer chase is required; + padding and field-scan locality can still differ from struct-of-arrays. +- Keep the struct-of-arrays layout, using three explicit container instances: + one aryu32 and two aryi64 collections. These containers need not own the + shared stack's growing end. + +Agreed allocator direction: growable containers use power-of-two backing arrays +and deleted backing arrays are recycled through a buddy allocator. Resize obtains +a larger chunk, copies the used elements, publishes the replacement, and calls +`old.del()` to retire the old backing allocation. This moving representation +does not promise stable +direct interior references through resize. Container/index handles and copied +primitive/reference values remain useful interfaces. + +Agreed safety rule: a deletable array has a different type from an ordinary +array; its provisional modifier is `^`. It disallows interior references and +requires unique access and no escaping aliases. Deletion consumes the owning +access, with no outstanding borrows or other usable aliases surviving it. +The compiler checks this rule; it is not an unchecked promise by the library. +Copied primitive elements and copied object references are not references into +the backing storage. Container/index handles can resolve through the current +buffer without retaining the retired one. + +In resize, replacing the container's backing field removes that owning access +to the old buffer; the local `old` then supplies the access consumed by delete. +If another usable alias remains, diagnose that alias and the attempted deletion. +Ordinary arrays retain their automatic-lifetime behavior and cannot be deleted. +Raw-address borrowing must also respect the no-surviving-use requirement. + +This differs from deletable class slots, whose stale references remain type-safe. +Buddy splitting/coalescing can change the array extent and layout. An old array +header can become element data after reuse, so even bounds checks can read the +wrong length. Merely preserving the element type is not enough to inherit the +class-slot post-delete guarantees. The agreed uniqueness rule excludes those +stale accesses, allowing the buddy allocator to recycle the whole block. +Moving the length field out of the allocation is therefore not needed for this +safety argument; it remains a separate, useful layout optimization. +The same buddy allocator can serve every element type and keep metadata inside +freed blocks. Automatic deletion on a proven last-reference overwrite is deferred; +the first interface uses explicit `.del()`. The +[first ownership experiment](../README.md#array-deletion-first-ownership-checks) +now accepts source `E[^]` and `.del()` and checks local aliases and field kills. +The [migration survey](array-delete-survey.md) records which real resize bodies +pass these local checks and which proof obligations remain. The runtime +intrinsic is not implemented yet. + +`text.begin()` currently returns a newly created builder. For the proposed +scope-owned growing array, interpolation should establish that storage in the +expression's owning scope, then let helpers borrow it. Keeping `begin()` unchanged +and hoping the inliner erases its call would make a language lifetime rule depend +on optimization. The same issue applies to factories returning fresh growable +wrappers; it is separate from a helper appending to an existing destination. + +One logical builder does not imply one free physical end. For example, +[Clock._draw](examples/Clock.smp) interpolates `sys.time.formatLocal(...)` into +an outer string. The outer builder is started before that expression is evaluated. +The inner formatter returns its finished array, then the outer builder grows +while reading that array. With both on the same growing end, the inner result +still occupies the space the outer wants. This is not the easy nested case where +the child has unwound before the parent resumes growing. + +Agreed follow-up: append time formatting directly into a supplied destination. +For floating formatting, pre-grow the destination by a sufficient bound, pass +the writable tail and its capacity to the C helper, and receive the actual byte +count. Trim the unused tail afterwards. The helper fills the destination directly; +it does not allocate a returned string or copy from an intermediate output array. +The bound must account for the value, format, width, precision, and any terminating +NUL needed by the C implementation. The NUL is not part of the final string length. +The existing [simple_text_float](../src/main/c/simple_crt.c) still allocates; +changing it to this interface remains implementation work. + +Arbitrary interpolation expressions follow the ordinary rules for code executing +inside any growable-array constructor. Their allocation/lifetime plan must leave +the required growing end free when extension resumes. If no legal plan exists, +the normal allocation analysis rejects the program. There is no separate +interpolation allocation rule. Helpers growing a caller's destination likewise +use the general call-frame placement rules. + +The agreed return destination is now a separate growable data stack. `io.read`, +parsed number arrays, formatted strings, and BrainFuck results finish growth +before returning; their bytes survive the callee's control frame. The hidden +data-stack top is updated on return, and the owning lifetime later restores its +mark. This supplies contiguous non-moving storage without a final copy; lowering +and the calling convention remain implementation work. + +## Aliases and future inline elements + +Backing-array references are already observable, even without interior pointers: + +- `aryi64` accepts a caller-provided backing array; it need not own the only reference. +- `buf`/`pixels` are exposed. StreamIOTest saves `b.buf`; DrawTest saves old and + grown pixel arrays and checks reuse when resizing within capacity. +- `text.end(b)` currently copies into a read-only array and leaves `b` usable. + A consuming finish operation changes that contract. Existing callers that are + done with `b` can migrate; the general API cannot silently change meaning. +- `aryi64.str()` callers demonstrably continue growing the returned value. + +A mini-arena makes its allocated blocks stationary. It does not make a vector +stationary if the vector later copies its contents into a larger block. An +array of future inline objects can promise stable direct interior references +only with the non-moving choice; those references also inherit the backing +storage's lifetime. Movable containers can expose values or `(container,index)` +handles instead. Truncating/clearing and reusing inline slots will need its own +reference-validity rule, even when the storage address stays fixed. + +Old backing arrays cannot be recycled merely because the wrapper now points to +a new array: another reference may still name the old one. Retaining all blocks +until the lifetime group unwinds is the simple safe policy. Earlier recycling +needs proof that those references are gone. Allocator chunk recycling here is +distinct from the language's explicit `delete` and its weaker post-delete rules. + +## Compiler collections: future Simple-in-Simple cases + +| Existing Java use | Storage implication | +|---|---| +| [Node inputs/outputs](../src/main/java/com/seaofnodes/simple/node/Node.java), backed by [Ary](../src/main/java/com/seaofnodes/simple/util/Ary.java) | Many independently growing collections, mutated throughout optimization. Embedded small vectors plus overflow storage fit; one reserved growing region per Node does not. Entries currently hold references, not inline Nodes. | +| [CodeGen linker/call/CFG lists](../src/main/java/com/seaofnodes/simple/codegen/CodeGen.java) | Broad lifetimes, but several lists grow interleaved. Being long-lived does not alone make their ends free. Separate explicit areas or a common chunk allocator are options. | +| [Serialize.write](../src/main/java/com/seaofnodes/simple/codegen/Serialize.java), [Lexer.stringPart](../src/main/java/com/seaofnodes/simple/parser/Lexer.java) | Local output accumulation followed by a completed byte result. Candidates for finishable builders, subject to helper temporaries and the return destination. | +| [Encoding](../src/main/java/com/seaofnodes/simple/codegen/Encoding.java), [BAOS](../src/main/java/com/seaofnodes/simple/util/BAOS.java) | Instruction bytes, constant data, and writable data have separate buffers; emission also creates metadata, patches earlier bytes, and can replace the instruction buffer during compaction. This needs an explicit layout plan or independent buffers, not blanket conversion of BAOS. | +| [IntHashMap](../src/main/java/com/seaofnodes/simple/util/IntHashMap.java) | Growth rehashes entries. Reserving more address space does not remove that semantic relocation. A future inline-entry reference cannot promise stability through rehash. | + +The native MiniFB adapter has a separate resizable repaint buffer in +[simple_minifb.c](../src/main/c/simple_minifb.c). It copies the Simple pixels; +the retained native buffer is not a retained pointer into the Simple array. + +## Suggested first cases + +1. BrainFuck output: one unknown-length append stream, fixed scratch, finish; + first consume it within the same activation to isolate growth from return placement. +2. `io.read`: chunked input, error unwind, and a finished variable-sized result. +3. Integer/string interpolation, then nested time formatting: borrowed builder + helpers, fixed scratch, and the first real competing-temporary case. +4. Timers: persistent growth and three coupled arrays; compare grouped replacement + buffers with chunks of inline entries rather than forcing it into the first case. + +Some current variable-size failures are not growing arrays at all: `str0`, +`Canvas` construction, and `text.end` know their length when they allocate. +Supporting runtime-sized fixed arrays is independently useful. This survey does +not predict a new accepted-function count: the current pass also rejects loop +retention, returned variable-sized storage, and recursive Timers._add before +these proposed storage representations exist. diff --git a/chapter33/docs/ownership-analysis-architecture-review.md b/chapter33/docs/ownership-analysis-architecture-review.md new file mode 100644 index 00000000..e804d4b0 --- /dev/null +++ b/chapter33/docs/ownership-analysis-architecture-review.md @@ -0,0 +1,79 @@ +# Ownership analysis architecture review + +2026-11-23. + +I agree with the broad assessment. Native effects and the Timer rewrite can wait; neither needs to drive this redesign. + +After reading the implementation, I think the main problem is that we discard information in one analysis and reconstruct it in another. Better terminology would help expose that, but we also need clearer boundaries between the questions being answered. + +I would describe the task as: points-to analysis and reference liveness, feeding region inference and checks for safe storage reuse. Alias analysis supplies much of the evidence, but cannot by itself determine when storage can be reclaimed. + +Your solution space looks right, with these additional proof obligations: + +| Storage choice | What must be established | +|---|---| +| Fixed storage reserved in the current or an enclosing frame | Size, sufficient slots for simultaneously needed objects, and a frame lifetime covering every permitted access | +| Dynamically sized storage at a growing stack tip | Lifetime compatibility and an allocation order compatible with contiguous growth and stack reclamation | +| Recycled non-array object slots | Type-safe reuse while old aliases remain valid; backing storage must still outlive those aliases | +| Recycled arrays | No usable access to the old array survives deletion | +| Require a rewrite | The available analysis cannot establish a supported storage arrangement | + +Two additions matter here. Fixed object size does not imply fixed storage demand: one allocation site can produce arbitrarily many simultaneously needed objects. And dynamically sized storage need not have a compile-time size bound, but growth still has ordering constraints—a retained inner allocation can obstruct an outer growing array. + +The first two choices fit the established subject of region inference: infer storage regions and prove that their reclamation respects accesses. Tofte and Talpin give a formal foundation for that separation between lifetime reasoning and runtime regions. [Region-Based Memory Management](https://ropas.snu.ac.kr/lib/dock/ToTa1997.pdf) + +The terminology I would use for our current machinery is: + +| Current concept | Established terminology | +|---|---| +| Possible reference “origins” | Points-to sets over abstract objects | +| `arg3.c` | An access path rooted at a formal parameter | +| Union of everything stored into a field | A flow-insensitive may-points-to relation | +| Following field contents at a memory version | Flow-sensitive points-to analysis | +| Forgetting a field’s previous contents after a definite overwrite | Strong update | +| Retaining both previous and newly stored possibilities | Weak update | +| Substituting arguments and allocations at a call | Instantiation of a procedure summary | +| Proving no usable alias survives | A lifetime/deallocation proof using alias and liveness information | + +These distinctions are standard in pointer analysis; in particular, flow sensitivity determines whether facts distinguish program points. [Cornell’s pointer-analysis notes](https://www.cs.cornell.edu/courses/cs4120/2026sp/notes.html?id=pointer) + +One especially important distinction: strong updates do not require that an object have only one pointer to it. They require that the analysis establish which concrete storage cell is overwritten. Several aliases can all observe that same overwrite. Conversely, a points-to set containing one abstract allocation-site node may represent many concrete objects, so “set size one” alone does not justify a strong update. This is exactly the problem addressed by work on allocation-site abstractions and recency abstractions. [Balakrishnan and Reps](https://research.cs.wisc.edu/wpis/papers/sas06-recency.pdf) + +That distinction should help us avoid making “unique” stand for several different properties. + +The clearest architectural issue is visible in a tiny example: + +```text +old = v.buf; +v.buf = next; +old.del(); +``` + +`Allocation` accumulates both buffers in the field’s possible contents. `ArrayDelete` then follows memory SSA to recover that the field no longer contains `old`. Calls and loops require additional machinery because their summaries have also merged facts from different times. + +The code currently has two reference representations, `Site` and `Ref`, two reference-resolution mechanisms, and two forms of call substitution. Their purposes differ, but the overlap is substantial. `arrayOwned`, outgoing call versions, and loop-entry versions bridge the difference between the representations. + +My inference is that this mismatch accounts for a substantial part of the special cases. + +I would move toward one account of how references and memory change, with separate consumers for placement and deletion. A procedure summary should describe a transformation from incoming memory to outgoing memory, including: + +- Possible returned references and newly allocated objects. +- Fields that may change, and fields definitely overwritten. +- Storage that may be consumed. +- Preconditions and guarantees needed for those operations. + +For `grow(v)`, the useful contract is approximately: the incoming buffer may be consumed; the outgoing buffer is valid; aliases that could access a consumed buffer must not remain usable. The outgoing buffer may be the incoming buffer on the no-growth path. Giving it a new analysis name must not imply that it is a physically distinct allocation. + +That is also where ideas from separation logic are useful: explicit preconditions, postconditions, and reasoning about the portion of memory a procedure affects. We need not adopt a full separation-logic prover to benefit from those distinctions. [Reynolds](https://www.cs.cmu.edu/~jcr/seplogic.pdf) + +A second addition to your assessment is that “no aliases” is stronger than the property we ultimately need. An unused local can still contain the old pointer. A field can contain it if the field is definitely overwritten before any subsequent read. The safety question is whether a future execution can use that reference to access reclaimed storage. + +That introduces reference liveness alongside points-to information. A conservative first implementation can reject whenever it finds a surviving reference, but the architecture should make clear that this is an approximation. Otherwise every improvement in recognizing dead aliases becomes another ownership exception. + +The non-array deletion semantics deserve a separate, explicit rule. Because old references remain usable, deleting an object does not end the lifetime of its backing slot. It makes the slot eligible for reuse under the language’s historical-value rules. References recoverable from those permitted historical values also retain lifetime obligations. Arrays instead require the proof that old access has ended before recycling. Both can use the same alias information, but their reuse conditions are fundamentally different. + +Finally, loops need a stated abstraction for repeated allocations. One abstract object per allocation site conflates successive objects. Our loop versions are already attempting to recover that distinction. Recency abstraction—separating the most recent object from older objects—is a relevant established option, though we should evaluate whether it fits our cases rather than adopt it automatically. + +I would start the redesign with a small abstract semantics: what an abstract object denotes, what information a memory state contains, the rules for loads/stores/calls/joins, and the exact conditions for reclamation and reuse. Then work the existing two-grow and loop-winner examples through those rules by hand. + +The simplification target is that initializers, ordinary helpers, consecutive grows, and loop iterations follow those same rules. That would give us a theoretical explanation for accepted programs, and a precise description of where our chosen approximation requires the user to rewrite. |
