RFR: 8256302: releasing oopStorage when deflating allows for faster deleting [v5]

Coleen Phillimore coleenp at openjdk.org
Tue Jun 6 19:52:12 UTC 2023


On Sun, 4 Jun 2023 14:18:41 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Releasing ObjectMonitor oopStorage earlier when deflating allows ObjectMonitor
>> deletion by a JavaThread (usually the MonitorDeflationThread) to happen while a
>> ThreadBlockInVM helper is in place. This should improve time-to-safepoint.
>
> Daniel D. Daugherty 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 five additional commits since the last revision:
> 
>  - Merge tag 'jdk-21+25' into JDK-8256302
>    
>    Added tag jdk-21+25 for changeset a46b5acc
>  - Allow ObjectMonitor::_object to be reset to nullptr when it is released which allows the code to be cleaner.
>  - Merge tag 'jdk-21+23' into JDK-8256302
>    
>    Added tag jdk-21+23 for changeset 6d4782bc
>  - address the easy dholmes and kimbarrett CR comments
>  - 8256302: releasing oopStorage when deflating allows for faster deleting

I had a couple questions because I don't remember exactly how this works.  The change looks good though.

src/hotspot/share/oops/weakHandle.hpp line 57:

> 55:   void release(OopStorage* storage) const;
> 56:   bool is_null() const { return _obj == nullptr; }
> 57:   void set_null() { _obj = nullptr; }

I would be a lot happier if WeakHandle.release() was non-const and set the _obj to nullptr, so that nothing can do this without release the weak handle.
This could be a follow-up RFE though since it affects other WeakHandle.release() calls.

src/hotspot/share/runtime/objectMonitor.cpp line 282:

> 280:     // Release object's oop storage if it hasn't already been done.
> 281:     release_object();
> 282:   }

In what case, would the object's oop storage not already been released?  Is the destructor called here because of GC, where the object has been collected?

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

PR Review: https://git.openjdk.org/jdk/pull/11296#pullrequestreview-1465935253
PR Review Comment: https://git.openjdk.org/jdk/pull/11296#discussion_r1220212866
PR Review Comment: https://git.openjdk.org/jdk/pull/11296#discussion_r1220230990


More information about the hotspot-runtime-dev mailing list