perf: 字节码调用压帧窗口按调用点存活上界拷贝减少整窗搬移

RegAlloc 改写后补第三次 liveness,为每条 CALL/NEW/SUPER_CALL 计算调用点
存活上界(最大存活物理槽号 + 1,254/255 由帧单独保存不计入),编码进
ext 高 8 位(nargs 低 8 位不变)。三处手写压帧窗口 = min(调用方活动寄存
器, 存活上界),restore_frame 按窗口回拷;CallFrame 新增
caller_active_reg_limit 保存调用方真实活动上限,恢复时不随截断窗口缩水。
生成器/异步函数体调用点保持全量窗口。spread 调用与运行时发起压帧
(accessor/内联)走全量路径不受影响。
This commit is contained in:
2026-08-15 09:56:22 +08:00
parent 5e14817eaa
commit d9acda7417
13 changed files with 448 additions and 11 deletions
+5
View File
@@ -77,6 +77,11 @@ impl Compiler {
let cfg2 = oxide_cfg::build_cfg(&ir); // 精确 DCE 删指令后 inst 下标位移,CFG 重建
let live2 = oxide_liveness::liveness(&ir, &cfg2); // 重算,绝不用过期 live
oxide_regalloc::alloc(&mut ir, &live2)?; // 无可行染色 → RangeError 上抛
// RegAlloc 改写(vreg→phys + spill 插入)后补第三次 liveness:为调用点
// 存活上界提供物理级活集(改写过后的 LiveInfo 已过期,必须重算)。
let cfg3 = oxide_cfg::build_cfg(&ir);
let live3 = oxide_liveness::liveness(&ir, &cfg3);
oxide_regalloc::encode_call_window(&mut ir, &live3);
crate::compiler_debug!("compile: after regalloc {} insts", ir.insts.len());
}
crate::compiler_debug!("compile: done, {} instructions", ir.insts.len());