stage1 将数组和聚合类型使用byte offset而不是slot idx

This commit is contained in:
zzy
2026-07-07 11:38:31 +08:00
parent 3cf11f922e
commit 1df3e3bcb4
9 changed files with 103 additions and 86 deletions

View File

@@ -27,7 +27,7 @@ static int parse_fn_body(spl_comp_t *ctx, const char *fn_name, spl_type_info_t *
int fi = spl_declare_func(ctx, fn_name, ret_type, nparams, 0, is_pub);
ctx->current_func_idx = fi;
ctx->current_ret_type = ret_type;
ctx->current_local_slot = 0;
ctx->current_local_bytes = 0;
spl_push_scope(ctx);
@@ -48,7 +48,7 @@ static int parse_fn_body(spl_comp_t *ctx, const char *fn_name, spl_type_info_t *
skip_nl(ctx);
}
spl_patch(ctx, alloc_addr, ctx->current_local_slot - nparams);
spl_patch(ctx, alloc_addr, ctx->current_local_bytes / (int)sizeof(spl_val_t) - nparams);
expect(ctx, TOK_R_BRACE);
}