Skip to content

[GR-56599] Create type units for types during debuginfo generation for referencing across multiple debug info files. #9802

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

graalvmbot
Copy link
Collaborator

Each type is currently generated within a compilation unit, with no way to reference it from outside the .debug_info section. During debuginfo generation at image runtime, we have to create a separate debuginfo file that references types generated during image build. This would require to reproduce debuginfo for types that was already created at image build.

One way to reference types in different objectfiles is to put them into so-called type units and create type signatures that can be used as references. Each type is placed in its own type unit and type references will be changed to refer to the type units. During the runtime debuginfo generation, we can then reference existing types by the type signature.

Type units were introduced in DWARF 4 in their own debugging section (.debug_types) and moved to the .debug_info section in DWARF 5 to reduce overhead. As a change to DWARF 5 requires little changes and makes creating type units more convenient, we will also update the DWARF version of the .debug_info section to DWARF 5.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 2, 2024
@graalvmbot graalvmbot force-pushed the doma/GR-56599 branch 3 times, most recently from 6e1b849 to 12ee8a5 Compare October 22, 2024 08:20
@olpaw
Copy link
Member

olpaw commented Nov 27, 2024

Hi @dominikmascherbauer

the PR is in good shape already. I only have a few questions before we can merge this:

  • Did you check if this causes any regressions in debuginfo generation time of the image builder?
  • Is it guaranteed that the classloader contributes to the type signatures for everything except primitive types?

Copy link
Member

@olpaw olpaw left a comment

Choose a reason for hiding this comment

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

Looks good overall.

Please process the comments and we should be able to merge this soon.

@dominikmascherbauer
Copy link
Collaborator

Hi @dominikmascherbauer

the PR is in good shape already. I only have a few questions before we can merge this:

* Did you check if this causes any regressions in debuginfo generation time of the image builder?

The time for debug info generation stays about the same, I checked that with debug info files with sizes of up to a few hundred MB.

* Is it guaranteed that the classloader contributes to the type signatures for everything except primitive types?

Yes, the classloader is looked up for all types except primitives (and the single instance of the header type which represents the object header).
The type signature then is the hash of the loader name and the type name, except for built-in classloaders (those are ignored in the hash).

* How does this change to dwarf5 + type signatures affect debug-info size?

Overall, this achieves a reduction of around 30% in debug info size, mostly due to the dwarf5 format changes of the .debug_loc and .debug_range sections.
Also, the loading time of debug info in gdb is reduced by about 15%.

Remove separate type unit for the layout of compressed types
@olpaw olpaw self-requested a review December 3, 2024 09:12
@graalvmbot graalvmbot closed this Dec 3, 2024
@graalvmbot graalvmbot merged commit 6146963 into master Dec 3, 2024
13 checks passed
@graalvmbot graalvmbot deleted the doma/GR-56599 branch December 3, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants