Skip to content

Commit

Permalink
Do not GC function declarations
Browse files Browse the repository at this point in the history
Declarations must be consistent across compilation units.
  • Loading branch information
SingleAccretion committed Nov 6, 2024
1 parent e02a925 commit e645202
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/cranelift/src/debug/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ fn build_unit_dependencies(
Ok(())
}

fn has_die_back_edge(die: &read::DebuggingInformationEntry<Reader<'_>>) -> bool {
match die.tag() {
fn has_die_back_edge(die: &read::DebuggingInformationEntry<Reader<'_>>) -> read::Result<bool> {
let result = match die.tag() {
constants::DW_TAG_variable
| constants::DW_TAG_constant
| constants::DW_TAG_inlined_subroutine
Expand All @@ -124,8 +124,10 @@ fn has_die_back_edge(die: &read::DebuggingInformationEntry<Reader<'_>>) -> bool
| constants::DW_TAG_variant_part
| constants::DW_TAG_variant
| constants::DW_TAG_formal_parameter => true,
constants::DW_TAG_subprogram => die.attr(constants::DW_AT_declaration)?.is_some(),
_ => false,
}
};
Ok(result)
}

fn has_valid_code_range(
Expand Down Expand Up @@ -223,7 +225,7 @@ fn build_die_dependencies(
let child_entry = child.entry();
let child_offset = child_entry.offset().to_unit_section_offset(unit);
deps.add_edge(child_offset, offset);
if has_die_back_edge(child_entry) {
if has_die_back_edge(child_entry)? {
deps.add_edge(offset, child_offset);
}
if has_valid_code_range(child_entry, dwarf, unit, at)? {
Expand Down

0 comments on commit e645202

Please sign in to comment.