capacities (25.5a): @max(n) on a list field, and a full table is a failure
'@max(64) boxes: []Box' on a property's or a state's field is a promise: the grow path of a push to
that field (only the grow path, so nothing is paid until it doubles) checks it, and growing past n is
reported by the fence - 'PoolState.boxes grew past its @max(16) (it holds 16)' - counted under
count, said under warn, and under fail (a headless or dev build's default) the run ends with exit 87.
Mem.over("what") is the same for a package's own table: ludic.base's StrTable past its most
(sb_intern) and ludic.ui's memo past three quarters of MM_CAP no longer quietly copy per call. The
census counts overflows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
69d1db06a5
commit
6fb5118afd
8 changed files with 73094 additions and 71750 deletions
|
|
@ -50,6 +50,7 @@ function emit_fence_globals() -> void {
|
|||
emith("@lp_fkept = global i64 0\n")
|
||||
emith("@lp_fbad = global i64 0\n")
|
||||
emith("@lp_fjudged = global i64 0\n")
|
||||
emith("@lp_capn = global i64 0\n")
|
||||
emith("@lp_zset = global i64 0\n")
|
||||
emith("@lp_jset = global i64 0\n")
|
||||
emith("@lp_vset = global i64 0\n")
|
||||
|
|
@ -73,11 +74,14 @@ function emit_fence_globals() -> void {
|
|||
emith("@.lpf_hdr = private unnamed_addr constant [62 x i8] c\"alloc-fence: frame %lld kept %+lld B (%lld made, %lld freed)\\0A\\00\"\n")
|
||||
emith("@.lpf_row = private unnamed_addr constant [26 x i8] c\" %+lld B %s %s:%d %s\\0A\\00\"\n")
|
||||
emith("@.lpf_more = private unnamed_addr constant [21 x i8] c\" ... and %lld more\\0A\\00\"\n")
|
||||
emith("@.lpf_full = private unnamed_addr constant [99 x i8] c\"alloc-fence: the table is full (%lld blocks) - raise R3D_ALLOC_TABLE; from here it judges nothing\\0A\\00\"\n")
|
||||
emith("@.lpf_full = private unnamed_addr constant [71 x i8] c\"alloc-fence: %s is full - it stops keeping and makes a copy each time\\0A\\00\"\n")
|
||||
emith("@.lpf_arena = private unnamed_addr constant [10 x i8] c\"R3D_ARENA\\00\"\n")
|
||||
emith("@.lpf_arenamb = private unnamed_addr constant [13 x i8] c\"R3D_ARENA_MB\\00\"\n")
|
||||
emith("@.lpf_archeck = private unnamed_addr constant [16 x i8] c\"R3D_ARENA_CHECK\\00\"\n")
|
||||
emith("@.lpf_car = private unnamed_addr constant [61 x i8] c\"arena %lld %lld (each frame arena's high-water mark, bytes)\\0A\\00\"\n")
|
||||
emith("@.lpf_capover = private unnamed_addr constant [54 x i8] c\"alloc-fence: %s grew past its @max(%d) (it holds %d)\\0A\\00\"\n")
|
||||
emith("@.lpf_capfail = private unnamed_addr constant [78 x i8] c\"alloc-fence: failing the run (R3D_ALLOC_FENCE=fail): a capacity is a promise\\0A\\00\"\n")
|
||||
emith("@.lpf_ccap = private unnamed_addr constant [56 x i8] c\"overflows %lld (a list past its @max, or a table full)\\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")
|
||||
|
|
@ -1064,6 +1068,8 @@ function emit_fence_report() -> void {
|
|||
emith(" %ddc = sub i64 %dnow, %dset\n")
|
||||
emith(" %ddc1 = select i1 %jq, i64 %ddc, i64 0\n")
|
||||
emith(" call i32 (ptr, ptr, ...) @fprintf(ptr %fp, ptr @.lpf_cdecl, i64 %ddc1)\n")
|
||||
emith(" %capn = load i64, ptr @lp_capn\n")
|
||||
emith(" call i32 (ptr, ptr, ...) @fprintf(ptr %fp, ptr @.lpf_ccap, i64 %capn)\n")
|
||||
emith(" %ah0 = load i64, ptr @lp_ar_hw0\n")
|
||||
emith(" %ah1 = load i64, ptr @lp_ar_hw1\n")
|
||||
emith(" call i32 (ptr, ptr, ...) @fprintf(ptr %fp, ptr @.lpf_car, i64 %ah0, i64 %ah1)\n")
|
||||
|
|
@ -1135,6 +1141,39 @@ function emit_fence_frame() -> void {
|
|||
emith(" %v = call i64 %f()\n")
|
||||
emith(" ret i64 %v\n")
|
||||
emith("}\n")
|
||||
emith("; 25.5a: a list declared @max(n) grew past n, or a package's table filled (Mem.over): said under\n")
|
||||
emith("; warn, and under fail the run ends with exit 87 - silent when the fence is off\n")
|
||||
emith("define void @lp_cap_over(ptr %name, i32 %cap, i32 %len) {\n")
|
||||
emith("entry:\n")
|
||||
emith(" call void @lp_finit()\n")
|
||||
emith(" %m = load i8, ptr @lp_fm\n")
|
||||
emith(" %off = icmp ule i8 %m, 1\n")
|
||||
emith(" br i1 %off, label %out, label %count\n")
|
||||
emith("count:\n")
|
||||
emith(" %c = load i64, ptr @lp_capn\n")
|
||||
emith(" %c1 = add i64 %c, 1\n")
|
||||
emith(" store i64 %c1, ptr @lp_capn\n")
|
||||
emith(" %say = icmp uge i8 %m, 3\n")
|
||||
emith(" br i1 %say, label %which, label %out\n")
|
||||
emith("which:\n")
|
||||
emith(" %isfull = icmp eq i32 %cap, 0\n")
|
||||
emith(" br i1 %isfull, label %full, label %over\n")
|
||||
emith("full:\n")
|
||||
emith(" call i32 (i32, ptr, ...) @dprintf(i32 2, ptr @.lpf_full, ptr %name)\n")
|
||||
emith(" br label %judge\n")
|
||||
emith("over:\n")
|
||||
emith(" call i32 (i32, ptr, ...) @dprintf(i32 2, ptr @.lpf_capover, ptr %name, i32 %cap, i32 %len)\n")
|
||||
emith(" br label %judge\n")
|
||||
emith("judge:\n")
|
||||
emith(" %fail = icmp eq i8 %m, 4\n")
|
||||
emith(" br i1 %fail, label %die, label %out\n")
|
||||
emith("die:\n")
|
||||
emith(" call i32 (i32, ptr, ...) @dprintf(i32 2, ptr @.lpf_capfail)\n")
|
||||
emith(" call void @exit(i32 87)\n")
|
||||
emith(" unreachable\n")
|
||||
emith("out:\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")
|
||||
|
|
@ -1313,6 +1352,10 @@ function emit_fence_win() -> void {
|
|||
emith("entry:\n")
|
||||
emith(" ret i64 0\n")
|
||||
emith("}\n")
|
||||
emith("define void @lp_cap_over(ptr %name, i32 %cap, i32 %len) {\n")
|
||||
emith("entry:\n")
|
||||
emith(" ret void\n")
|
||||
emith("}\n")
|
||||
}
|
||||
function emit_fence_intern() -> void {
|
||||
emith("@lp_itab = global [65536 x ptr] zeroinitializer\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue