feat: 为 VM 添加结构化日志

This commit is contained in:
爱特每羊队
2026-06-26 20:50:05 +08:00
parent e730d0fd2d
commit b986a8f229
18 changed files with 297 additions and 34 deletions
+2
View File
@@ -4,6 +4,7 @@
//! update handlers route through here, so IC format changes (like the future
//! side-table migration) require editing only this file.
use crate::vm_trace;
use oxide_bytecode::opcode::{self, Instr};
use oxide_types::object::JsObject;
use oxide_types::value::JsValue;
@@ -23,6 +24,7 @@ pub(crate) fn read_ic_entry(bytecode: &[Instr], pc: &mut usize) -> (u32, u32) {
/// after resolving a property, so the next execution of this site hits the cache.
pub(crate) fn write_ic_back(bytecode: &mut [Instr], pc: usize, shape_id: u32, slot_index: u32) {
debug_assert!(pc >= 3, "IC write-back requires 3 extension words before pc");
vm_trace!("write_ic_back: pc={} shape_id={} slot={}", pc, shape_id, slot_index);
bytecode[pc - 3] = shape_id & 0x00FF_FFFF;
bytecode[pc - 2] = slot_index;
bytecode[pc - 1] = 0;