-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8247281: migrate ObjectMonitor::_object to OopStorage #135
Conversation
/contributor add Erik Österlund erik.osterlund@oracle.com |
👋 Welcome back dcubed! A progress list of the required criteria for merging this PR into |
@dcubed-ojdk Could not parse
|
@dcubed-ojdk Could not parse
|
@dcubed-ojdk The following labels will be automatically applied to this pull request: When this pull request is ready to be reviewed, an RFR email will be sent to the corresponding mailing lists. If you would like to change these labels, use the |
/contributor add Erik Österlund erik.osterlund@oracle.com |
/label remove serviceability,hotspot |
@dcubed-ojdk The |
@dcubed-ojdk |
@dcubed-ojdk |
@dcubed-ojdk The |
@fisk - Please chime in on this review when you get the chance. |
Webrevs
|
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.
The vast majority of these changes came from @fisk so I'm actually a
reviewer and stress tester of these changes. Thumbs up!
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 great Dan. I like your addition of is_chainmarker() - it makes this step a lot better, without having any special oops that are not oops. Thanks for sorting this out!
@dcubed-ojdk This change now passes all automated pre-integration checks. In addition to the automated checks, the change must also fulfill all project specific requirements After integration, the commit message will be:
Since the source branch of this PR was last updated there have been 104 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 automatic rebasing, please merge ➡️ To integrate this PR with the above commit message to the |
@fisk - Thanks for the blinding fast review! (Pretty easy when you wrote almost Re: is_chainmarker() |
@@ -3017,13 +3017,6 @@ inline bool VM_HeapWalkOperation::collect_simple_roots() { | |||
return false; | |||
} | |||
|
|||
// Inflated monitors | |||
blk.set_kind(JVMTI_HEAP_REFERENCE_MONITOR); |
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.
So we don't have to provide the equivalent of JVMTI_HEAP_REFERENCE_MONITOR?
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.
The JVMTI roots are strong roots. This is no longer a strong root, so reporting them would be a bug after this change.
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.
The function is VM_HeapWalkOperation::collect_simple_roots()
and we no longer have a root in the ObjectMonitor so my take is
no we don't. I believe @fisk concurs with that reasoning.
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, exactly.
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 for confirmation.
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.
From the spec I'm not clear on exactly what JVMTI_HEAP_REFERENCE_MONITOR is intended to be. Serviceability folk should be giving some input here though.
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've taken a first pass at creating a CSR:
JDK-8253121 migrate ObjectMonitor::_object to OopStorage
https://bugs.openjdk.java.net/browse/JDK-8253121
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.
Just a minor comment.
The line 1754 can be deleted as the JVMTI_HEAP_REFERENCE_MONITOR reference type will be never encountered:
1750 static jvmtiHeapRootKind toJvmtiHeapRootKind(jvmtiHeapReferenceKind kind) {
1751 switch (kind) {
1752 case JVMTI_HEAP_REFERENCE_JNI_GLOBAL: return JVMTI_HEAP_ROOT_JNI_GLOBAL;
1753 case JVMTI_HEAP_REFERENCE_SYSTEM_CLASS: return JVMTI_HEAP_ROOT_SYSTEM_CLASS;
1754 case JVMTI_HEAP_REFERENCE_MONITOR: return JVMTI_HEAP_ROOT_MONITOR;
1755 case JVMTI_HEAP_REFERENCE_STACK_LOCAL: return JVMTI_HEAP_ROOT_STACK_LOCAL;
1756 case JVMTI_HEAP_REFERENCE_JNI_LOCAL: return JVMTI_HEAP_ROOT_JNI_LOCAL;
1757 case JVMTI_HEAP_REFERENCE_THREAD: return JVMTI_HEAP_ROOT_THREAD;
1758 case JVMTI_HEAP_REFERENCE_OTHER: return JVMTI_HEAP_ROOT_OTHER;
1759 default: ShouldNotReachHere(); return JVMTI_HEAP_ROOT_OTHER;
1760 }
1761 }
Other than that the update in this file looks okay 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.
I cleaned that up. The only references to JVMTI_HEAP_REFERENCE_MONITOR and
JVMTI_HEAP_ROOT_MONITOR that remain are in the spec:
$ egrep -r 'JVMTI_HEAP_REFERENCE_MONITOR|JVMTI_HEAP_ROOT_MONITOR' src/hotspot
src/hotspot/share/prims/jvmti.xml:
src/hotspot/share/prims/jvmti.xml:
src/hotspot/share/prims/jvmti.xml: JVMTI_HEAP_ROOT_MONITOR
,
} | ||
void do_oop(oop* obj_p) { | ||
u4 size = 1 + sizeof(address); | ||
writer()->start_sub_record(HPROF_GC_ROOT_MONITOR_USED, size); |
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 had a similar question to the jvmtiTagMap question above. Are there tools that are going to miss seeing this tag in the heap dump? I hope these tags are implementation defined and we can just remove them. Otherwise, should there be a loop through the OM list to print out these tags for live object monitors?
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.
Same answer as above. No longer a strong root, so can't report it as such.
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.
We no longer have a root in the ObjectMonitor so no we don't have
to dump these is my take. I believe @fisk concurs with that reasoning.
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.
Agreed.
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.
Ok, that's good then!
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 for confirmation.
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 don't see anything in the HPROF format description that claims this is a strong root. At a minimum this seems to be a behavioural change that would warrant a CSR request. This also seems to be something that the serviceability folk should be made aware of and have a chance to comment on.
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've taken a first pass at creating a CSR:
JDK-8253121 migrate ObjectMonitor::_object to OopStorage
https://bugs.openjdk.java.net/browse/JDK-8253121
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've looked at the CSR and added myself as a reviewer.
We had a slack chat with Dan, and I agree that with a weak handle it would be racy/unsafe for JVMTI_HEAP_REFERENCE_MONITOR calls back to be called. The ObjectMonitors do not pin objects anymore (there are no strong refs from them), so it has to be okay to skip reporting the JVMTI_HEAP_REFERENCE_MONITOR and and JVMTI_HEAP_ROOT_MONITOR (old Heap Walking API) reference types. The JVMTI does not need an update as other VM implementations can still report these reference types. Alan added a comment to the CSR saying that memory profiling tools that use the JVMTI functions (FollowReferences with jvmtiHeapReferenceCallback or IterateOverReachableObjects with jvmtiHeapRootCallback) to iterate over the heap should not have a compatibility impact as these reference types are just informational but adding a release note can be useful.
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.
Slight clarification. Serguei and I were discussing whether we could continue
to make JVMTI_HEAP_REFERENCE_MONITOR call backs or emit
HPROF_GC_ROOT_MONITOR_USED entries in heap dump output as a
way to ease the transition phase of getting used to these things going
away. My answer was that we could do that but it would racy and unsafe
due to the ObjectMonitor's object being GC'ed.
It's also incorrect to make JVMTI_HEAP_REFERENCE_MONITOR call backs
or emit HPROF_GC_ROOT_MONITOR_USED entries in heap dump once
the ObjectMonitor's object ref becomes a weak handle. That weak handle
no longer prevents the associated object from being GC'ed so it is no
longer a strong root.
See Erik's comment above: #135 (comment)
@coleenp, @rkennke, and @kimbarrett - I believe all of the changes that you have requested @dholmes-ora - I don't think you asked for any specific code changes. I've taken a first pass Please look it over and feel free to edit as needed. Since I don't do |
It looks good to me now! I've also build with Shenandoah GC, and run our sanity-tests (TEST=hotspot_gc_shenandoah) and all looks good. Thank you! |
@rkennke - Thanks for confirming that Shenandoah now builds with the changes |
…h about markWords.
/csr needed Edit: I missed that this was already flagged. |
@dholmes-ora an approved CSR request is already required for this pull request. |
@@ -241,13 +241,12 @@ void ObjectMonitor::operator delete[] (void *p) { | |||
operator delete(p); | |||
} | |||
|
|||
#ifdef ASSERT |
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.
There would be less #ifdef ASSERT
clutter if just the body of check_object_context were conditionalized. Then the calls wouldn't need to be. Your 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.
I'll make that change.
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 for removing it.
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 to me!
@@ -3017,13 +3017,6 @@ inline bool VM_HeapWalkOperation::collect_simple_roots() { | |||
return false; | |||
} | |||
|
|||
// Inflated monitors | |||
blk.set_kind(JVMTI_HEAP_REFERENCE_MONITOR); |
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.
Just a minor comment.
The line 1754 can be deleted as the JVMTI_HEAP_REFERENCE_MONITOR reference type will be never encountered:
1750 static jvmtiHeapRootKind toJvmtiHeapRootKind(jvmtiHeapReferenceKind kind) {
1751 switch (kind) {
1752 case JVMTI_HEAP_REFERENCE_JNI_GLOBAL: return JVMTI_HEAP_ROOT_JNI_GLOBAL;
1753 case JVMTI_HEAP_REFERENCE_SYSTEM_CLASS: return JVMTI_HEAP_ROOT_SYSTEM_CLASS;
1754 case JVMTI_HEAP_REFERENCE_MONITOR: return JVMTI_HEAP_ROOT_MONITOR;
1755 case JVMTI_HEAP_REFERENCE_STACK_LOCAL: return JVMTI_HEAP_ROOT_STACK_LOCAL;
1756 case JVMTI_HEAP_REFERENCE_JNI_LOCAL: return JVMTI_HEAP_ROOT_JNI_LOCAL;
1757 case JVMTI_HEAP_REFERENCE_THREAD: return JVMTI_HEAP_ROOT_THREAD;
1758 case JVMTI_HEAP_REFERENCE_OTHER: return JVMTI_HEAP_ROOT_OTHER;
1759 default: ShouldNotReachHere(); return JVMTI_HEAP_ROOT_OTHER;
1760 }
1761 }
Other than that the update in this file looks okay to me.
I added a release note (https://bugs.openjdk.java.net/browse/JDK-8253225) describing that these roots are now weak, and hence won't be reported. Please have a look at that, to make sure what I am describing makes sense. |
@kimbarrett - Thanks for the cleanup suggestion. |
@kimbarrett and @sspitsyn - Your most recent comments should be resolved via 215084a. |
/integrate |
@dcubed-ojdk Since your change was applied there have been 104 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit d8921ed. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This RFE is to migrate the following field to OopStorage:
class ObjectMonitor {
void* volatile _object; // backward object pointer - strong root
Unlike the previous patches in this series, there are a lot of collateral
changes so this is not a trivial review. Sorry for the tedious parts of
the review. Since Erik and I are both contributors to this patch, we
would like at least 1 GC team reviewer and 1 Runtime team reviewer.
This changeset was tested with Mach5 Tier[1-3],4,5,6,7,8 testing
along with JDK-8252980 and JDK-8252981. I also ran it through my
inflation stress kit for 48 hours on my Linux-X64 machine.
Progress
Issue
Reviewers
Contributors
<erik.osterlund@oracle.com>
<daniel.daugherty@oracle.com>
Download
$ git fetch https://git.openjdk.java.net/jdk pull/135/head:pull/135
$ git checkout pull/135