wcc: qualify all references to the syntax package (#75)
After the frontend consolidated into one syntax package (#74), wcc still referenced syntax symbols unqualified — residue of the old flat combined namespace, where bare refs resolved by accident. Under separate compilation Hare and Go both require the package qualifier, so those bare refs would not sep-resolve. Qualify every wcc reference to a syntax type, function, or enum member as syntax.X across the seven syntax-importing files. Resolution-only: the resolved symbol and emitted code are unchanged, so the two combined.ww regenerate textually but all five _ww binaries hold byte-for-byte. The struct-literal sites resolve via #76. This makes w6c fully separate-compilable.
This commit is contained in:
@@ -19,8 +19,8 @@ import strconv;
|
||||
|
||||
// ---- function-level cgen ---------------------------------------------
|
||||
|
||||
fn cgfnparams(c: *cgen, params: *node) void = {
|
||||
let p: *node = params;
|
||||
fn cgfnparams(c: *cgen, params: *syntax.node) void = {
|
||||
let p: *syntax.node = params;
|
||||
// sret (#23): RDI is consumed by the hidden dest pointer
|
||||
// (already spilled to @sretarg by cgfn); the first user param
|
||||
// lands in SI.
|
||||
@@ -36,7 +36,7 @@ fn cgfnparams(c: *cgen, params: *node) void = {
|
||||
// post-walk consistency check against stkcursor.
|
||||
let memwords: i32 = 0;
|
||||
for (p != nil) {
|
||||
if (p.kind == nkind.N_PARAM) {
|
||||
if (p.kind == syntax.nkind.N_PARAM) {
|
||||
let nm: str = p.str;
|
||||
// Hare-style variadic `T...`: callee receives a []T
|
||||
// slice (3 register words / 24B). p.lhs is already
|
||||
@@ -44,8 +44,8 @@ fn cgfnparams(c: *cgen, params: *node) void = {
|
||||
// (mirrors cstage check.c:455 tp->type promotion), so
|
||||
// we consume it directly — re-wrapping via slicewrap
|
||||
// would yield [][]T.
|
||||
if (p.op == tkind.TK_ELLIPSIS) {
|
||||
let tn: *node = p.lhs;
|
||||
if (p.op == syntax.tkind.TK_ELLIPSIS) {
|
||||
let tn: *syntax.node = p.lhs;
|
||||
if (idx + 3 <= 6) {
|
||||
let off: i32 = localadd(c, nm, tyslicesize(): i32, tn);
|
||||
emitline("\tMOVQ\t");
|
||||
@@ -108,14 +108,14 @@ fn cgfnparams(c: *cgen, params: *node) void = {
|
||||
// path → 1 slot, SI dropped, t.1 garbage. Slot size + element
|
||||
// walk source the RESOLVED node; localadd keeps the declared
|
||||
// p.lhs so field reads chase identically to cstage (byte-id).
|
||||
let tt99: *node = nil;
|
||||
let tt99: *syntax.node = nil;
|
||||
if (p.lhs != nil) {
|
||||
tt99 = p.lhs;
|
||||
for (tt99 != nil && tt99.kind == nkind.N_TNAME) {
|
||||
for (tt99 != nil && tt99.kind == syntax.nkind.N_TNAME) {
|
||||
tt99 = aliaslookup(c, tt99.str);
|
||||
};
|
||||
};
|
||||
if (p.lhs != nil) { if (tt99 != nil && tt99.kind == nkind.N_TTUPLE) {
|
||||
if (p.lhs != nil) { if (tt99 != nil && tt99.kind == syntax.nkind.N_TTUPLE) {
|
||||
// #163: tuple PARAM receive (param twin of #164's
|
||||
// return). Walk the tuple's elements over the SysV
|
||||
// arg cursor — a float reads its XMM (X0..X7),
|
||||
@@ -127,9 +127,9 @@ fn cgfnparams(c: *cgen, params: *node) void = {
|
||||
// partial-spill stitch is out of scope (twin of #164).
|
||||
let off: i32 = localadd(c, nm, slotsize(c, p.lhs), p.lhs);
|
||||
let eoff: i32 = 0;
|
||||
let te: *node = tt99.list;
|
||||
let te: *syntax.node = tt99.list;
|
||||
for (te != nil) {
|
||||
let et: *node = te.lhs;
|
||||
let et: *syntax.node = te.lhs;
|
||||
if (isfloattype(c, et)) {
|
||||
if (fidx >= 8) {
|
||||
let msg: str = "tuple param float element overflows SSE arg regs (X0..X7); stitch out of scope, see #163\n";
|
||||
@@ -251,7 +251,7 @@ fn cgfnparams(c: *cgen, params: *node) void = {
|
||||
// greedy stitch arm below while cstage received
|
||||
// one scalar word (cs≠ww, silent).
|
||||
// ref/qbe/amd64/sysv.c:80-85 / :411-426.
|
||||
if (taggedmemargsize(p.lhs.type_: *tinfo) > 0) {
|
||||
if (taggedmemargsize(p.lhs.type_: *syntax.tinfo) > 0) {
|
||||
localaddstack(c, nm, p.lhs, 16 + stkcursor*8);
|
||||
stkcursor += nw;
|
||||
memwords += nw;
|
||||
@@ -450,7 +450,7 @@ fn cgfnparams(c: *cgen, params: *node) void = {
|
||||
localaddstack(c, nm, p.lhs, 16 + stkcursor*8);
|
||||
stkcursor += nw;
|
||||
};};
|
||||
} else { let aggsz2: i32 = aggargsizetn(p.lhs.type_: *tinfo);
|
||||
} else { let aggsz2: i32 = aggargsizetn(p.lhs.type_: *syntax.tinfo);
|
||||
if (aggsz2 > 0) {
|
||||
// #271: array / >16B-struct by-value param —
|
||||
// received as ceil(sz/8) GP eightbytes, the
|
||||
@@ -529,7 +529,7 @@ fn cgfnparams(c: *cgen, params: *node) void = {
|
||||
};
|
||||
};
|
||||
|
||||
fn cgfn(c: *cgen, fn_: *node) void = {
|
||||
fn cgfn(c: *cgen, fn_: *syntax.node) void = {
|
||||
cgeninit(c);
|
||||
c.fnname = fn_.str;
|
||||
c.curmod = fn_.nmod;
|
||||
@@ -568,8 +568,8 @@ fn cgfn(c: *cgen, fn_: *node) void = {
|
||||
// resolve identifiers via localfind, so the body's locals must
|
||||
// still be in c.locals when we get there.
|
||||
if (fn_.body != nil) {
|
||||
if (fn_.body.kind == nkind.N_BLOCK) {
|
||||
let s: *node = fn_.body.list;
|
||||
if (fn_.body.kind == syntax.nkind.N_BLOCK) {
|
||||
let s: *syntax.node = fn_.body.list;
|
||||
for (s != nil) {
|
||||
cgstmt(c, s);
|
||||
s = s.next;
|
||||
@@ -605,7 +605,7 @@ fn cgfn(c: *cgen, fn_: *node) void = {
|
||||
// fn_.nmod hint would fall through modlookupforfn's first-leaf match
|
||||
// onto an IMPORTED package's now-registered `pkg.main`.
|
||||
emitline("TEXT ");
|
||||
if (streq(fn_.str, "main") && fn_.imported == 0) {
|
||||
if (syntax.streq(fn_.str, "main") && fn_.imported == 0) {
|
||||
emitbytes(fn_.str.ptr, fn_.str.len: u64);
|
||||
} else {
|
||||
emitfnname(c, fn_.str, fn_.nmod);
|
||||
@@ -625,7 +625,7 @@ fn cgfn(c: *cgen, fn_: *node) void = {
|
||||
|
||||
// ---- file-level entry ------------------------------------------------
|
||||
|
||||
export fn cgfile(c: *cgen, file: *node) void = {
|
||||
export fn cgfile(c: *cgen, file: *syntax.node) void = {
|
||||
if (file == nil) { return; };
|
||||
c.strlits = nil;
|
||||
c.strlitseq = 0;
|
||||
@@ -641,9 +641,9 @@ export fn cgfile(c: *cgen, file: *node) void = {
|
||||
collectmods(c, file);
|
||||
defaultinferredlets(c, file);
|
||||
collectlets(c, file);
|
||||
let d: *node = file.list;
|
||||
let d: *syntax.node = file.list;
|
||||
for (d != nil) {
|
||||
if (d.kind == nkind.N_FNDECL) {
|
||||
if (d.kind == syntax.nkind.N_FNDECL) {
|
||||
// #22 M3: emit code ONLY for this package's own decls. A
|
||||
// `.wwi` dep fn is a body-less prototype that already skips
|
||||
// (the body != nil gate); the explicit imported gate also
|
||||
|
||||
Reference in New Issue
Block a user