RFR: 8266936: Add a finalization JFR event [v11]

Coleen Phillimore coleenp at openjdk.java.net
Fri Sep 17 12:05:47 UTC 2021


On Mon, 13 Sep 2021 17:12:49 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

>> Greetings,
>> 
>> Object.finalize() was deprecated in JDK9. There is an ongoing effort to replace and mitigate Object.finalize() uses in the JDK libraries; please see https://bugs.openjdk.java.net/browse/JDK-8253568 for more information. 
>> 
>> We also like to assist users in replacing and mitigating uses in non-JDK code.
>> 
>> Hence, this changeset adds a periodic JFR event to help identify which classes are overriding Object.finalize().
>> 
>> Thanks
>> Markus
>
> Markus Grönlund has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - remove rehashing and rely on default grow_hint for table resize
>  - mtStatistics

src/hotspot/share/runtime/mutexLocker.cpp line 323:

> 321: 
> 322: #if INCLUDE_JFR
> 323:   def(JfrMsg_lock                  , PaddedMonitor, leaf-1,      true,  _safepoint_check_always); // -1 because the ConcurrentHashTable resize lock is leaf

The ConcurrentHashTable_lock is a lock that doesn't check for safepoints, so if you take this lock out while checking for safepoints, it should assert when called from a JavaThread, which makes me think it's not called from a JavaThread and should be _safepoint_check_never.
  _resize_lock =
    new Mutex(Mutex::nosafepoint-2, "ConcurrentHashTableResize_lock",
              Mutex::_safepoint_check_never);
In my change, this is the ranking for ConcurrentHashTableResize_lock, so this should be nosafepoint-3 if  you check in after I do.

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

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


More information about the serviceability-dev mailing list