33//! `CompiledModule` to allow compiling and instantiating to be done as separate
44//! steps.
55
6- use crate :: code:: EngineCode ;
6+ use crate :: { code:: EngineCode , Engine } ;
77use crate :: prelude:: * ;
88use crate :: profiling_agent:: ProfilingAgent ;
99use crate :: runtime:: vm:: CompiledModuleId ;
@@ -47,6 +47,7 @@ impl CompiledModule {
4747 /// The `profiler` argument here is used to inform JIT profiling runtimes
4848 /// about new code that is loaded.
4949 pub fn from_artifacts (
50+ engine : & Engine ,
5051 engine_code : Arc < EngineCode > ,
5152 info : CompiledModuleInfo ,
5253 index : Arc < CompiledFunctionsTable > ,
@@ -60,16 +61,20 @@ impl CompiledModule {
6061 index,
6162 func_names : info. func_names ,
6263 } ;
63- ret. register_profiling ( profiler) ?;
64+ ret. register_profiling ( engine , profiler) ?;
6465
6566 Ok ( ret)
6667 }
6768
68- fn register_profiling ( & mut self , profiler : & dyn ProfilingAgent ) -> Result < ( ) > {
69+ fn register_profiling ( & mut self , engine : & Engine , profiler : & dyn ProfilingAgent ) -> Result < ( ) > {
6970 // TODO-Bug?: "code_memory" is not exclusive for this module in the case of components,
7071 // so we may be registering the same code range multiple times here.
71- //
72- // TODO: register for each StoreCode.
72+
73+ if engine. tunables ( ) . debug_guest {
74+ // TODO(#12105): support this case.
75+ anyhow:: bail!( "Cannot register profiling when guest debugging is enabled" ) ;
76+ }
77+
7378 profiler. register_module ( self . engine_code . image ( ) , & |addr| {
7479 let idx = self . func_by_text_offset ( addr) ?;
7580 let idx = self . module . func_index ( idx) ;
0 commit comments