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 ff129d626f
commit 2239eeac24
13 changed files with 448 additions and 11 deletions
+7 -4
View File
@@ -124,9 +124,12 @@ impl Inst {
Self::with_ext(OpCode::COMPOUND_MEMBER_USHR, obj, val, key, &[0; IC_EXT_WORDS])
}
// ── Call 系:ext = [nargs] ──
// ── Call 系:ext = [nargs | (存活上界 << 8)] ──
// 低 8 位 nargs;高 8 位由 RegAlloc 后 `encode_call_window` 回填调用点存活
// 上界(窗口 regs[0..上界],0 = 全量)。emit 构造时高 8 位恒 0。
/// 普通函数调用:rd=callee,a=this,b=首参,ext=\[nargs\]。参数从 `first_arg` 起连续占 nargs 个寄存器。
/// 普通函数调用:rd=callee,a=this,b=首参,ext=[nargs|(上界<<8)]。
/// 参数从 `first_arg` 起连续占 nargs 个寄存器。
pub fn call(callee: Operand, this: Operand, first_arg: Operand, nargs: u8) -> Self {
Self::with_ext(OpCode::CALL, callee, this, first_arg, &[nargs as u32])
}
@@ -136,12 +139,12 @@ impl Inst {
Self::with_ext(OpCode::CALL_NATIVE, callee, this, first_arg, &[nargs as u32])
}
/// `new` 表达式:结果写入 `result`,构造函数为 `constructor`。
/// `new` 表达式:结果写入 `result`,构造函数为 `constructor`。ext 编码同 `call`。
pub fn new_expression(result: Operand, constructor: Operand, first_arg: Operand, nargs: u8) -> Self {
Self::with_ext(OpCode::NEW_EXPRESSION, result, constructor, first_arg, &[nargs as u32])
}
/// 派生类构造中的 `super(...)`:结果写入 `result`。
/// 派生类构造中的 `super(...)`:结果写入 `result`。ext 编码同 `call`。
pub fn super_call(result: Operand, first_arg: Operand, nargs: u8) -> Self {
Self::with_ext(OpCode::SUPER_CALL, result, first_arg, Operand::None, &[nargs as u32])
}