RFR: 8255596: Mutex safepoint checking options and flags should be scoped enums

Kim Barrett kbarrett at openjdk.java.net
Mon Nov 2 10:03:54 UTC 2020


On Fri, 30 Oct 2020 15:27:31 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Please review this change to some enums in the Mutex class.
>> SafepointCheckFlag and SafepointCheckRequired are changed to scoped
>> enums.  Also removed the anonymous enum defining _allow_vm_block_flag
>> and _as_suspend_equivalent_flag, instead defining those as bool
>> constants.
>> 
>> To avoid changing all references to the SafepointCheckXXX enumerators
>> (due to the additional scoping introduced by using scoped enums), same
>> named constants are defined at Mutex class scope.  Some renaming might
>> be preferable in the long term, but I didn't want to do that just to
>> get the improved type checking.  An X-macro approach to defining the
>> enumerators and hoisting them into class scope could have been taken,
>> but the number of enumerators here doesn't seem to warrant the additional
>> infrastructure to do so.
>> 
>> Changing the enum types uncovered a few places in the implementation
>> of Mutex and MutexLocker where enum values were being implicitly
>> converted to bool, with associated assumptions about the order or
>> values of the enumerators.  Those have been fixed.
>> 
>> Testing:
>> tier1
>
> Lgtm.

Thanks @tschatzl and @robehn for reviews.

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

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


More information about the hotspot-dev mailing list