[lworld] RFR: 8267791: [lworld][lw3] Support compiler blackholes for inline types [v2]

Aleksey Shipilev shade at openjdk.java.net
Mon May 31 13:05:34 UTC 2021


On Mon, 31 May 2021 12:46:53 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> The expected behavior is debatable. Current behavior in the corner cases does make sense to me: for non-flattened cases, we blackhole the reference to wrapper (as that is what application code would be exposed to), in flattened cases, we blackhole the components (as that is what application code would be exposed to). 
>> 
>> I probably misunderstand the compiler code here. Can there be an allocated box that goes away later, and only the component accesses survive? If so, how should this code ask for "if the allocated instance is alive, then blackhole it"?
>
> On second thought, I think this is fine.
> 
>> Can there be an allocated box that goes away later, and only the component accesses survive?
> 
> Yes, in general that can happen and is not unlikely. For example, due to late inlining or other optimizations removing a non-scalarizable use of the buffer allocation. However, in this case all such optimizations are already over and unused allocations would have been removed. I.e., if `vt->is_allocated` is true, there is a user of the buffer allocation that won't go away and therefore linking the allocation to the blackhole should be fine.

Right. So my understanding was correct: this is a final elimination phase, and we can trust `vt->_is_allocated`. I did a few more experiments, and they seem to produce the expected (AFAICS) generated code.

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

PR: https://git.openjdk.java.net/valhalla/pull/429


More information about the valhalla-dev mailing list