There is way to prevent Interpreter to use math intrinsics: -XX:-InlineIntrinsics
In such case it will call C code through JNI. But JIT compilers will still use pow() stub from libm.
As result produced result java/lang/Math/PowTests.java may fail.
java -Xcomp -XX:-TieredCompilation -XX:-InlineIntrinsics PowTests1
a: 0.3678794411714423 b: 0.36787944117144233
failed
Attached PowTests1.java test is shortened PowTests.java test prepared by Oleg Pliss.
One way to fix it (to get consistent results) is to not use libm stubs when InlineIntrinsics switched off:
- if (VM_Version::supports_sse2() && UseLibmIntrinsic) {
+ if (VM_Version::supports_sse2() && UseLibmIntrinsic && InlineIntrinsics) {
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dsin) ||
But it would be better if code in macroAssembler_x86_pow.cpp could be fixed.
It would be also nice to verify other libm stubs with -XX:-InlineIntrinsics
In such case it will call C code through JNI. But JIT compilers will still use pow() stub from libm.
As result produced result java/lang/Math/PowTests.java may fail.
java -Xcomp -XX:-TieredCompilation -XX:-InlineIntrinsics PowTests1
a: 0.3678794411714423 b: 0.36787944117144233
failed
Attached PowTests1.java test is shortened PowTests.java test prepared by Oleg Pliss.
One way to fix it (to get consistent results) is to not use libm stubs when InlineIntrinsics switched off:
- if (VM_Version::supports_sse2() && UseLibmIntrinsic) {
+ if (VM_Version::supports_sse2() && UseLibmIntrinsic && InlineIntrinsics) {
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dsin) ||
But it would be better if code in macroAssembler_x86_pow.cpp could be fixed.
It would be also nice to verify other libm stubs with -XX:-InlineIntrinsics
- relates to
-
JDK-8170693 Interpreter and JIT compilers should always use the same code for math intrinsics
-
- Open
-
-
JDK-8145688 update for x86 pow in the math lib
-
- Resolved
-