diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2020-12-25 11:49:50 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2020-12-25 11:49:50 +0100 |
| commit | 0b9b2532d262bf590b769a7cd2f32602b8925183 (patch) | |
| tree | 541dd4ac610075c05a833b89af26a36e0c840b78 | |
| parent | 20ffea6b8a9f614eed854adbba75626effc1f111 (diff) | |
| download | rust-0b9b2532d262bf590b769a7cd2f32602b8925183.tar.gz rust-0b9b2532d262bf590b769a7cd2f32602b8925183.zip | |
Move finalize CodegenCx timer out of codegen mono items timer
| -rw-r--r-- | src/driver/jit.rs | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/src/driver/jit.rs b/src/driver/jit.rs index 3a942a15491..cb386ea83b9 100644 --- a/src/driver/jit.rs +++ b/src/driver/jit.rs @@ -69,32 +69,36 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! { let mut cx = crate::CodegenCx::new(tcx, jit_module, false, false); - let (mut jit_module, global_asm, _debug, mut unwind_context) = - super::time(tcx, "codegen mono items", || { - super::predefine_mono_items(&mut cx, &mono_items); - for (mono_item, (linkage, visibility)) in mono_items { - let linkage = crate::linkage::get_clif_linkage(mono_item, linkage, visibility); - match mono_item { - MonoItem::Fn(inst) => { - cx.tcx.sess.time("codegen fn", || { - crate::base::codegen_fn(&mut cx, inst, linkage) - }); - } - MonoItem::Static(def_id) => { - crate::constant::codegen_static(&mut cx.constants_cx, def_id) - } - MonoItem::GlobalAsm(hir_id) => { - let item = cx.tcx.hir().expect_item(hir_id); - tcx.sess - .span_fatal(item.span, "Global asm is not supported in JIT mode"); - } + super::time(tcx, "codegen mono items", || { + super::predefine_mono_items(&mut cx, &mono_items); + for (mono_item, (linkage, visibility)) in mono_items { + let linkage = crate::linkage::get_clif_linkage(mono_item, linkage, visibility); + match mono_item { + MonoItem::Fn(inst) => { + cx.tcx.sess.time("codegen fn", || { + crate::base::codegen_fn(&mut cx, inst, linkage) + }); + } + MonoItem::Static(def_id) => { + crate::constant::codegen_static(&mut cx.constants_cx, def_id) + } + MonoItem::GlobalAsm(hir_id) => { + let item = cx.tcx.hir().expect_item(hir_id); + tcx.sess + .span_fatal(item.span, "Global asm is not supported in JIT mode"); } } - tcx.sess.time("finalize CodegenCx", || cx.finalize()) - }); + } + }); + + let (mut jit_module, global_asm, _debug, mut unwind_context) = + tcx.sess.time("finalize CodegenCx", || cx.finalize()); + jit_module.finalize_definitions(); + if !global_asm.is_empty() { tcx.sess.fatal("Inline asm is not supported in JIT mode"); } + crate::main_shim::maybe_create_entry_wrapper(tcx, &mut jit_module, &mut unwind_context, true); crate::allocator::codegen(tcx, &mut jit_module, &mut unwind_context); |
