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:
@@ -13,7 +13,6 @@
|
||||
package w6a;
|
||||
|
||||
import os;
|
||||
import mem;
|
||||
import strings;
|
||||
import lex;
|
||||
import opcodes;
|
||||
@@ -138,8 +137,7 @@ fn reglookup(p: *u8, n: u64) i32 = {
|
||||
return D_NONE;
|
||||
};
|
||||
|
||||
export fn init(a: *asm_, ar: *arena, file: str, src: *u8, len: u64) void = {
|
||||
a.a = ar;
|
||||
export fn init(a: *asm_, file: str, src: *u8, len: u64) void = {
|
||||
a.file = file;
|
||||
a.src = src;
|
||||
a.srclen = len;
|
||||
@@ -180,7 +178,7 @@ fn perr(a: *asm_, msg: str) void = {
|
||||
};
|
||||
|
||||
// dupstr — copy n bytes from p into a fresh heap str.
|
||||
fn dupstr(a: *arena, p: *u8, n: u64) str = {
|
||||
fn dupstr(p: *u8, n: u64) str = {
|
||||
let view: str;
|
||||
view.ptr = p;
|
||||
view.len = n: i32;
|
||||
@@ -332,7 +330,7 @@ fn parseoperand(a: *asm_, p: *u8, offin: u64, n: u64, out: *aoperand) u64 = {
|
||||
let r: i32 = reglookup(p + rstart, rn);
|
||||
if (r == D_PSB) {
|
||||
out.atype = D_EXTERN;
|
||||
out.asym = dupstr(a.a, p + istart, in_);
|
||||
out.asym = dupstr(p + istart, in_);
|
||||
out.offset = symdisp;
|
||||
} else {
|
||||
out.atype = D_INDIR;
|
||||
@@ -350,7 +348,7 @@ fn parseoperand(a: *asm_, p: *u8, offin: u64, n: u64, out: *aoperand) u64 = {
|
||||
return off;
|
||||
};
|
||||
out.atype = D_BRANCH;
|
||||
out.asym = dupstr(a.a, p + istart, in_);
|
||||
out.asym = dupstr(p + istart, in_);
|
||||
return off;
|
||||
};
|
||||
// EOF inside ident
|
||||
@@ -358,7 +356,7 @@ fn parseoperand(a: *asm_, p: *u8, offin: u64, n: u64, out: *aoperand) u64 = {
|
||||
let r: i32 = reglookup(p + istart, in_);
|
||||
if (r != D_NONE) { out.atype = r; return off; };
|
||||
out.atype = D_BRANCH;
|
||||
out.asym = dupstr(a.a, p + istart, in_);
|
||||
out.asym = dupstr(p + istart, in_);
|
||||
return off;
|
||||
};
|
||||
|
||||
@@ -411,7 +409,7 @@ export fn parse(a: *asm_) i32 = {
|
||||
else { scanid = false; }; };
|
||||
};
|
||||
if (q < n) { if (line[q] == 58u8) { // ':'
|
||||
let nm: str = dupstr(a.a, line + i, q - i);
|
||||
let nm: str = dupstr(line + i, q - i);
|
||||
// Pending label gets a NOP prog so addresses pin.
|
||||
if (pending.len > 0) {
|
||||
let np: *aprog = addprog(a, A_NOP, pending);
|
||||
@@ -462,7 +460,7 @@ export fn parse(a: *asm_) i32 = {
|
||||
};
|
||||
let toop: *aoperand = pr.to;
|
||||
toop.atype = D_EXTERN;
|
||||
toop.asym = dupstr(a.a, line + r0, commapos - r0);
|
||||
toop.asym = dupstr(line + r0, commapos - r0);
|
||||
if (commapos < n) {
|
||||
let p2: u64 = commapos + 1u64;
|
||||
p2 = skipws(line, p2, n);
|
||||
@@ -490,7 +488,7 @@ export fn parse(a: *asm_) i32 = {
|
||||
};
|
||||
let toop: *aoperand = pr.to;
|
||||
toop.atype = D_EXTERN;
|
||||
toop.asym = dupstr(a.a, line + r0, lparen - r0);
|
||||
toop.asym = dupstr(line + r0, lparen - r0);
|
||||
// Skip past `(SB)` to land just after ')'.
|
||||
let p2: u64 = lparen;
|
||||
let scand2: bool = true;
|
||||
|
||||
Reference in New Issue
Block a user