RFR: 8254029: ObjectMonitor cleanup/minor bug-fix changes extracted from JDK-8253064
Daniel D.Daugherty
dcubed at openjdk.java.net
Mon Oct 19 16:26:16 UTC 2020
On Mon, 19 Oct 2020 11:22:21 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:
>> 8254029: ObjectMonitor cleanup/minor bug-fix changes extracted from JDK-8253064
>
> Looks great in general. I only have one question regarding when deflation would not be called by a Java thread (which
> is now checked for).
@fisk - Thanks for the review. Please let me know if I have resolved
your question.
> src/hotspot/share/runtime/synchronizer.cpp line 2366:
>
>> 2364: GVars.stw_random = os::random();
>> 2365:
>> 2366: if (self->is_Java_thread()) {
>
> When would this not be run by a Java thread?
`ObjectSynchronizer::do_final_audit_and_print_stats()` calls:
> L2958: ObjectSynchronizer::deflate_idle_monitors();
and do_final_audit_and_print_stats() is called from two places:
- void VM_Exit::doit() - The do_final_audit_and_print_stats() call happens
when the VMThread is executing the VM_Exit VM-op. That happens as
a result of a vm_exit() call a.k.a. System.exit().
- VMThread::run() - The do_final_audit_and_print_stats() call happens
after the VMThread has been terminated and finished processing
VM-ops. So this is the jni_DestroyJavaVM() path that happens when
the program falls off the end of main() and that thread does an
orderly shutdown of the VMThread.
A key piece of this changeset is moving the final audit to be executed
by the VMThread on one of its two exit code paths. The final audit
includes a calls to deflate_idle_monitors() to make sure things are as
clean as possible before doing the audit_and_print_stats() call.
None of this happens if the right logging is not enabled.
-------------
PR: https://git.openjdk.java.net/jdk/pull/641
More information about the hotspot-runtime-dev
mailing list