selfhost/cmd/w6a: strip *arena cascade (γ-3)

amalloc has 0 callers post-γ-2; the *arena threaded through w6a's
init/dupstr/bufinit and the asm_.a / buf.a fields are vestigial.

Drop `import mem;` from opcodes/parse/obj/main, remove asm_.a and
buf.a struct fields, strip *arena from init/dupstr/bufinit
signatures, update 12 call sites. main.combined.ww auto-regenerated.

Comment at main.ww:36 retidied "argv/arena" → "argv-style" to match
post-strip reality.

Verified 132/132 incl. 991_w6a_ww + 995_self_rebuild byte-identity.
This commit is contained in:
2026-05-21 11:46:13 +09:00
parent 3dae4d9e9a
commit 12e0b4057f
5 changed files with 124 additions and 144 deletions

View File

@@ -14,7 +14,6 @@
package w6a;
import os;
import mem;
import opcodes;
// Local wrappers around os.writeall's tagged return — collapse the
@@ -87,14 +86,12 @@ fn wru64(p: *u8, off: u64, v: u64) void = {
// ---- growable byte buffer ---------------------------------------------
type buf = struct {
a: *arena,
p: *u8,
n: u64,
cap: u64,
};
fn bufinit(b: *buf, a: *arena) void = {
b.a = a;
fn bufinit(b: *buf) void = {
b.cap = 256u64;
b.n = 0u64;
let np: []u8 = alloc([], b.cap)!;
@@ -134,11 +131,11 @@ fn bufputcstr(b: *buf, s: str) u32 = {
// ---- emitelf ---------------------------------------------------------
export fn emitelf(a: *asm_, fd: i32) i32 = {
let shstr: buf; bufinit(&shstr, a.a);
let str_: buf; bufinit(&str_, a.a);
let sym: buf; bufinit(&sym, a.a);
let rela: buf; bufinit(&rela, a.a);
let relad: buf; bufinit(&relad, a.a);
let shstr: buf; bufinit(&shstr);
let str_: buf; bufinit(&str_);
let sym: buf; bufinit(&sym);
let rela: buf; bufinit(&rela);
let relad: buf; bufinit(&relad);
// Index 0 = empty.
let zero: u8 = 0u8;