Merge pull request #2636 from bjorn3/fix_build_value_labels_ranges_no_labels

Fix build_value_labels_ranges for newBE when there are no labels
This commit is contained in:
Chris Fallin
2021-02-04 09:38:25 -08:00
committed by GitHub
5 changed files with 8 additions and 12 deletions

View File

@@ -81,7 +81,7 @@ impl MachBackend for AArch64Backend {
frame_size, frame_size,
disasm, disasm,
unwind_info, unwind_info,
value_labels_ranges: None, value_labels_ranges: Default::default(),
stackslot_offsets, stackslot_offsets,
}) })
} }

View File

@@ -76,7 +76,7 @@ impl MachBackend for Arm32Backend {
frame_size, frame_size,
disasm, disasm,
unwind_info: None, unwind_info: None,
value_labels_ranges: None, value_labels_ranges: Default::default(),
stackslot_offsets, stackslot_offsets,
}) })
} }

View File

@@ -343,7 +343,7 @@ pub struct MachCompileResult {
/// Unwind info. /// Unwind info.
pub unwind_info: Option<unwind_input::UnwindInfo<Reg>>, pub unwind_info: Option<unwind_input::UnwindInfo<Reg>>,
/// Debug info: value labels to registers/stackslots at code offsets. /// Debug info: value labels to registers/stackslots at code offsets.
pub value_labels_ranges: Option<ValueLabelsRanges>, pub value_labels_ranges: ValueLabelsRanges,
/// Debug info: stackslots to stack pointer offsets. /// Debug info: stackslots to stack pointer offsets.
pub stackslot_offsets: PrimaryMap<StackSlot, u32>, pub stackslot_offsets: PrimaryMap<StackSlot, u32>,
} }

View File

@@ -617,13 +617,13 @@ impl<I: VCodeInst> VCode<I> {
} }
/// Generates value-label ranges. /// Generates value-label ranges.
pub fn value_labels_ranges(&self) -> Option<ValueLabelsRanges> { pub fn value_labels_ranges(&self) -> ValueLabelsRanges {
if !self.has_value_labels { if !self.has_value_labels {
return None; return ValueLabelsRanges::default();
} }
let layout = &self.insts_layout.borrow(); let layout = &self.insts_layout.borrow();
Some(debug::compute(&self.insts, &layout.0[..], &layout.1[..])) debug::compute(&self.insts, &layout.0[..], &layout.1[..])
} }
/// Get the offsets of stackslots. /// Get the offsets of stackslots.

View File

@@ -113,12 +113,8 @@ pub fn build_value_labels_ranges<T>(
where where
T: From<SourceLoc> + Deref<Target = SourceLoc> + Ord + Copy, T: From<SourceLoc> + Deref<Target = SourceLoc> + Ord + Copy,
{ {
if mach_compile_result.is_some() && mach_compile_result.unwrap().value_labels_ranges.is_some() { if let Some(mach_compile_result) = mach_compile_result {
return mach_compile_result return mach_compile_result.value_labels_ranges.clone();
.unwrap()
.value_labels_ranges
.clone()
.unwrap();
} }
let values_labels = build_value_labels_index::<T>(func); let values_labels = build_value_labels_index::<T>(func);