RFR: 8256302: releasing oopStorage when deflating allows for faster deleting
Robbin Ehn
rehn at openjdk.org
Wed Nov 23 15:25:31 UTC 2022
On Wed, 23 Nov 2022 00:33:54 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/share/runtime/synchronizer.cpp line 1266:
>>
>>> 1264: if (cmp != mark) {
>>> 1265: // Release object's oop storage since we don't need this ObjectMonitor:
>>> 1266: m->release_object();
>>
>> This looks a bit clunky - the caller should not need to know about the ObjectMonitor internals with regards to Oop storage management. Can't we keep the release in the destructor but guard it (if necessary) with a check to see if it is already released? It would be nice if release could be called more than once and was a no-op if already released. (I can't make enough sense of the Access API to know whether this is feasible/possible).
>
> This also made me wonder ... are we guaranteed the current thread is a JavaThread? If so the signature and use of `ObjectSynchronizer::inflate(Thread* current` could be changed. If not, isn't that a requirements for oop storage changes?
We can only release if the current thread is in VM, since we to call the destructor from blocked we can't release there.
But we can have an assert that WH is null, i.e. `~OM() { assert(_object.is_null(), "Missed one"); }`.
-------------
PR: https://git.openjdk.org/jdk/pull/11296
More information about the hotspot-runtime-dev
mailing list