census by owner (25.5c): which state holds what, and how much it grew
The escape analysis now follows which state a kept value is stored into (a state parameter, a state global - each its own class - through the flows to and from it), and every heap site in the fence's table carries that owner. The census writes, per owning state, what its sites hold and how much that grew since judging began: 'owner NotesState holds 6400 (+5600 since judging began)'. A keep() or intern() is a site of its own for this, never scratch and never reported as a keep or a birth. It needs the analysis, so the arena's (or --escape-report's) build; this is what a soak watches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b87ee96805
commit
a6364199da
5 changed files with 71792 additions and 68451 deletions
|
|
@ -93,6 +93,7 @@ function emit_fence_globals() -> void {
|
|||
emith("@.lpf_exitscan = private unnamed_addr constant [15 x i8] c\"R3D_ALLOC_EXIT\\00\"\n")
|
||||
emith("@.lpf_shdr = private unnamed_addr constant [116 x i8] c\"alloc-scan: frame %lld - %lld bytes in %lld blocks made since tracking began are reachable from no global or state\\0A\\00\"\n")
|
||||
emith("@.lpf_srow = private unnamed_addr constant [25 x i8] c\" %lld B %s %s:%d %s\\0A\\00\"\n")
|
||||
emith("@.lpf_cown = private unnamed_addr constant [49 x i8] c\"owner %s holds %lld (%+lld since judging began)\\0A\\00\"\n")
|
||||
emith("@.lpf_failing = private unnamed_addr constant [53 x i8] c\"alloc-fence: failing the run (R3D_ALLOC_FENCE=fail)\\0A\\00\"\n")
|
||||
emith("@.lpf_census = private unnamed_addr constant [17 x i8] c\"R3D_ALLOC_CENSUS\\00\"\n")
|
||||
emith("@.lpf_warmmax = private unnamed_addr constant [19 x i8] c\"R3D_ALLOC_WARM_MAX\\00\"\n")
|
||||
|
|
@ -1097,6 +1098,7 @@ function emit_fence_report() -> void {
|
|||
emith(" call i32 (ptr, ptr, ...) @fprintf(ptr %fp, ptr @.lpf_cvk, i64 %vd1, i64 %vpk)\n")
|
||||
emith(" %sn = load i32, ptr @lp_site_n\n")
|
||||
emith(" call void @lp_franked(ptr %fp, ptr @lp_site_base, i1 1, i32 %sn, i32 40)\n")
|
||||
emith(" call void @lp_fowners(ptr %fp)\n")
|
||||
emith(" call i32 @fclose(ptr %fp)\n")
|
||||
emith(" br label %out\n")
|
||||
emith("out:\n")
|
||||
|
|
@ -1429,6 +1431,56 @@ function emit_fence_frame() -> void {
|
|||
emith(" call void @lp_funlock()\n")
|
||||
emith(" ret i64 %lost\n")
|
||||
emith("}\n")
|
||||
emith("; 25.5c: the census by owner - what each state holds of what its sites made, and how much it grew\n")
|
||||
emith("define internal void @lp_fowners(ptr %fp) {\n")
|
||||
emith("entry:\n")
|
||||
emith(" %no = load i32, ptr @lp_nowners\n")
|
||||
emith(" %sn = load i32, ptr @lp_site_n\n")
|
||||
emith(" br label %ol\n")
|
||||
emith("ol:\n")
|
||||
emith(" %o = phi i32 [ 1, %entry ], [ %o1, %onext ]\n")
|
||||
emith(" %ogo = icmp ule i32 %o, %no\n")
|
||||
emith(" br i1 %ogo, label %sl0, label %done\n")
|
||||
emith("sl0:\n")
|
||||
emith(" br label %sl\n")
|
||||
emith("sl:\n")
|
||||
emith(" %s = phi i32 [ 0, %sl0 ], [ %s1, %snext ]\n")
|
||||
emith(" %live = phi i64 [ 0, %sl0 ], [ %live2, %snext ]\n")
|
||||
emith(" %grew = phi i64 [ 0, %sl0 ], [ %grew2, %snext ]\n")
|
||||
emith(" %sgo = icmp ult i32 %s, %sn\n")
|
||||
emith(" br i1 %sgo, label %sb, label %say\n")
|
||||
emith("sb:\n")
|
||||
emith(" %op = getelementptr inbounds i32, ptr @lp_site_owner, i32 %s\n")
|
||||
emith(" %ow = load i32, ptr %op\n")
|
||||
emith(" %mine = icmp eq i32 %ow, %o\n")
|
||||
emith(" %lp = getelementptr inbounds i64, ptr @lp_site_live, i32 %s\n")
|
||||
emith(" %lv = load i64, ptr %lp\n")
|
||||
emith(" %bp = getelementptr inbounds i64, ptr @lp_site_base, i32 %s\n")
|
||||
emith(" %bv = load i64, ptr %bp\n")
|
||||
emith(" %d = sub i64 %lv, %bv\n")
|
||||
emith(" %la = select i1 %mine, i64 %lv, i64 0\n")
|
||||
emith(" %da = select i1 %mine, i64 %d, i64 0\n")
|
||||
emith(" %live2 = add i64 %live, %la\n")
|
||||
emith(" %grew2 = add i64 %grew, %da\n")
|
||||
emith(" br label %snext\n")
|
||||
emith("snext:\n")
|
||||
emith(" %s1 = add i32 %s, 1\n")
|
||||
emith(" br label %sl\n")
|
||||
emith("say:\n")
|
||||
emith(" %any = icmp ne i64 %live, 0\n")
|
||||
emith(" br i1 %any, label %print, label %onext\n")
|
||||
emith("print:\n")
|
||||
emith(" %oi = sub i32 %o, 1\n")
|
||||
emith(" %np = getelementptr inbounds ptr, ptr @lp_owner_name, i32 %oi\n")
|
||||
emith(" %nm = load ptr, ptr %np\n")
|
||||
emith(" call i32 (ptr, ptr, ...) @fprintf(ptr %fp, ptr @.lpf_cown, ptr %nm, i64 %live, i64 %grew)\n")
|
||||
emith(" br label %onext\n")
|
||||
emith("onext:\n")
|
||||
emith(" %o1 = add i32 %o, 1\n")
|
||||
emith(" br label %ol\n")
|
||||
emith("done:\n")
|
||||
emith(" ret void\n")
|
||||
emith("}\n")
|
||||
emith("define internal void @lp_fsettle_locked() {\n")
|
||||
emith("entry:\n")
|
||||
emith(" %n = load i32, ptr @lp_site_n\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue