Improvements for latest Cranelift

This commit is contained in:
bjorn3 2020-05-05 12:16:28 +02:00
parent f8add1960a
commit 27cc90effa
2 changed files with 13 additions and 17 deletions

View File

@ -197,11 +197,6 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
if let Some(ref mcr) = &context.mach_compile_result {
for &MachSrcLoc { start, end, loc } in mcr.sections.get_srclocs_sorted() {
// FIXME get_srclocs_sorted omits default srclocs
if func_end < start {
line_program.row().address_offset = func_end as u64;
create_row_for_span(line_program, self.mir.span);
}
line_program.row().address_offset = start as u64;
if !loc.is_default() {
let source_info = *source_info_set.get_index(loc.bits() as usize).unwrap();
@ -211,12 +206,10 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
}
func_end = end;
}
// FIXME get_srclocs_sorted omits default srclocs
if func_end < mcr.sections.total_size() {
line_program.row().address_offset = func_end as u64;
create_row_for_span(line_program, self.mir.span);
func_end = mcr.sections.total_size();
}
line_program.end_sequence(func_end as u64);
func_end = mcr.sections.total_size();
} else {
let encinfo = isa.encoding_info();
let mut blocks = func.layout.blocks().collect::<Vec<_>>();
@ -235,12 +228,11 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
func_end = offset + size;
}
}
line_program.end_sequence(func_end as u64);
}
assert_ne!(func_end, 0);
line_program.end_sequence(func_end as u64);
let entry = self.debug_context.dwarf.unit.get_mut(self.entry_id);
entry.set(
gimli::DW_AT_low_pc,

View File

@ -9,7 +9,7 @@ use crate::backend::WriteDebugInfo;
pub(crate) struct UnwindContext<'tcx> {
tcx: TyCtxt<'tcx>,
frame_table: FrameTable,
cie_id: CieId,
cie_id: Option<CieId>,
}
impl<'tcx> UnwindContext<'tcx> {
@ -18,9 +18,13 @@ impl<'tcx> UnwindContext<'tcx> {
module: &mut Module<impl Backend>,
) -> Self {
let mut frame_table = FrameTable::default();
let cie = module.isa().create_systemv_cie().expect("SystemV unwind info CIE");
let cie_id = frame_table.add_cie(cie);
let cie_id = if let Some(cie) = module.isa().create_systemv_cie() {
Some(frame_table.add_cie(cie))
} else {
None
};
UnwindContext {
tcx,
@ -38,7 +42,7 @@ impl<'tcx> UnwindContext<'tcx> {
match unwind_info {
UnwindInfo::SystemV(unwind_info) => {
self.frame_table.add_fde(self.cie_id, unwind_info.to_fde(Address::Symbol {
self.frame_table.add_fde(self.cie_id.unwrap(), unwind_info.to_fde(Address::Symbol {
symbol: func_id.as_u32() as usize,
addend: 0,
}));