RFR(S): 8229212 clear up CHECK_OWNER confusion in objectMonitor.cpp

Daniel D. Daugherty daniel.daugherty at oracle.com
Thu Aug 8 14:25:22 UTC 2019


Greetings,

Discussions with David Holmes about ObjectMonitors revealed a bit of
a mess with the CHECK_OWNER macro and the ObjectMonitor::check() and
ObjectMonitor::check_slow() functions. I have a small fix to clean up
this bit of messy code.

The bug URL:

     JDK-8229212 clear up CHECK_OWNER confusion in objectMonitor.cpp
     https://bugs.openjdk.java.net/browse/JDK-8229212

The webrev URL:

     http://cr.openjdk.java.net/~dcubed/8229212-webrev/0_for_jdk14/

Summary of the fix:

     Merge the CHECK_OWNER macro and the ObjectMonitor::check() and
     ObjectMonitor::check_slow() functions into a new function:

         ObjectMonitor::check_owner_and_throw_IMSE_if_not()

     Update the CHECK_OWNER and check() call sites to use
     check_owner_and_throw_IMSE_if_not(). Update the comments
     to make the intended semantics clear.

Also included a new test for when Object.wait(), Object.notify()
and Object.notifyAll() are called a thread that doesn't own the
Java monitor.

Test with Mach5 Tier[1-3] on the usual Oracle platforms. Verified
that the new test passes on all Oracle platforms. It's a Tier1
test but its duration is < 1s on every platform.

Thanks, in advance, for any comments, questions or suggestions.

Dan



More information about the hotspot-runtime-dev mailing list