-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Use method entries instead of primary ranges for method DIE generation #3419
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
Conversation
0b85d0c to
2a6e7f0
Compare
adinn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine modulo a few small changes to make it clearer what is going on and a bit of finessing the rebase against the change pending in head
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java
Outdated
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java
Outdated
Show resolved
Hide resolved
...tevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfInfoSectionImpl.java
Outdated
Show resolved
Hide resolved
2a6e7f0 to
2c1f22c
Compare
|
@adinn I have updated the PR to resolve your comments, please re-review :) |
adinn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good.
|
It looks like something broke with the rebase. Looking into it! |
61c048d to
67c38b7
Compare
|
It turns out this will have to wait for #3421 to get merged first. |
c5105e4 to
328ad90
Compare
As of oracle#3304 we associate every range with the `MethodEntry` of the method it was compiled from, and as a result we know that a `MethodEntry` exists for each compiled method in the image. Actually we create `MethodEntry`s even for methods that are not compiled but are part of `ClassEntry` that describes a Class reachable from in the image. For every range we generate a DIE (Debugging Information Entry) which references another DIE that holds the specification of the method that this range was generated from. So for every range we need a method DIE containing information for the corresponding method. Till now we have been generating these DIEs by traversing the primary ranges of each ClassEntry. There are, however, subranges that might be compiled from a method that is not referenced by a primary range, e.g., inlined methods. This patch ensures that every method that is compiled in the native image (including inlined ones) will get a method DIE.
328ad90 to
a0cf3be
Compare
|
CI failures seem unrelated to the PR. |
adinn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is still reviewed after latest changes
|
@olpaw This next patch is now ready for review. It looks good to me. |
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java
Outdated
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MethodEntry.java
Show resolved
Hide resolved
substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MethodEntry.java
Show resolved
Hide resolved
olpaw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Small changes requested as described in the other comments.
Makes sense - so that @zakkak can get his PR merged and continue with the implementation of debuginfo for inlined methods. |
I've had some issues opening PRs against @zakkak 's repo - I'm chasing them down but have sent him the patch. Actually I made 2 patches:
I mention this because my time zone is fairly late compared to @zakkak so I thought this lets the conversation start early. |
This allows us to work around the NPE observed in oracle#3419 (comment) Co-Authored-By: Simon Tooke <[email protected]>
Removes the need of creating a dummy RelocationRecord to work around the NPE observed in oracle#3419 (comment) Co-Authored-By: Simon Tooke <[email protected]>
12beae4 to
2676016
Compare
|
Hi @olpaw, I have integrated @stooke's patches and squashed the revert and fixup commits as mentioned in #3419 (comment) . The new changes are in 7d01a04 (Simon's minimal patch to work around the issue) and 2676016 (Simon's larger patch with some refactoring in place). If things look good I suggest squashing the two commits in one. |
|
Hi @zakkak with the patches from @stooke even building fails nows: |
If the MethodEntry was added by traversing the DeclaredMethods of a Class its fileEntry will point to the original source file, thus it will be wrong for substituted methods. As a result when setting a MethodEntry as isInRange we also make sure that its fileEntry reflects the file info associated with the corresponding Range.
I originally considered LinkedList more appropriate because despite the less efficient sort, it allows us to perform a sorted insertion in ensureMethodEntryForDebugRangeInfo() without having to shift elements. However, given that adding more methods to the ClassEntry during code processing (and thus needing sorted insertions) appears to be rare (empirically), the cost of shifting the elements might indeed be not significant, so I am chaning methods to ArrayList following Paul Woegerer's suggestion.
Note: Generating the signatures on demand and not in the constructor seems beneficial as it results in producing ~10900 signatures for the ~16600 `MethodEntry`s that we generate for the `hello.Hello` example we use in debuginfo testing.
This allows us to work around the NPE observed in oracle#3419 (comment) Co-Authored-By: Simon Tooke <[email protected]>
Removes the need of creating a dummy RelocationRecord to work around the NPE observed in oracle#3419 (comment) Co-Authored-By: Simon Tooke <[email protected]>
2676016 to
0bfd722
Compare
Alright, rerunning CI gates now ... |
@zakkak this time the CI passed just fine. ... except for one truffle-ruby gate that fails which clearly has nothing to do with your changes. Once we get the truffle-ruby gate fixed your PR will be in the merge queue. There is nothing more to do on your side. With a bit of luck the PR should be on master by the end of this week. |
|
Nice, thank you Paul! |
|
Now in the merge queue (on 3rd place) |
Removes the need of creating a dummy RelocationRecord to work around the
NPE observed in
oracle/graal#3419 (comment)
Co-Authored-By: Simon Tooke <[email protected]>
This allows us to work around the NPE observed in
oracle/graal#3419 (comment)
Co-Authored-By: Simon Tooke <[email protected]>
As of #3304 we associate every range
with the
MethodEntryof the method it was compiled from, and as aresult we know that a
MethodEntryexists for each compiled method inthe image. Actually we create
MethodEntrys even for methods that arenot compiled but are part of
ClassEntrythat describes a Classreachable in the image.
For every range we generate a DIE (Debugging Information Entry) which
references another DIE that holds the specification of the method that
this range was generated from. So for every range we need a method DIE
containing information for the corresponding method.
Till now we have been generating these DIEs by traversing the primary
ranges of each ClassEntry. There are, however, subranges that might be
compiled from a method that is not referenced by a primary range, e.g.,
inlined methods.
This patch ensures that every method that is compiled in the native
image (including inlined ones) will get a method DIE.