stage1 修复bug 删除递归测试

This commit is contained in:
zzy
2026-07-08 11:45:45 +08:00
parent 463177d3be
commit 147f26e063
11 changed files with 601 additions and 96 deletions

View File

@@ -96,6 +96,23 @@ void spl_patch_to_here(spl_comp_t *ctx, spl_val_t addr) {
spl_patch(ctx, addr, offset);
}
/* ---- Multi-slot copy helper ---- */
void spl_emit_copy_slots(spl_comp_t *ctx, int dest_offset, usize nslots) {
for (usize i = 0; i < nslots; i++) {
if (i < nslots - 1)
spl_emit(ctx, SPL_DUP, SPL_VOID, 0);
if (i > 0) {
spl_emit(ctx, SPL_PUSH, SPL_USIZE, i * sizeof(spl_val_t));
spl_emit(ctx, SPL_ADD, SPL_USIZE, 0);
}
spl_emit(ctx, SPL_LOAD, SPL_PTR, 0);
spl_emit(ctx, SPL_LADDR, SPL_PTR, dest_offset + (int)(i * sizeof(spl_val_t)));
spl_emit(ctx, SPL_SWAP, SPL_VOID, 0);
spl_emit(ctx, SPL_STORE, SPL_PTR, 0);
}
}
/* ---- Scope management ---- */
void spl_push_scope(spl_comp_t *ctx) {