A match whose scrutinee is a tagged field of a GLOBAL value-struct read the tag/payload from the BP region (saved-BP + return-addr) instead of g(SB) and returned garbage. Both stages were identical-wrong, so the byte-id gate could not see it -- a gate-blind regression introduced by M1 (#25): M1's in-place N_DOT match arm uses localfind(base), which returns the 0 not-found sentinel for a global base, so 0+field.offset landed in the frame. Gate the in-place arm on a confirmed-local base -- `localfind(base)==0 && let_islet/isletvar(base)`, verbatim from cstage's own global test at cgen.c:2000 (both stages, same spelling). A global base now falls through to the existing spill path, which cgexprs the scrutinee and resolves g(SB). M1's local-field in-place ($32) path is untouched. Regenerates the w6c and wwdump combined.ww. Table-driven 841 test (global int/reassign/str-payload + a local-field M1 regression row), runtime-discriminating: pre-fix returns garbage, post-fix 42 on both stages; rob's direct-global-field spill caveat confirmed at runtime.
8.1 KiB
8.1 KiB