selfhost/cmd/w6a: rename types.ww → opcodes.ww (#11)

The file declares `package w6a;` (not a real `types` module), so
`import types;` was only the bundler file-key. The shadow against
lib/types/ blocked any w6a TU that wanted to pull lib/strings or
lib/bytes (both transitively reach `types.I64_MAX`); the w6a-local
shadow won the source-dir-first resolver, and `types.I64_MAX` came
back undefined → "ordered comparison on non-numeric".

Rename the file to its actual role — opcode + register enums
mirroring 6.out.h — and update the four import lines + Makefile
prereq. No symbol-call sites changed: every constant already
resolves unqualified inside the w6a package.

Unblocks #7 astrndup workaround comments in main.ww / parse.ww;
γ-2 (convert those two sites + delete astrndup export from
selfhost/cmd/wcc/mem.ww) becomes mechanical.

Verified 132/132 incl. 991_w6a_ww.
This commit is contained in:
2026-05-21 11:04:40 +09:00
parent 917d6250fc
commit 6696e95da4
7 changed files with 11 additions and 11 deletions

View File

@@ -150,7 +150,7 @@ $(BIN)/w6c_ww: selfhost/cmd/w6c/main.ww \
# ---- ww-side w6a (assembler port, exercised by 991_w6a_ww) ------------ # ---- ww-side w6a (assembler port, exercised by 991_w6a_ww) ------------
# Built like wwdump_ww. Needs -I selfhost/cmd/w6a for the local types/lex/ # Built like wwdump_ww. Needs -I selfhost/cmd/w6a for the local types/lex/
# parse/asm/obj modules and -I selfhost/cmd/wcc to find `mem`. # parse/asm/obj modules and -I selfhost/cmd/wcc to find `mem`.
$(BIN)/w6a_ww: selfhost/cmd/w6a/main.ww selfhost/cmd/w6a/types.ww \ $(BIN)/w6a_ww: selfhost/cmd/w6a/main.ww selfhost/cmd/w6a/opcodes.ww \
selfhost/cmd/w6a/lex.ww selfhost/cmd/w6a/parse.ww \ selfhost/cmd/w6a/lex.ww selfhost/cmd/w6a/parse.ww \
selfhost/cmd/w6a/asm.ww selfhost/cmd/w6a/obj.ww \ selfhost/cmd/w6a/asm.ww selfhost/cmd/w6a/obj.ww \
selfhost/cmd/wcc/mem.ww \ selfhost/cmd/wcc/mem.ww \

View File

@@ -14,7 +14,7 @@ package w6a;
import os; import os;
import rt; import rt;
import mem; import mem;
import types; import opcodes;
// ---- text buffer growth ------------------------------------------------ // ---- text buffer growth ------------------------------------------------

View File

@@ -860,7 +860,7 @@ export fn freearena(a: *arena) void = {
}; };
}; };
// selfhost/cmd/w6a/types.ww — types + constants shared across the // selfhost/cmd/w6a/opcodes.ww — types + constants shared across the
// w6a port. Mirrors cmd/w6a/a.h and cmd/w6c/6.out.h. // w6a port. Mirrors cmd/w6a/a.h and cmd/w6c/6.out.h.
package w6a; package w6a;
@@ -1167,7 +1167,7 @@ package w6a;
import os; import os;
import mem; import mem;
import lex; import lex;
import types; import opcodes;
fn streqlit(p: *u8, n: u64, lit: str) bool = { fn streqlit(p: *u8, n: u64, lit: str) bool = {
if (n != lit.len: u64) { return false; }; if (n != lit.len: u64) { return false; };
@@ -1752,7 +1752,7 @@ package w6a;
import os; import os;
import rt; import rt;
import mem; import mem;
import types; import opcodes;
// ---- text buffer growth ------------------------------------------------ // ---- text buffer growth ------------------------------------------------
@@ -2606,7 +2606,7 @@ package w6a;
import os; import os;
import mem; import mem;
import types; import opcodes;
// Local wrappers around os.writeall's tagged return — collapse the // Local wrappers around os.writeall's tagged return — collapse the
// (i64 | oserror) back to a boolean / int sentinel for the // (i64 | oserror) back to a boolean / int sentinel for the
@@ -3016,7 +3016,7 @@ package main;
import os; import os;
import rt; import rt;
import mem; import mem;
import types; import opcodes;
import lex; import lex;
import parse; import parse;
import asm; import asm;

View File

@@ -9,7 +9,7 @@ package main;
import os; import os;
import rt; import rt;
import mem; import mem;
import types; import opcodes;
import lex; import lex;
import parse; import parse;
import asm; import asm;

View File

@@ -15,7 +15,7 @@ package w6a;
import os; import os;
import mem; import mem;
import types; import opcodes;
// Local wrappers around os.writeall's tagged return — collapse the // Local wrappers around os.writeall's tagged return — collapse the
// (i64 | oserror) back to a boolean / int sentinel for the // (i64 | oserror) back to a boolean / int sentinel for the

View File

@@ -1,4 +1,4 @@
// selfhost/cmd/w6a/types.ww — types + constants shared across the // selfhost/cmd/w6a/opcodes.ww — types + constants shared across the
// w6a port. Mirrors cmd/w6a/a.h and cmd/w6c/6.out.h. // w6a port. Mirrors cmd/w6a/a.h and cmd/w6c/6.out.h.
package w6a; package w6a;

View File

@@ -15,7 +15,7 @@ package w6a;
import os; import os;
import mem; import mem;
import lex; import lex;
import types; import opcodes;
fn streqlit(p: *u8, n: u64, lit: str) bool = { fn streqlit(p: *u8, n: u64, lit: str) bool = {
if (n != lit.len: u64) { return false; }; if (n != lit.len: u64) { return false; };