refactor: split VmContext

This commit is contained in:
2026-04-25 17:54:59 +08:00
parent 468269c20d
commit 4f3cd0ef4c
9 changed files with 243 additions and 215 deletions
+3 -6
View File
@@ -3,7 +3,7 @@ use fix_common::StringId;
use num_enum::TryFromPrimitive;
use string_interner::Symbol as _;
use crate::OperandData;
use crate::{OperandData, VmRuntimeCtx};
pub(crate) struct BytecodeReader<'a> {
bytecode: &'a [u8],
@@ -94,7 +94,7 @@ impl<'a> BytecodeReader<'a> {
}
#[inline(always)]
pub(crate) fn read_operand_data<C: crate::VmContext>(&mut self, ctx: &C) -> OperandData {
pub(crate) fn read_operand_data<C: VmRuntimeCtx>(&mut self, ctx: &C) -> OperandData {
let tag = self.read_u8();
let Ok(ty) = OperandType::try_from_primitive(tag)
.map_err(|err| panic!("unknown operand tag: {:#04x}", err.number));
@@ -117,10 +117,7 @@ impl<'a> BytecodeReader<'a> {
}
#[inline(always)]
pub(crate) fn read_attr_key_data<C: crate::VmContext>(
&mut self,
ctx: &C,
) -> crate::AttrKeyData {
pub(crate) fn read_attr_key_data<C: VmRuntimeCtx>(&mut self, ctx: &C) -> crate::AttrKeyData {
use fix_codegen::AttrKeyType;
let tag = self.read_u8();
let ty = AttrKeyType::try_from_primitive(tag)