[15] RFR(S): 8239142: C2's UseUniqueSubclasses optimization is broken for array accesses
Tobias Hartmann
tobias.hartmann at oracle.com
Mon Feb 17 10:24:49 UTC 2020
Hi Erik,
thanks for the review!
Best regards,
Tobias
On 17.02.20 11:22, erik.osterlund at oracle.com wrote:
> Hi Tobias,
>
> Nice catch. Looks good.
>
> Thanks,
> /Erik
>
> On 2/17/20 10:48 AM, Tobias Hartmann wrote:
>> Hi,
>>
>> please review the following patch:
>> https://bugs.openjdk.java.net/browse/JDK-8239142
>> http://cr.openjdk.java.net/~thartmann/8239142/webrev.00/
>>
>> While investigating a performance issue that Sergey reported with Valhalla, I've noticed that C2's
>> UseUniqueSubclasses optimization for array accesses is broken since JDK 11 b15. When accessing an
>> array of an abstract klass type that has only one subtype, C2 registers a dependency and narrows the
>> type of the array elements to that one subtype:
>> http://hg.openjdk.java.net/jdk/jdk/file/690fc7e5a90f/src/hotspot/share/opto/parse2.cpp#l126
>>
>> The fix for JDK-8202377 [1] added code that overwrites the elemtype and therefore disables this
>> optimization: http://hg.openjdk.java.net/jdk/jdk/rev/ffa644980dff#l27.26
>>
>> My fix simply removes the lines that overwrite the elemtype. I've manually verified that the
>> generated code is now equal to before JDK 11 b15.
>>
>> Thanks,
>> Tobias
>>
>> [1] https://bugs.openjdk.java.net/browse/JDK-8202377
>
More information about the hotspot-compiler-dev
mailing list