On Tue, 2 Jun 2026 02:15:35 GMT, Dean Long <[email protected]> wrote:

>> src/hotspot/share/opto/library_call.cpp line 7886:
>> 
>>> 7884:   Node* referent = argument(0);
>>> 7885:   if (referent->is_InlineType()) {
>>> 7886:     referent = referent->as_InlineType()->buffer(this);
>> 
>> Please explain.  The test doesn't trigger this code, so how do we test it?  
>> I thought the whole point of reachabilityFence was to prevent a finalizer 
>> from running too early, but what does that even mean for an InlineType that 
>> might not be heap allocated?  Wouldn't it be a no-op or even better, an 
>> error, like trying to synchronize on a value object?  Or are we now saying 
>> that reachabilityFence on an inline type really means "do not scalarize, 
>> make sure finalizer gets run, but not until we get here"?
>
> In other words, I think reachabilityFence() requires an identity object for 
> correct semantics.  I think there could be scenarios where buffering a copy 
> is not enough.  Does that mean that instead of the finalizer running exactly 
> 1 time, now it will run once for every buffered copy?

A `reachabilityFence` keeps the object alive, which, in turn, keeps its fields 
alive. We can implement this by looking at all of the oop fields of the 
`InlineTypeNode` and keeping them alive instead. I decided to go for the 
simplest solution, which is to ensure that the whole object is kept alive.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2496#discussion_r3338245864

Reply via email to