JDK-8238174 : migrate ObjectMonitor::_owner field away from C++ volatile semantics
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-01-29
  • Updated: 2021-05-28
  • Resolved: 2020-11-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b26Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The following fix is doing a partial cleanup on the
ObjectMonitor::_owner  field:

     JDK-8236035 refactor ObjectMonitor::set_owner() and _owner field setting

The focus of 8236035 was on the refactoring of set_owner()
and how the _owner field was set. Of course when you partially
cleanup code, folks tend to notice additional things that could
be done to make the code even better.

This RFE is focused on changing loads and stores to the
ObjectMonitor::_owner field to use Atomic::load() and
Atomic::store() along with removing the "volatile" specifier
on the ObjectMonitor::_owner field.

As part of this RFE: we should add:

  void* owner_raw() {
    Atomic::load(&_owner);
  }

probably as an inline function.

There is an existing owner() inline function that returns the owner field value
but it will substitute NULL for DEFLATER_MARKER. So the new owner_raw()
function is for those places that really want the actual value.

Migrating away from C++ volatile semantics is inspired by JDK-8234192.
Comments
Changeset: 1707d5ca Author: Daniel D. Daugherty <dcubed@openjdk.org> Date: 2020-11-18 16:48:17 +0000 URL: https://github.com/openjdk/jdk/commit/1707d5ca
18-11-2020

That should be owner() as per the style guide: - Getter accessor names are noun phrases, with no "get_" noise word. Boolean getters can also begin with "is_" or "has_". :)
29-01-2020