feat: 类体计算键访问器落地动态定义访问器指令

This commit is contained in:
2026-09-24 09:16:08 +00:00
parent 821e24cd0b
commit 70e03c6a62
12 changed files with 193 additions and 21 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ pub(super) fn collect_real_vregs(f: &IRFunction) -> BTreeSet<u32> {
}
}
// 计算键访问器:ext[0] 是 key 寄存器(高位标记 `0x8000_0000 | vreg`)。
if inst.op == OpCode::DEFINE_ACCESSOR_DYNAMIC {
if matches!(inst.op, OpCode::DEFINE_ACCESSOR_DYNAMIC | OpCode::DEFINE_ACCESSOR_ATTRS_DYNAMIC) {
let r = inst.ext.first().copied().unwrap_or(0) & 0x7FFF_FFFF;
if r != 0 {
real.insert(r);
+2 -2
View File
@@ -238,9 +238,9 @@ fn rewrite_inst(
}
ext
}
// DEFINE_ACCESSOR_DYNAMIC:ext[0] 是 key 寄存器(高位标记 `0x8000_0000 | vreg`),
// 计算键访问器:ext[0] 是 key 寄存器(高位标记 `0x8000_0000 | vreg`),
// 低 31 位重映射后保留高位标记。
OpCode::DEFINE_ACCESSOR_DYNAMIC => {
OpCode::DEFINE_ACCESSOR_DYNAMIC | OpCode::DEFINE_ACCESSOR_ATTRS_DYNAMIC => {
let mut ext = inst.ext.clone();
if let Some(word) = ext.first_mut() {
let nr = remap_ext_reg(*word & 0x7FFF_FFFF, slot_color, map);