wcc+w6c+w6c_ww: delete() range form delete(xs[lo:hi]) (fold-5a P2)
Hare's delete also takes a slicing place (harec check.c:1981-2027 EXPR_SLICE; Hare spells it delete(xs[i..j])): remove [lo, hi) — shift [hi..len) down count = hi-lo strides, len -= count, cap unchanged; lo defaults 0, hi defaults len, so delete(xs[:]) clears the slice with storage retained. Checker accepts N_SLICE next to N_INDEX (object must chase to a slice, harec :2024); the old range-unimplemented reject and its #35 cite drop. Lowering (both stages, converged byte-identical by construction) is the single-element arm's same-slice whole-stride word-copy loop with a DYNAMIC src offset (count*esz via a src register) instead of the constant one-stride. Base shapes: local slice ident, deref-of-local, plus NEW indexed local-slice base xs[g][lo:hi] — the fold-5a consumer shape (regex.ha:333 delete(jump_idxs[group_level][..]); outer stride off the type table). Bounds stay implicit, inheriting the documented single-element posture (no index checks anywhere in cgen). Operands evaluate left-to-right, exactly once, before the shift (harec order); only the header ADDRESS is taken before operand eval, so a bound expression's writes through the slice land before the copy. test/809: 64 fixtures — full/explicit/re-clear/head/mid/tail/empty a:a/end-boundary len:len/explicit 0:0 on a never-appended (nil-ptr) slice, single-vs-range equivalence, cap preservation, esz 1/2/4/8/16/24 copy tails against the dynamic src, operand order-of-eval (lo/hi CALLs fire once each, in order) + aliasing-visibility pins, the EXACT [][]size regex consumer shape, deref base, 2 reject rows w/ diagnostic text; every accept row cs==ww asm byte-id. test/804: reject_range row retired (form now accepted), reject_nonindex text follows the widened message.
This commit is contained in:
15
Makefile
15
Makefile
@@ -393,6 +393,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_tuple_sret_receive_run \
|
||||
$(BIN)/test_append_wide_elem \
|
||||
$(BIN)/test_delete_elem \
|
||||
$(BIN)/test_delete_range \
|
||||
$(BIN)/test_insert_elem \
|
||||
$(BIN)/test_arrlit_overlong \
|
||||
$(BIN)/test_placeaddr_store \
|
||||
@@ -1024,6 +1025,20 @@ $(BIN)/test_delete_elem: test/wcc/804_delete_elem.c \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# #35 (range-half, fold-5a prereq P2): delete(xs[lo:hi]) range slice
|
||||
# removal — runtime rows across defaults (full/head/tail/empty/end
|
||||
# boundary), the esz copy-tail spread against the dynamic src offset
|
||||
# (1/2/4/8/16/24), the single-elem equivalence, cap preservation,
|
||||
# operand order-of-eval + aliasing pins, the deref-of-local base, the
|
||||
# indexed-base regex.ha:333 consumer shape EXACT + checker reject rows
|
||||
# w/ diagnostic text + cs==ww asm byte-id (the converged-by-construction
|
||||
# rdl_l/rdl_e shift loop).
|
||||
$(BIN)/test_delete_range: test/wcc/809_delete_range.c \
|
||||
$(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6l \
|
||||
$(BIN)/ww_ww \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# #35 (insert-half): insert(xs[idx], v) single-element slice insertion —
|
||||
# delete()'s twin, lowered as append-desugar + rotate-right. Runtime rows
|
||||
# across every element kind (scalar/narrow/str/struct/56B tagged incl.
|
||||
|
||||
Reference in New Issue
Block a user