use crate::vm::error::LuaError;
#[doc(hidden)]
pub struct JitState {
pub enabled: bool,
pub trace_enabled: bool,
pub p16_self_link_enabled: bool,
pub active_trace: Option<Box<crate::jit::trace::TraceRecord>>,
pub recording_frame_base: usize,
pub max_depth_seen: u8,
pub counters: JitCounters,
pub pending_err: Option<LuaError>,
pub reg_state_buf: Vec<i64>,
pub str_buf_pool: Vec<Vec<u8>>,
pub str_buf_pool_cap: usize,
pub entry_tags_buf: Vec<u8>,
pub chunk_compiler: Box<dyn crate::jit::IntChunkCompiler>,
pub trace_compiler: Box<dyn crate::jit::TraceCompiler>,
}
#[doc(hidden)]
#[derive(Default)]
pub struct JitCounters {
pub closed: u64,
pub aborted: u64,
pub inline_abort: u64,
pub compiled: u64,
pub compile_failed: u64,
pub dispatched: u64,
pub deopt: u64,
pub side_trace_started: u64,
pub side_trace_compiled: u64,
pub side_trace_shape_mismatch: u64,
pub sinkable_seen: u64,
pub accum_bufferable_seen: u64,
pub sunk_alloc: u64,
pub materialize_emit: u64,
pub closure_emit: u64,
pub dispatch_off_reasons: Vec<&'static str>,
pub compile_failed_reasons: Vec<&'static str>,
pub closed_lens: Vec<(bool, usize)>,
}
impl JitState {
pub fn with_null_backend() -> JitState {
JitState {
enabled: true,
trace_enabled: true,
p16_self_link_enabled: false,
active_trace: None,
recording_frame_base: 0,
max_depth_seen: 0,
counters: JitCounters::default(),
pending_err: None,
reg_state_buf: Vec::new(),
str_buf_pool: Vec::new(),
str_buf_pool_cap: 4,
entry_tags_buf: Vec::new(),
chunk_compiler: Box::new(crate::jit::NullJitBackend),
trace_compiler: Box::new(crate::jit::NullJitBackend),
}
}
}