RFR: 8305903: Deflate monitors of dead objects before they become unreachable

Roman Kennke rkennke at openjdk.org
Wed May 3 05:48:13 UTC 2023


On Wed, 3 May 2023 05:12:32 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> I agree with Stefan that it seems wrong to be putting object monitor cleaning code into the generic OopStorage and
> 
> WeakProcessor code.
> 
> 
> 
> > Of course, because the object is now gone, the `deflate_monitor()` code can't fix the header and that didn't used to be a problem. Well actually it's not really a problem in the current mainline, but will be with Lilliput.
> 
> 
> 
> Why do we need to fix the header of a dead object?  It's dead.  Who cares what's in the header?  Nobody should
> 
> be touching dead objects.  Yes, I know there is heap walking stuff that does that, which is arguably a bug.  If its a
> 
> choice between fixing that or doing something like this, well, I'd really like to not do this.
> 
> 

Hmm ok, what choice do we have? In Lilliput we synchronize GC threads with the monitor deflation handshake (which I am also going to upstream ASAP). Given that it is the G1 refinement thread that heap-walks dead objects with monitors, I guess it may be possible to let the refinement thread join the STS around heap walking and thus block deletion of monitors until it's done. I'm not totally sure if that'd work or even if that is feasible (how much time does G1 refinement spend in heap walking? Would it block monitor deflation for too long? What if monitors got deflated right before we start walking? Etc)

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

PR Comment: https://git.openjdk.org/jdk/pull/13721#issuecomment-1532478024


More information about the hotspot-dev mailing list