Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
minor / style: we could have declared the -1 value as a constexpr value (
k_invalid_j9_method_class?)Is checking the -1 value not enough (to avoid the isOpenJ9 call) ?
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.
Hm, now when rereading the comment, this does not make much sense.
The info from J9 engineers is about invalid jmethodid becoming
-1- but that's not what we were seeing, right? It was thejclassreturned fromGetMethodDeclaringClasson such invalid jmethodid that was-1.I mean, the workaround would work but the root cause seems to be J9 not handling the invalid jmethodids consistently in the JVMTI calls itself (eg.
GetMethodDeclaringClasswhen called on an invalid jmethodid should return an error code instead of putting -1 to a jclass variable 🤷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.
I agree with this. I believe that this fixed in later versions of J9, but is considered acceptable for others (hence
version-dependentin the PR title). It would be more accurate to do a specific J9 version check here rather than simply!VM::isOpenJ9(), but that opens up the possibility of us missing some versions in our known-to-be-buggy list.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.
@r1viollet
constexpr, it doesn't hurtisOpenJ9()earlier - it returns a boolean based on a member that is set once at profiler startup, so I think the call is negligible. I added the check prior to adding the comments for the sake of self-documenting code, but also to remove the comparison for non-J9 VMs. WDYT - remove it?java-profiler/ddprof-lib/src/main/cpp/vmEntry.h
Line 169 in 82a3272
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.