implement dynamic key; implement __curPos; other small changes

This commit is contained in:
2026-05-02 21:23:39 +08:00
parent a66748e42d
commit 4f7d94f41b
13 changed files with 169 additions and 141 deletions
+1 -13
View File
@@ -3,7 +3,7 @@ use fix_common::StringId;
use num_enum::TryFromPrimitive;
use string_interner::Symbol as _;
use crate::{AttrKeyData, OperandData, VmRuntimeCtx};
use crate::{OperandData, VmRuntimeCtx};
pub(crate) struct BytecodeReader<'a> {
bytecode: &'a [u8],
@@ -132,18 +132,6 @@ impl<'a> BytecodeReader<'a> {
}
}
#[inline(always)]
pub(crate) fn read_attr_key_data(&mut self) -> crate::AttrKeyData {
use fix_codegen::AttrKeyType;
let tag = self.read_u8();
let ty = AttrKeyType::try_from_primitive(tag)
.unwrap_or_else(|err| panic!("unknown key tag: {:#04x}", err.number));
match ty {
AttrKeyType::Static => AttrKeyData::Static(self.read_string_id()),
AttrKeyType::Dynamic => AttrKeyData::Dynamic,
}
}
pub(crate) fn pc(&self) -> usize {
self.pc
}