RFR: 8291714: Implement a Multi-Reader Single-Writer mutex for Hotspot

Coleen Phillimore coleenp at openjdk.org
Thu Aug 18 20:26:38 UTC 2022


On Fri, 12 Aug 2022 05:07:40 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> May I please have a review for this PR which implements a `MRWMutex` class for Hotspot?
>> 
>> This PR does 3 things:
>> 
>> * Adds a port of ZGC's MRSW mutex (see [0]) to Hotspot
>> * Adds some new utilities for writing multi-threaded tests.
>> * Adds some tests for MRSW Mutex using these new utilities
>> 
>> The ticket has some comments which might be worth checking out: https://bugs.openjdk.org/browse/JDK-8291714
>> 
>> [0] Original source code here: https://github.com/openjdk/zgc/blob/zgc_generational/src/hotspot/share/gc/z/zJNICritical.cpp
>
> src/hotspot/share/runtime/mrswMutex.hpp line 56:
> 
>> 54: 
>> 55:   template<typename T>
>> 56:   class Locker : public StackObj {
> 
> Why does this need to be a template? We only use it with PlatformMonitor.

I have to echo David's question about this and the TBIVM template.  I think we can be specific in both cases, so that this is understandable.  If there become reasons to templateize it, we can add that.

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

PR: https://git.openjdk.org/jdk/pull/9838


More information about the hotspot-runtime-dev mailing list