RFR: 8305903: Deflate monitors of dead objects before they become unreachable
Roman Kennke
rkennke at openjdk.org
Tue May 2 09:29:15 UTC 2023
On Tue, 2 May 2023 07:50:17 GMT, David Holmes <dholmes at openjdk.org> wrote:
> Sorry I don't understand: how can we deflate and delete the monitor, yet not update the object header?
In OM::deflate_monitor() we check object_peek(), and if that returns null, then the object header is not updated (and can't be, because the object cannot be reached anymore). Concurrent GCs that process weak handles concurrently ensure that the object doesn't leak out by returning null there. However, for runtime code, at this point, there is no safe way to grab the object and update the header, because the GC might already have reclaimed it. The last safe point in time where we can do that is in WeakProcessor::Task::work() and OopStorage::weak_oops_do() itself, as soon as we detect that the object is properly unreachable.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13721#issuecomment-1531159654
More information about the hotspot-dev
mailing list