wcc+w6c+w6c_ww: delete() builtin — single-element slice removal (part of #35)

Hare's delete(xs[i]) (ref/harec/src/check.c:1981-2027): checker accepts
an N_INDEX over a slice-typed base, stamps void; loud-rejects the range
form delete(xs[i..j]) (stays filed on #35 — regex fold-2b's consumers
are all single-element), non-index operands, array bases, wrong arity.

Lowering (both stages, converged byte-identical by construction):
ascending word-copy loop shifts [i+1..len) down one esz stride, then
hdr.len -= 1; cap unchanged. The move is a same-type whole-stride byte
copy — src and dst are elements of the SAME slice, so no boxing exists
for any element kind; one loop serves scalar/narrow/str/struct/tagged.
esz off the STAMPED base type (#34/#48 discipline). Base shapes: local
slice ident (LEAQ) and deref-of-local ptr-to-slice (MOVQ — the fold-2b
delete_thread shape); others rule-7 loud-stop.

test/804: 38 fixtures — first/middle/last/to-empty, esz 1/4/8/24/56
(MOVB/MOVL tails + 7-qword tagged), cap-unchanged, (*threads)[i], 4
checker reject rows; every accept row cs==ww asm byte-id.
This commit is contained in:
2026-06-04 06:41:12 +09:00
parent e93be8495a
commit 37febab9d5
8 changed files with 1120 additions and 6 deletions

View File

@@ -388,6 +388,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_tuple_sret_callee \
$(BIN)/test_tuple_sret_receive_run \
$(BIN)/test_append_wide_elem \
$(BIN)/test_delete_elem \
$(BIN)/test_struct_tuple_field_slot \
$(BIN)/test_widen_pad_zero_run \
$(BIN)/test_named_ptr_alias_variant_widen \
@@ -1000,6 +1001,16 @@ $(BIN)/test_append_wide_elem: test/wcc/800_append_wide_elem.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# #35 (delete-half): delete(xs[i]) single-element slice removal — runtime
# rows across every element kind (scalar/narrow/str/struct/56B tagged) +
# the deref-of-local regex fold-2b shape + checker reject rows + cs==ww
# asm byte-id (the converged-by-construction shift loop).
$(BIN)/test_delete_elem: test/wcc/804_delete_elem.c \
$(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6l \
$(BIN)/ww_ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# #237: a tuple-typed struct field must contribute its real slot width to
# the enclosing struct's slotsize — pure cs==ww .s byte-id (frame size).
$(BIN)/test_struct_tuple_field_slot: test/wcc/930_struct_tuple_field_slot.c \