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
JDK-8261520: JDK-8261302 breaks runtime/NMT/CheckForProperDetailStackTrace.java #2672
JDK-8261520: JDK-8261302 breaks runtime/NMT/CheckForProperDetailStackTrace.java #2672
Conversation
|
Webrevs
|
@@ -57,12 +57,13 @@ class MallocSite : public AllocationSite { | |||
class MallocSiteHashtableEntry : public CHeapObj<mtNMT> { | |||
private: | |||
MallocSite _malloc_site; | |||
const unsigned _hash; |
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.
Prefer "unsigned int" to be consist with other places. Otherwise, Looks good to me.
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.
Thank you Zhengyu!
I reverted to unsigned int. Using just unsigned is a bad habit of mine, sorry.
Cheers, Thomas
@tstuefe This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 18 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
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.
Yes this makes sense. I use NativeCallStack sometimes for debugging things and don't need the hash code, so this is good.
Yes, I do too. Also, I had some vague thoughts once about using it in UL to provide callstacks at log sites (was actually Robins idea). Thanks! |
/integrate |
@tstuefe Since your change was applied there have been 20 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 722142e. |
Since JDK-8261302, the test runtime/NMT/CheckForProperDetailStackTrace.java fails with
--
NativeCallStack
contains a hash code. Before JDK-8261302, that hash code was calculated lazily in a non-inline hashcode getter. With JDK-8261302, the hash code calculation was moved into theNativeCallStack
constructor and the getter was made inline.The
NativeCallStack
constructor fills itself viaos::get_native_stack()
. Before JDK-8261302, that call has been the last call in the constructor and hence had been sometimes optimized into a tail call. Whether or not its a tail call matters since it affects the number of stack frames the stack walker has to skip. Therefore, the constructor contains coding to predict tail-call-ness:This prediction was now off since the hash code calculation happened at the end of the callstack. This causes the test error, since on some platforms (eg Linux x64) we now think we have a tail call when we don't, which means we do not skip enough frames, and the NMT output contains call frames like "NativeCallStack::NativeCallStack()", which trips the test.
Fix:
This fix moves the hash code calculation completely out of NativeCallStack. There is no reason why NativeCallStack should have a hash code. It mainly exists as a convenience to place it in a hash map. The patch moves the hash code calculation up into MallocSiteTableEntry.
This has the advantage of only having to pay for a hash code when you need it - in theory, one may use NativeCallStack in places other than NMT, where it is unnecessary.
I considered other options:
os::get_native_stack()
to also calculate a hash in addition to capturing the stack, and return it in a caller provided variable. That would have left this call to be the tail call. However, it seemed less clean - we have two implementations of this function, as well as other, non-capturing, NativeCallStack constructors, which would have to be modified. It also would have madeos::get_native_stack()
less general purpose.Tests: GA, manual test, nightlies at SAP
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2672/head:pull/2672
$ git checkout pull/2672