fix: 顶层 var 读写直连全局对象属性单一真值——GDI 序言 + 声明处同步删除,类原型 session 直分防晋升克隆 identity 分裂,自增减 int 保持

This commit is contained in:
2026-09-12 15:48:32 +00:00
parent 4b807b5b90
commit 44c16cab8a
21 changed files with 447 additions and 74 deletions
+8 -1
View File
@@ -11,7 +11,14 @@ impl Emitter {
&self, ctor_reg: u32, proto_reg: u32, super_reg: Option<u32>, sub_idx: u16, ctx: &mut CompileCtx,
) -> Result<(), String> {
ctx.inst(Inst::create_closure(Operand::Reg(ctor_reg), sub_idx));
ctx.inst(Inst::new(OpCode::NEW_OBJECT, Operand::Reg(proto_reg), Operand::None, Operand::None));
// 类原型 session 直分:实例 [[Prototype]] 与 Class.prototype 两侧须同一
// 对象,epoch 分配在逃逸写晋升时克隆出第二份分裂 identity。
ctx.inst(Inst::new(
OpCode::NEW_SESSION_OBJECT,
Operand::Reg(proto_reg),
Operand::None,
Operand::None,
));
if let Some(super_reg) = super_reg {
let proto_key_idx = ctx.add_constant(Constant::String("prototype".to_string()));
let parent_proto_key_reg = ctx.alloc_reg();