feat: lots of optimization

* allocate vm stack on the stack
* use Rc instead of Arc
* optimize recursive attribute set
This commit is contained in:
2025-05-11 12:57:29 +08:00
parent 07b486848f
commit 05e82d4021
12 changed files with 137 additions and 111 deletions

View File

@@ -95,11 +95,7 @@ impl Compile for ir::Thunk {
impl Compile for ir::Attrs {
fn compile(self, comp: &mut Compiler) {
comp.push(if self.rec {
OpCode::RecAttrSet
} else {
OpCode::AttrSet
});
comp.push(OpCode::AttrSet);
for stc in self.stcs {
stc.1.compile(comp);
comp.push(OpCode::PushStaticAttr { name: stc.0 });
@@ -110,7 +106,7 @@ impl Compile for ir::Attrs {
comp.push(OpCode::PushDynamicAttr)
}
if self.rec {
comp.push(OpCode::LeaveEnv);
comp.push(OpCode::FinalizeRec);
}
}
}