RFR: 8257625: C2: Harden input checks in vector intrinsics
Vladimir Ivanov
vlivanov at openjdk.java.net
Wed Dec 2 23:53:56 UTC 2020
On Wed, 2 Dec 2020 23:06:27 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Input validation in vector intrinsics is not robust enough to filter out all problematic cases.
>>
>> Initially, vector intrinsics were fed with constant values, but after recent API refactoring the implementation started to rely more on JIT abilities to optimize complex code shapes and it exposed the intrinsics to some pathological case caused by operation in effectively dead code (JIT can't prove the code is dead, but it's never executed in practive) where different paradoxes are observed (e.g., arguments have impossible values) or dying parts of the graph.
>>
>> The fix is to strengthen input validation and bail out when TOP or unexpected values are observed.
>>
>> (Surprisingly, incremental inlining turned out to be quite good at stressing those situations. My guess is it's the result of delayed/bulk cleanup between iteration attempts.)
>>
>> Testing:
>> - [x] jdk/incubator/vector w/ and w/o -XX:+AlwaysIncrementalInline
>
> src/hotspot/share/opto/vectorIntrinsics.cpp line 326:
>
>> 324: if (shuffle_klass == NULL || vlen == NULL || start_val == NULL || step_val == NULL || wrap == NULL) {
>> 325: return false; // dead code
>> 326: }
>
> Should you also print some intrinsic message for following check?
I don't think it's needed. That's effectively dead code and the message won't provide any actionable information.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1575
More information about the hotspot-compiler-dev
mailing list