[lworld+vector] RFR: 8320815: [lworld+vector] Fix vector API jtreg crashes with "-XX:InlineFieldMaxFlatSize=0"

Jatin Bhateja jbhateja at openjdk.org
Mon Dec 11 07:08:46 UTC 2023


On Mon, 11 Dec 2023 01:59:15 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> src/hotspot/share/opto/inlinetypenode.cpp line 319:
>> 
>>> 317:   } else if (is_vector_payload(vk)) {
>>> 318:      assert(field_value(0)->as_InlineType()->field_count() == nfields, "");
>>> 319:   }
>> 
>> Its not very clear, why will these assertions offend because C2 IR is in synchronism with ci Model. Also given that C2 always creates a InlineTypeNode for a value object. Even for a non-flattened field compile injects a re-materializing InlineTypeNode from the loaded value oop.
>
> The assertion fails on line 318. Use `Int256Vector` as an example, if the payload is not flattened and the multifields are not vectorized, `field_value(0)->as_InlineType()->field_count()` should be 8, while the `nfields` of the vector value object is 1.

Thanks for explanation, agree to this change.

> This issue happens when scalarizing an merging allocation which has inlinetype, instead of scalarizing a single `InlineTypeNode`. Skiping over doing this optimization for InlineTypeNode may lose some optimization oppportunity? 

Thanks @XiaohongGong , IIRC compiler allocates a buffer for an InlineTypeNode **if and only iff** it has a non-flattened user, this mean allocated buffers are non-eliminatable, and regular escape analysis will not able to remove allocations and perform scalar replacements. In principle we do need to pass larval state for value object reconstruction during de-optimization, so additional booking for larval state is correct.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/958#discussion_r1422010486
PR Review Comment: https://git.openjdk.org/valhalla/pull/958#discussion_r1422010280



More information about the valhalla-dev mailing list