wcc/cgen: #146 wwstage str ==/!= via rt_streq, not ptr-only CMPQ (the #154 ww-twin)

wwstage compiled str ==/!= as a single CMPQ on the eager-eval'd ptr word
(len ignored), so two distinct-pointer equal-content strings compared
unequal. cstage was already correct (CALLs rt_streq, the #154 cbinop fix).
The wwstage cgbin had no str-awareness -- every comparison fell to the
generic CMPQ tail; the #154 fix was never mirrored.

wwstage-only: a cgstreqpush helper + a str ==/!= branch at the top of
cgbin (before the generic eval collapses the header), byte-matching cstage
cbinop:4564-4623 -- push rhs/lhs (len,ptr), POPQ DI/SI/DX/CX, CALL
rt_streq, XORQ $1 for !=. Gated on typeisstr (= cstage node_isstr, which
also catches module-global str idents). cstage cgen unchanged (w6c md5
unchanged). The str== .s is byte-identical cs==ww for local, global,
aliased, chained, and condition operands.

Graduates 3 lib byte-id pins (test/wcc/989_lib_byteid #59.1 asciitest,
#59.11 toktest, #59.12 asttest) M_DIVERGE->M_ID -- they used == on str and
were pinned divergent because of this bug; now byte-identical. byte-id
990-997 8/8. test/wcc/827 table-driven.
This commit is contained in:
2026-06-08 23:49:16 +09:00
parent 83025b03a6
commit 5dd239d01e
6 changed files with 496 additions and 3 deletions

View File

@@ -133,7 +133,7 @@ static const struct ent ents[] = {
.mode = M_ID, .sentinel = "package libc;", .moddir = "lib/c/libc" },
/* -------- documented-allowed cs≠ww (task #59) ------------ */
{ .fixture = "lib/ascii/asciitest.ww",
.mode = M_DIVERGE, .cite = "#59.1" },
.mode = M_ID, .cite = "#59.1 graduated by #146 str==" },
/* #59.2 bufio graduated to M_ID above (#129 fix) */
{ .fixture = "lib/encoding/base64/base64_test.ww",
.mode = M_DIVERGE, .cite = "#59.3" },
@@ -148,10 +148,10 @@ static const struct ent ents[] = {
.mode = M_DIVERGE, .cite = "#59.9" },
/* #59.10 stoftest graduated to M_ID above (#62 fix) */
{ .fixture = "lib/ww/lex/toktest.ww",
.mode = M_DIVERGE, .cite = "#59.11" },
.mode = M_ID, .cite = "#59.11 graduated by #146 str==" },
/* asttest resolves `import tok` via -I lib/ww/lex, cf 905 */
{ .fixture = "lib/ww/asttest.ww", .inc = "lib/ww/lex",
.mode = M_DIVERGE, .cite = "#59.12" },
.mode = M_ID, .cite = "#59.12 graduated by #146 str==" },
/* -------- wwstage front-end gaps (task #59) -------------- */
{ .fixture = "lib/crypto/sha256/sha256_test.ww",
.mode = M_WWREJECT, .cite = "#59.13" },