Migrate Vector API math library (SVML and SLEEF) linkage from native code (in 
JVM) to Java FFM API.

Since FFM API doesn't support vector calling conventions yet, migration affects 
only symbol lookup for now. But it still enables significant simplifications on 
JVM side.

The patch consists of the following parts:
  * on-demand symbol lookup in Java code replaces eager lookup from native code 
during JVM startup;
  * 2 new VM intrinsics for vector calls (support unary and binary shapes) 
(code separated from unary/binary vector operations);
  * new internal interface to query supported CPU ISA extensions 
(`jdk.incubator.vector.CPUFeatures`) used for CPU dispatching.

`java.lang.foreign` API is used to perform symbol lookup in vector math 
library, then the address is cached and fed into corresponding JVM intrinsic, 
so C2 can turn it into a direct vector call in generated code.

Once `java.lang.foreign` supports vectors & vector calling conventions, VM 
intrinsics can go away. 

Performance is on par with original implementation (tested with microbenchmarks 
on linux-x64 and macosx-aarch64).

Testing: hs-tier1 - hs-tier6, microbenchmarks (on linux-x64 and macosx-aarch64)

Thanks!

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

Commit messages:
 - Misc fixes and cleanups
 - CPU features support
 - Cleanup
 - TODO list
 - SVML fixes
 - Update templates
 - fixes
 - SLEEF improvements
 - cleanup
 - VectorMathLib: Migrate to lambdas
 - ... and 3 more: https://git.openjdk.org/jdk/compare/9fcb06f9...fc27aee5

Changes: https://git.openjdk.org/jdk/pull/24462/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24462&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8353786
  Stats: 1274 lines in 43 files changed: 825 ins; 393 del; 56 mod
  Patch: https://git.openjdk.org/jdk/pull/24462.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24462/head:pull/24462

PR: https://git.openjdk.org/jdk/pull/24462

Reply via email to