Skip to content

Commit d05e713

Browse files
committed
[WIP] Disable debuginfo generation
1 parent f068349 commit d05e713

File tree

4 files changed

+48
-42
lines changed

4 files changed

+48
-42
lines changed

src/base.rs

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ pub(crate) struct CodegenedFunction {
2626
func_id: FuncId,
2727
func: Function,
2828
clif_comments: CommentWriter,
29-
func_debug_cx: Option<FunctionDebugContext>,
29+
//func_debug_cx: Option<FunctionDebugContext>,
3030
inline_asm: String,
3131
}
3232

3333
pub(crate) fn codegen_fn<'tcx>(
3434
tcx: TyCtxt<'tcx>,
3535
cgu_name: Symbol,
36-
mut debug_context: Option<&mut DebugContext>,
37-
type_dbg: &mut TypeDebugContext<'tcx>,
36+
//mut debug_context: Option<&mut DebugContext>,
37+
//type_dbg: &mut TypeDebugContext<'tcx>,
3838
cached_func: Function,
3939
module: &mut dyn Module,
4040
instance: Instance<'tcx>,
@@ -65,9 +65,9 @@ pub(crate) fn codegen_fn<'tcx>(
6565
func.clear();
6666
func.name = UserFuncName::user(0, func_id.as_u32());
6767
func.signature = sig;
68-
if cx.debug_context.is_some() {
69-
func.collect_debug_info();
70-
}
68+
//if cx.debug_context.is_some() {
69+
// func.collect_debug_info();
70+
//}
7171

7272
let mut bcx = FunctionBuilder::new(&mut func, &mut func_ctx);
7373

@@ -84,23 +84,22 @@ pub(crate) fn codegen_fn<'tcx>(
8484
assert_eq!(pointer_ty(tcx), pointer_type);
8585
let clif_comments = crate::pretty_clif::CommentWriter::new(tcx, instance, fn_abi);
8686

87-
let func_debug_cx = if let Some(debug_context) = debug_context.as_deref_mut() {
87+
/*let func_debug_cx = if let Some(debug_context) = debug_context.as_deref_mut() {
8888
Some(debug_context.define_function(tcx, type_dbg, instance, fn_abi, &symbol_name, mir.span))
8989
} else {
90-
None
91-
};
90+
None
91+
};*/
9292

9393
let exception_slot = bcx.declare_var(pointer_type);
9494

9595
let mut fx = FunctionCx {
9696
module,
97-
debug_context,
97+
//debug_context,
9898
tcx,
9999
target_config,
100100
pointer_type,
101101
constants_cx: ConstantCx::new(),
102-
func_debug_cx,
103-
102+
//func_debug_cx,
104103
cgu_name,
105104
instance,
106105
symbol_name,
@@ -125,7 +124,7 @@ pub(crate) fn codegen_fn<'tcx>(
125124
// Recover all necessary data from fx, before accessing func will prevent future access to it.
126125
let symbol_name = fx.symbol_name;
127126
let clif_comments = fx.clif_comments;
128-
let func_debug_cx = fx.func_debug_cx;
127+
//let func_debug_cx = fx.func_debug_cx;
129128
let inline_asm = fx.inline_asm;
130129

131130
fx.constants_cx.finalize(fx.tcx, &mut *fx.module);
@@ -144,7 +143,14 @@ pub(crate) fn codegen_fn<'tcx>(
144143
// Verify function
145144
verify_func(tcx, &clif_comments, &func);
146145

147-
CodegenedFunction { symbol_name, func_id, func, clif_comments, func_debug_cx, inline_asm }
146+
CodegenedFunction {
147+
symbol_name,
148+
func_id,
149+
func,
150+
clif_comments,
151+
//func_debug_cx,
152+
inline_asm,
153+
}
148154
}
149155

150156
pub(crate) fn compile_fn(
@@ -153,7 +159,7 @@ pub(crate) fn compile_fn(
153159
should_write_ir: bool,
154160
cached_context: &mut Context,
155161
module: &mut dyn Module,
156-
debug_context: Option<&mut DebugContext>,
162+
//debug_context: Option<&mut DebugContext>,
157163
global_asm: &mut String,
158164
codegened_func: CodegenedFunction,
159165
) {
@@ -248,6 +254,7 @@ pub(crate) fn compile_fn(
248254
}
249255
}
250256

257+
/*
251258
// Define debuginfo for function
252259
profiler.generic_activity("generate debug info").run(|| {
253260
if let Some(debug_context) = debug_context {
@@ -258,6 +265,7 @@ pub(crate) fn compile_fn(
258265
);
259266
}
260267
});
268+
*/
261269
}
262270

263271
fn verify_func(tcx: TyCtxt<'_>, writer: &crate::pretty_clif::CommentWriter, func: &Function) {

src/common.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,12 @@ pub(crate) fn create_wrapper_function(
270270

271271
pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
272272
pub(crate) module: &'m mut dyn Module,
273-
pub(crate) debug_context: Option<&'clif mut DebugContext>,
273+
//pub(crate) debug_context: Option<&'clif mut DebugContext>,
274274
pub(crate) tcx: TyCtxt<'tcx>,
275275
pub(crate) target_config: TargetFrontendConfig, // Cached from module
276276
pub(crate) pointer_type: Type, // Cached from module
277277
pub(crate) constants_cx: ConstantCx,
278-
pub(crate) func_debug_cx: Option<FunctionDebugContext>,
279-
278+
//pub(crate) func_debug_cx: Option<FunctionDebugContext>,
280279
pub(crate) cgu_name: Symbol,
281280
pub(crate) instance: Instance<'tcx>,
282281
pub(crate) symbol_name: String,
@@ -406,14 +405,14 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
406405
}
407406

408407
pub(crate) fn set_debug_loc(&mut self, source_info: mir::SourceInfo) {
409-
if let Some(debug_context) = &mut self.debug_context {
408+
/*if let Some(debug_context) = &mut self.debug_context {
410409
let (file_id, line, column) =
411410
debug_context.get_span_loc(self.tcx, self.mir.span, source_info.span);
412411
413412
let source_loc =
414413
self.func_debug_cx.as_mut().unwrap().add_dbg_loc(file_id, line, column);
415414
self.bcx.set_srcloc(source_loc);
416-
}
415+
}*/
417416
}
418417

419418
pub(crate) fn get_caller_location(&mut self, source_info: mir::SourceInfo) -> CValue<'tcx> {

src/driver/aot.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,15 @@ fn emit_cgu(
349349
prof: &SelfProfilerRef,
350350
name: String,
351351
module: UnwindModule<ObjectModule>,
352-
debug: Option<DebugContext>,
352+
//debug: Option<DebugContext>,
353353
global_asm_object_file: Option<PathBuf>,
354354
producer: &str,
355355
) -> Result<ModuleCodegenResult, String> {
356356
let mut product = module.finish();
357357

358-
if let Some(mut debug) = debug {
359-
debug.emit(&mut product);
360-
}
358+
// if let Some(mut debug) = debug {
359+
// debug.emit(&mut product);
360+
// }
361361

362362
let module_regular = emit_module(
363363
output_filenames,
@@ -512,15 +512,15 @@ fn codegen_cgu_content(
512512
tcx: TyCtxt<'_>,
513513
module: &mut dyn Module,
514514
cgu_name: rustc_span::Symbol,
515-
) -> (Option<DebugContext>, Vec<CodegenedFunction>, String) {
515+
) -> (Vec<CodegenedFunction>, String) {
516516
let _timer = tcx.prof.generic_activity_with_arg("codegen cgu", cgu_name.as_str());
517517

518518
let cgu = tcx.codegen_unit(cgu_name);
519519
let mono_items = cgu.items_in_deterministic_order(tcx);
520520

521-
let mut debug_context = DebugContext::new(tcx, module.isa(), false, cgu_name.as_str());
521+
//let mut debug_context = DebugContext::new(tcx, module.isa(), false, cgu_name.as_str());
522522
let mut global_asm = String::new();
523-
let mut type_dbg = TypeDebugContext::default();
523+
//let mut type_dbg = TypeDebugContext::default();
524524
super::predefine_mono_items(tcx, module, &mono_items);
525525
let mut codegened_functions = vec![];
526526
for (mono_item, item_data) in mono_items {
@@ -546,8 +546,8 @@ fn codegen_cgu_content(
546546
let codegened_function = crate::base::codegen_fn(
547547
tcx,
548548
cgu_name,
549-
debug_context.as_mut(),
550-
&mut type_dbg,
549+
//debug_context.as_mut(),
550+
//&mut type_dbg,
551551
Function::new(),
552552
module,
553553
instance,
@@ -556,9 +556,9 @@ fn codegen_cgu_content(
556556
}
557557
MonoItem::Static(def_id) => {
558558
let data_id = crate::constant::codegen_static(tcx, module, def_id);
559-
if let Some(debug_context) = debug_context.as_mut() {
560-
debug_context.define_static(tcx, &mut type_dbg, def_id, data_id);
561-
}
559+
// if let Some(debug_context) = debug_context.as_mut() {
560+
// debug_context.define_static(tcx, &mut type_dbg, def_id, data_id);
561+
// }
562562
}
563563
MonoItem::GlobalAsm(item_id) => {
564564
rustc_codegen_ssa::base::codegen_global_asm(
@@ -570,7 +570,7 @@ fn codegen_cgu_content(
570570
}
571571
crate::main_shim::maybe_create_entry_wrapper(tcx, module, false, cgu.is_primary());
572572

573-
(debug_context, codegened_functions, global_asm)
573+
(codegened_functions, global_asm)
574574
}
575575

576576
fn module_codegen(
@@ -583,8 +583,7 @@ fn module_codegen(
583583
) -> OngoingModuleCodegen {
584584
let mut module = make_module(tcx.sess, cgu_name.as_str().to_string());
585585

586-
let (mut debug_context, codegened_functions, mut global_asm) =
587-
codegen_cgu_content(tcx, &mut module, cgu_name);
586+
let (codegened_functions, mut global_asm) = codegen_cgu_content(tcx, &mut module, cgu_name);
588587

589588
let cgu_name = cgu_name.as_str().to_owned();
590589

@@ -609,7 +608,7 @@ fn module_codegen(
609608
should_write_ir,
610609
&mut cached_context,
611610
&mut module,
612-
debug_context.as_mut(),
611+
//debug_context.as_mut(),
613612
&mut global_asm,
614613
codegened_func,
615614
);
@@ -634,7 +633,7 @@ fn module_codegen(
634633
&profiler,
635634
cgu_name,
636635
module,
637-
debug_context,
636+
//debug_context,
638637
global_asm_object_file,
639638
&producer,
640639
)

src/driver/jit.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, jit_args: Vec<String>) -> ! {
6464
tcx,
6565
&output_filenames,
6666
should_write_ir,
67-
debug_context.as_mut(),
67+
//debug_context.as_mut(),
6868
&mut cached_context,
6969
&mut jit_module,
7070
inst,
@@ -124,7 +124,7 @@ fn codegen_and_compile_fn<'tcx>(
124124
tcx: TyCtxt<'tcx>,
125125
output_filenames: &OutputFilenames,
126126
should_write_ir: bool,
127-
mut debug_context: Option<&mut DebugContext>,
127+
//mut debug_context: Option<&mut DebugContext>,
128128
cached_context: &mut Context,
129129
module: &mut dyn Module,
130130
instance: Instance<'tcx>,
@@ -146,8 +146,8 @@ fn codegen_and_compile_fn<'tcx>(
146146
let codegened_func = crate::base::codegen_fn(
147147
tcx,
148148
sym::dummy_cgu_name,
149-
debug_context.as_deref_mut(),
150-
&mut TypeDebugContext::default(),
149+
//debug_context.as_deref_mut(),
150+
//&mut TypeDebugContext::default(),
151151
cached_func,
152152
module,
153153
instance,
@@ -160,7 +160,7 @@ fn codegen_and_compile_fn<'tcx>(
160160
should_write_ir,
161161
cached_context,
162162
module,
163-
debug_context.as_deref_mut(),
163+
//debug_context.as_deref_mut(),
164164
&mut global_asm,
165165
codegened_func,
166166
);

0 commit comments

Comments
 (0)