diff --git a/ykrt/src/compile/jitc_llvm.rs b/ykrt/src/compile/jitc_llvm.rs index 87b321913..8437892dd 100644 --- a/ykrt/src/compile/jitc_llvm.rs +++ b/ykrt/src/compile/jitc_llvm.rs @@ -5,7 +5,7 @@ use crate::{ compile::{CompilationError, CompiledTrace, Compiler}, location::HotLocation, mt::{SideTraceInfo, MT}, - trace::TracedAOTBlock, + trace::{TraceIterator, TracedAOTBlock}, }; use object::{Object, ObjectSection}; use parking_lot::Mutex; @@ -32,10 +32,11 @@ impl Compiler for JITCLLVM { fn compile( &self, mt: Arc, - irtrace: Vec, + aottrace_iter: Box, sti: Option, hl: Arc>, ) -> Result { + let irtrace = aottrace_iter.collect::>(); let (func_names, bbs, trace_len) = self.encode_trace(&irtrace); let llvmbc = llvmbc_section(); diff --git a/ykrt/src/compile/jitc_yk/mod.rs b/ykrt/src/compile/jitc_yk/mod.rs index 52bd8ddb5..8d60c6b86 100644 --- a/ykrt/src/compile/jitc_yk/mod.rs +++ b/ykrt/src/compile/jitc_yk/mod.rs @@ -5,7 +5,7 @@ use crate::{ compile::{CompiledTrace, Compiler}, location::HotLocation, mt::{SideTraceInfo, MT}, - trace::TracedAOTBlock, + trace::TraceIterator, }; use parking_lot::Mutex; use std::{ @@ -60,7 +60,7 @@ impl Compiler for JITCYk { fn compile( &self, _mt: Arc, - mtrace: Vec, + aottrace_iter: Box, sti: Option, _hl: Arc>, ) -> Result { @@ -77,6 +77,7 @@ impl Compiler for JITCYk { eprintln!("--- End aot ---"); } + let mtrace = aottrace_iter.collect::>(); let jit_mod = trace_builder::build(&aot_mod, &mtrace)?; if PHASES_TO_PRINT.contains(&IRPhase::PreOpt) { diff --git a/ykrt/src/compile/mod.rs b/ykrt/src/compile/mod.rs index 9b664b999..9ae46d570 100644 --- a/ykrt/src/compile/mod.rs +++ b/ykrt/src/compile/mod.rs @@ -1,7 +1,7 @@ use crate::{ location::HotLocation, mt::{SideTraceInfo, MT}, - trace::TracedAOTBlock, + trace::TraceIterator, }; use libc::c_void; use parking_lot::Mutex; @@ -41,7 +41,7 @@ pub(crate) trait Compiler: Send + Sync { fn compile( &self, mt: Arc, - irtrace: Vec, + aottrace_iter: Box, sti: Option, hl: Arc>, ) -> Result; diff --git a/ykrt/src/mt.rs b/ykrt/src/mt.rs index c5812cfa1..40947d292 100644 --- a/ykrt/src/mt.rs +++ b/ykrt/src/mt.rs @@ -484,7 +484,6 @@ impl MT { let mt = Arc::clone(self); let do_compile = move || { mt.stats.timing_state(TimingState::TraceMapping); - let irtrace = trace_iter.collect::>(); debug_assert!( sidetrace.is_none() || matches!(hl_arc.lock().kind, HotLocationKind::Compiled(_)) ); @@ -497,7 +496,7 @@ impl MT { let guardid = sidetrace.as_ref().map(|x| x.0.guardid); match compiler.compile( Arc::clone(&mt), - irtrace, + trace_iter, sidetrace.as_ref().map(|x| x.0), Arc::clone(&hl_arc), ) {