RFR: 8367333: C2: Vector math operation intrinsification failure [v2]
Vladimir Ivanov
vlivanov at openjdk.org
Tue Sep 16 20:09:18 UTC 2025
> As part of [JDK-8353786](https://bugs.openjdk.org/browse/JDK-8353786), C2 support for operations backed by the vector math library was completely removed. On JDK side, there is a special dispatching logic added to avoid intrinsic calls in `jdk.internal.vm.vector.VectorSupport`. But it's still possible to observe such paradoxical situations (intrinsic calls with obsolete operation IDs) when processing effectively dead code.
>
> Consider `FloatVector::lanewiseTemplate`:
>
> FloatVector lanewiseTemplate(VectorOperators.Unary op) {
> if (opKind(op, VO_SPECIAL)) {
> ...
> else if (opKind(op, VO_MATHLIB)) {
> return unaryMathOp(op);
> }
> }
> int opc = opCode(op);
> return VectorSupport.unaryOp(opc, ...);
> }
>
>
> At runtime, `unaryMathOp` is unconditionally invoked, but during compilation it's possible to end up with an intrinsification attempt of `VectorSupport.unaryOp()` before `opKind(op, VO_SPECIAL)` is inlined.
>
> It can be reliably reproduced `-XX:+StressIncrementalInlining` flag.
>
> The fix is to fail-fast intrinsification rather than crashing the VM.
>
> Testing: tier1 - tier4
Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:
review feedback
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/27263/files
- new: https://git.openjdk.org/jdk/pull/27263/files/66892f1d..f63e76ce
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=27263&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=27263&range=00-01
Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/27263.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27263/head:pull/27263
PR: https://git.openjdk.org/jdk/pull/27263
More information about the hotspot-compiler-dev
mailing list