stage0 重构vm使其依赖自己的地址空间不再共用宿主机 修改vm的ABI 修正相关nob构建问题

This commit is contained in:
zzy committed 2026-09-22 23:12:15 +08:00
1 parent fae017b52d
commit c0a86ea552
14 files changed
+2149 -1572

No files matched your search

+12
View File
@@ -952,6 +952,9 @@ fn cg_control(cg: *Cgen, ref: usize, n: *IrEntry) {
cg_store_slot(cg, ref, rk);
}
} else {
/* ABI:实参下方预留 2 个空闲 slot(PAD0/PAD1)。 */
cg_push(cg, .U64, 0);
cg_push(cg, .U64, 0);
var ret_t = cl.tid;
var ret_is_sret = ir_is_aggregate(ctx, ret_t);
var sret_off: usize = 0;
@@ -1327,6 +1330,15 @@ fn dump(ctx: *Ir2Vm, out: *ByteBuffer): bool {
ret Mcode.dump(&ctx.prog, out);
}
// 序列化到内存 ByteBuffer(不落盘),供内嵌 VM 直接加载。
fn encode(ctx: *Ir2Vm, out: *ByteBuffer): bool {
match Mcode.encode(&ctx.prog, out) {
.Ok => { ret true; },
.Err(error) => { ret false; },
}
ret false;
}
// 把翻译结果写成 .sir(二进制)。
fn store(ctx: *Ir2Vm, path: ByteView): bool {
match Mcode.store(&ctx.prog, path) {