Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[DWARF] Synthetic type centralization #9700

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

SingleAccretion
Copy link
Contributor

@SingleAccretion SingleAccretion commented Dec 1, 2024

The DWARF transform needs to add some "synthetic" types to the output, mainly to represent the VMContext structure.

So far, these types were being added to each CU, which is unnecessary overhead since they're exactly the same in each CU in a given module.

This change moves them to a single per-module CU that is references via DWARF's DW_FORM_ref_addr mechanism.

This is an optimization in both time (the debugger needs fewer types to keep track of) and space (the .debug_info section is ~5% smaller on some DWARF input I have).

unit_id
}

fn create_vmctx_ptr_die(
Copy link
Contributor Author

@SingleAccretion SingleAccretion Dec 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below code was simply moved from utils.rs without functional changes.

Comment on lines -348 to +346
let mut module_wasm_types = PrimaryMap::new();
for (module, memory_offset) in compilation.module_memory_offsets.iter() {
let wasm_types = add_wasm_types(unit, root_id, out_strings, memory_offset);
let i = module_wasm_types.push(wasm_types);
assert_eq!(i, module);
}

let wasm_types = add_wasm_types(unit, root_id, out_strings);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all of the remaining wasm_types are module-invariant, there is no longer a need for them to be per-module.

@SingleAccretion SingleAccretion changed the title [NativeAOT-LLVM] Synthetic type centralization Synthetic type centralization Dec 1, 2024
@SingleAccretion SingleAccretion changed the title Synthetic type centralization [DWARF] Synthetic type centralization Dec 1, 2024
@SingleAccretion SingleAccretion marked this pull request as ready for review December 1, 2024 21:22
@SingleAccretion SingleAccretion requested a review from a team as a code owner December 1, 2024 21:22
@SingleAccretion SingleAccretion requested review from alexcrichton and removed request for a team December 1, 2024 21:22
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alexcrichton alexcrichton added this pull request to the merge queue Dec 2, 2024
Merged via the queue into bytecodealliance:main with commit af476a5 Dec 2, 2024
40 checks passed
@SingleAccretion SingleAccretion deleted the DI-Synth branch December 15, 2024 20:45
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants