refactor: abstract VM

This commit is contained in:
2026-05-13 18:28:18 +08:00
parent 21899f7380
commit 29fab93cd1
42 changed files with 1823 additions and 1410 deletions
+4 -4
View File
@@ -1,9 +1,9 @@
use fix_abstract_vm::{NixType, resolve_operand};
use fix_common::StringId;
use fix_error::Error;
use gc_arena::{Gc, RefLock};
use smallvec::SmallVec;
use crate::value::NixType;
use crate::{
AttrSet, BytecodeReader, List, Step, StrictValue, Value, VmRuntimeCtx, VmRuntimeCtxExt,
};
@@ -43,13 +43,13 @@ impl<'gc> crate::Vm<'gc> {
for _ in 0..static_count {
let key = reader.read_string_id();
let val = reader.read_operand_data(ctx).resolve(mc, self);
let val = resolve_operand(&reader.read_operand_data(ctx), mc, self);
let _span_id = reader.read_u32();
kv.push((key, val));
}
for key in dyn_keys {
let val = reader.read_operand_data(ctx).resolve(mc, self);
let val = resolve_operand(&reader.read_operand_data(ctx), mc, self);
let _span_id = reader.read_u32();
if let Some(key) = key {
kv.push((key, val))
@@ -314,7 +314,7 @@ impl<'gc> crate::Vm<'gc> {
let count = reader.read_u32() as usize;
let mut items: SmallVec<[Value; 4]> = SmallVec::with_capacity(count);
for _ in 0..count {
items.push(reader.read_operand_data(ctx).resolve(mc, self));
items.push(resolve_operand(&reader.read_operand_data(ctx), mc, self));
}
let list = Gc::new(
mc,