RFR: 8256474: Migrate Mutex _owner accesses to use Atomic operations [v2]

Coleen Phillimore coleenp at openjdk.java.net
Tue Nov 24 12:30:01 UTC 2020


On Tue, 24 Nov 2020 02:07:19 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> David Holmes has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - Fixed comment typo
>>  - Merge branch 'master' into 8256474
>>  - 8256474: Migrate Mutex _owner accesses to use Atomic operations
>
> src/hotspot/share/runtime/mutex.hpp line 89:
> 
>> 87:   // the low-level _lock, or to NULL after it has released the _lock. Accesses by any thread other
>> 88:   // than the lock owner are inherently racy.
>> 89:   Thread* _owner;
> 
> My understanding of the idiom of using Atomic always rather than relying on any semantics for volatile is that the volatile qualifier is left on the variable, as a marker/indicator/clue that it is interesting.  This will also help us find such if/when we adopt some kind of atomic class for encapsulation (whether std::atomic or something like what was proposed for JDK-8247213) and help track adoption progress.  So I think the volatile qualifier should be retained.

Yes, sorry.  I thought we'd decided what Kim said.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1402


More information about the hotspot-runtime-dev mailing list