@@ -20,7 +20,6 @@ use crate::{BackendConfig, CodegenCx, CodegenMode};
2020
2121struct JitState {
2222 jit_module : UnwindModule < JITModule > ,
23- backend_config : BackendConfig ,
2423}
2524
2625thread_local ! {
@@ -60,14 +59,10 @@ impl UnsafeMessage {
6059 }
6160}
6261
63- fn create_jit_module (
64- tcx : TyCtxt < ' _ > ,
65- backend_config : & BackendConfig ,
66- hotswap : bool ,
67- ) -> ( UnwindModule < JITModule > , CodegenCx ) {
62+ fn create_jit_module ( tcx : TyCtxt < ' _ > , hotswap : bool ) -> ( UnwindModule < JITModule > , CodegenCx ) {
6863 let crate_info = CrateInfo :: new ( tcx, "dummy_target_cpu" . to_string ( ) ) ;
6964
70- let isa = crate :: build_isa ( tcx. sess , backend_config ) ;
65+ let isa = crate :: build_isa ( tcx. sess ) ;
7166 let mut jit_builder = JITBuilder :: with_isa ( isa, cranelift_module:: default_libcall_names ( ) ) ;
7267 jit_builder. hotswap ( hotswap) ;
7368 crate :: compiler_builtins:: register_functions_for_jit ( & mut jit_builder) ;
@@ -91,11 +86,8 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
9186 tcx. dcx ( ) . fatal ( "can't jit non-executable crate" ) ;
9287 }
9388
94- let ( mut jit_module, mut cx) = create_jit_module (
95- tcx,
96- & backend_config,
97- matches ! ( backend_config. codegen_mode, CodegenMode :: JitLazy ) ,
98- ) ;
89+ let ( mut jit_module, mut cx) =
90+ create_jit_module ( tcx, matches ! ( backend_config. codegen_mode, CodegenMode :: JitLazy ) ) ;
9991 let mut cached_context = Context :: new ( ) ;
10092
10193 let ( _, cgus) = tcx. collect_and_partition_mono_items ( ( ) ) ;
@@ -116,7 +108,6 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
116108 CodegenMode :: Jit => {
117109 codegen_and_compile_fn (
118110 tcx,
119- & backend_config,
120111 & mut cx,
121112 & mut cached_context,
122113 & mut jit_module,
@@ -171,7 +162,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
171162 LAZY_JIT_STATE . with ( |lazy_jit_state| {
172163 let mut lazy_jit_state = lazy_jit_state. borrow_mut ( ) ;
173164 assert ! ( lazy_jit_state. is_none( ) ) ;
174- * lazy_jit_state = Some ( JitState { jit_module, backend_config } ) ;
165+ * lazy_jit_state = Some ( JitState { jit_module } ) ;
175166 } ) ;
176167
177168 let f: extern "C" fn ( c_int , * const * const c_char ) -> c_int =
@@ -207,7 +198,6 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
207198
208199pub ( crate ) fn codegen_and_compile_fn < ' tcx > (
209200 tcx : TyCtxt < ' tcx > ,
210- backend_config : & BackendConfig ,
211201 cx : & mut crate :: CodegenCx ,
212202 cached_context : & mut Context ,
213203 module : & mut dyn Module ,
@@ -224,7 +214,6 @@ pub(crate) fn codegen_and_compile_fn<'tcx>(
224214 let cached_func = std:: mem:: replace ( & mut cached_context. func , Function :: new ( ) ) ;
225215 if let Some ( codegened_func) = crate :: base:: codegen_fn (
226216 tcx,
227- & backend_config,
228217 cx,
229218 & mut TypeDebugContext :: default ( ) ,
230219 cached_func,
@@ -286,14 +275,7 @@ fn jit_fn(instance_ptr: *const Instance<'static>, trampoline_ptr: *const u8) ->
286275 false ,
287276 Symbol :: intern ( "dummy_cgu_name" ) ,
288277 ) ;
289- codegen_and_compile_fn (
290- tcx,
291- & lazy_jit_state. backend_config ,
292- & mut cx,
293- & mut Context :: new ( ) ,
294- jit_module,
295- instance,
296- ) ;
278+ codegen_and_compile_fn ( tcx, & mut cx, & mut Context :: new ( ) , jit_module, instance) ;
297279
298280 assert ! ( cx. global_asm. is_empty( ) ) ;
299281 jit_module. finalize_definitions ( ) ;
0 commit comments