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

Aleksey Shipilev shade at openjdk.java.net
Mon May 31 09:45:17 UTC 2021

On Thu, 27 May 2021 07:28:57 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request incrementally with two additional commits since the last revision:
>>  - Replace: box -> buffer
>>  - Move the test
> src/hotspot/share/opto/compile.cpp line 1931:
>> 1929:       } else {
>> 1930:         // Check if any users are blackholes. If so, rewrite them to use either the
>> 1931:         // allocated box, or individual components, instead of the inline type node
> Better replace `box` by `buffer`.


> src/hotspot/share/opto/compile.cpp line 1945:
>> 1943:             if (vt->is_allocated(&igvn)) {
>> 1944:               // Already has the allocated instance, blackhole that
>> 1945:               bh->add_req(vt->get_oop());
> This might keep an otherwise unused buffer allocation alive. Is that the expected behavior of using backholes on inline types? Why not always blackhole the components?

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"?

> test/hotspot/jtreg/runtime/valhalla/inlinetypes/BlackholeTest.java line 24:
>> 22:  */
>> 23: 
>> 24: package runtime.valhalla.inlinetypes;
> I think this test should go to compiler.



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

More information about the valhalla-dev mailing list