RFR: 8320206: Some intrinsics/stubs missing vzeroupper on x86_64

Vladimir Kozlov kvn at openjdk.org
Thu Nov 16 18:39:30 UTC 2023


On Wed, 15 Nov 2023 21:28:46 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

> The following intrinsics/stubs are missing vzeroupper:
> adler32 (since JDK17)
> count_positives (since JDK 9)
> chacha20 (since JDK 20)
> string indexOfChar (since JDK 9)
> 
> Adding the missing vzeroupper to avoid AVX-SSE transition penalties.

Okay. Then if intrinsic stub is called only from compiled code you don't need `vzeroupper`. You only need it if intrinsics are called from Interpreter or runtime. Which are `crc32`, `crc32c`, `float16` intrinsics [templateInterpreterGenerator.cpp#L472](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp#L472)

Arraycopy stubs could  be used by VM's runtime, I think. At least they are called from `test_arraycopy_func`.

I may forgot something about intrinsics. Why we need `vzeroupper` on all intrinsics exit?

There was actually the issue with `vzeroupper` called in intrinsics: [JDK-8078113](https://bugs.openjdk.org/browse/JDK-8078113).
Then there was [JDK-8178811](https://bugs.openjdk.org/browse/JDK-8178811) and followup [JDK-8190934](https://bugs.openjdk.org/browse/JDK-8190934)

There are a lot of places in VM currently where  `vzeroupper` and it is a mess but we need to clean it up to clear state where we should use it. May be add comments in all places where it is called to state why it is called there.

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

PR Comment: https://git.openjdk.org/jdk/pull/16678#issuecomment-1815019744


More information about the hotspot-compiler-dev mailing list