diff options
| author | Cliff Click <cliffc@acm.org> | 2026-11-30 10:43:11 -0800 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-11-30 10:43:11 -0800 |
| commit | d9a46e588fe09ed58e160778b0d8dcee62d4d0e4 (patch) | |
| tree | 80fdd9e8294636c0e666fa52db7cac4a9b8c8d01 /chapter33/docs/ArrayDeleteSurvey.java | |
| parent | c37676fc0c04997f51f4659848570619f68ac10d (diff) | |
| download | Simple-d9a46e588fe09ed58e160778b0d8dcee62d4d0e4.tar.gz Simple-d9a46e588fe09ed58e160778b0d8dcee62d4d0e4.zip | |
Checkpoint Allocation2 before separate-compilation redesignch33
Replace the legacy allocation planner, deletion proof engine, and independent
FunctionEffects pass with Allocation2 as the sole allocation-analysis phase.
Keep one Site per optimized allocation/static object, per-site weak field facts,
dependency-driven escape propagation, incoming-edge counts, and points-to dumps.
Move the shared node WorkList into util.
Normalize Never exits before allocation analysis and TypeCheck while preserving
semantic nonreturning summaries. Keep internal class-init call dependencies out
of global escapes, sharpen hidden private-memory defaults, refresh singleton
constant escape sets after type closure, and publish field-local escape facts.
Detach unloaded summary wrappers from scheduling roots. Retain declaration
metadata and optimized return states in C0DA objects without legacy contracts.
Keep qualified forward type names separate from expression member access,
allow peepholes to return dead self, and retain the supporting regressions.
Use integer types for symbolic field offsets and Opto-high uninitialized fields.
Make Breakout's debounce helper private.
Remove disabled escape implementations, obsolete null assertions, duplicate
graphics compilation, survey runners/results, investigation transcripts, and
source archives. Consolidate the selected ownership, lifetime, storage, deletion,
and growing-array designs with their rationale/examples and academic references.
Replace the obsolete Chapter33 handoff in the AI notes with current guidance.
This is an unfinished analysis checkpoint. Imported pointer identities,
transitive escapes, intrinsic calls, construction checks, and cofinite-summary
universe rebasing still need work. Import loading order is unchanged.
Validation: main/test compilation and git diff --check pass. Before/after
make -k -j8 tests_nographics both report 825 executions and 78 failures, with
unchanged extracted failure names; all lattice shards pass. Chapter33 retains
its three failing deletion/imported-identity/transitive-escape regressions.
Diffstat (limited to 'chapter33/docs/ArrayDeleteSurvey.java')
| -rw-r--r-- | chapter33/docs/ArrayDeleteSurvey.java | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/chapter33/docs/ArrayDeleteSurvey.java b/chapter33/docs/ArrayDeleteSurvey.java deleted file mode 100644 index 7e549048..00000000 --- a/chapter33/docs/ArrayDeleteSurvey.java +++ /dev/null @@ -1,107 +0,0 @@ -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")); - } -} |
