selfhost/cmd/wcc + lib/strings: restore SSoT routing for str/slice tinfo helpers
Phase A.5's tupleelemslot / fieldslotsize hardcoded 16u64 for TY_STR and 24u64 for TY_SLICE — bypassing the tinfo.size SSoT seeded by lib/ww/typ.ww:189 (the very pivot they were introduced to consult). Route those four arms through pt.size / ft.size so #1 (str→24) and #34 (slice graduation) land as a one-line bump at the seed. lib/strings/stringstest.ww carried 12 `(cap: u64) * 16u64` strides missed by #43's sweep over strings.ww + shlex.ww; convert to `* size(str): u64` so the #42 fold owns the constant. Doc comments in strings.ww (freeall + splitn) updated to the same SSoT form. No-op at today's str.size=16 / slice=24: tinfo.size already matches the literals these arms had baked in. Reviewer's pre/post asm-identity probe (struct{i64,str,i64} + (i32,str,i32) tuple + bare str) shows zero-byte diff. 131/131 + 994 + 995 + bootstrap (ww2==ww3==ww4) green. Forward-link to #1 (str→24B bump) and #64 (sizelint pre-commit gate); #65 filed for lib/bytes + lib/getopt sibling sites the reviewer surfaced. Forward of #64 will catch any future regressions of this class.
This commit is contained in:
@@ -148,8 +148,9 @@ export fn dupall(s: []str) ([]str | nomem) = {
|
||||
//
|
||||
// Empty elements (`{nil, 0}` from a zero-length dup) are skipped:
|
||||
// os.free on a nil pointer at len 0 tickles the rt_free guard. The
|
||||
// slice header itself is freed at `cap * 16` (one str = 16B); a
|
||||
// never-grown slice (cap == 0) skips the header free.
|
||||
// slice header itself is freed at `cap * size(str)` — the literal
|
||||
// would drift under #1's str-layout bump, so route through the
|
||||
// typ.ww SSoT. A never-grown slice (cap == 0) skips the header free.
|
||||
export fn freeall(s: []str) void = {
|
||||
let i: i32 = 0;
|
||||
for (i < s.len) {
|
||||
@@ -774,7 +775,7 @@ fn appendstr(slice: *[]str, item: str) void = {
|
||||
// within the result are borrowed from `in`.
|
||||
//
|
||||
// The caller frees the returned slice via
|
||||
// `os.free(r.ptr: *void, (r.cap: u64) * 16u64)`.
|
||||
// `os.free(r.ptr: *void, (r.cap: u64) * size(str): u64)`.
|
||||
//
|
||||
// Hare's `([]str | nomem)` collapses to `[]str` here: ww os.alloc
|
||||
// has no recoverable failure path. Same precedent as
|
||||
|
||||
Reference in New Issue
Block a user