RFR: 8257625: C2: Harden input checks in vector intrinsics
Vladimir Kozlov
kvn at openjdk.java.net
Wed Dec 2 23:16:59 UTC 2020
On Wed, 2 Dec 2020 19:27:53 GMT, Vladimir Ivanov <vlivanov 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
Starting code and checks in vectorIntrinsics.cpp intrinsics is very repetitive.
Is it possible to facto it into one for some of them?
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?
src/hotspot/share/opto/vectorIntrinsics.cpp line 418:
> 416: if (vector_klass == NULL || elem_klass == NULL || shuffle_klass == NULL || shuffle->is_top() || vlen == NULL) {
> 417: return false; // dead code
> 418: }
print_intrinsics() missing for this and following case.
src/hotspot/share/opto/vectornode.cpp line 195:
> 193: // Unimplemented for subword types since bit count changes
> 194: // depending on size of lane (and sign bit).
> 195: return 0;
Above comment should be changes.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1575
More information about the hotspot-compiler-dev
mailing list