On Wed, 26 Oct 2022 17:10:00 GMT, David Holmes <[email protected]> wrote:

> At most an expanded -Xcheck:jni check for FP-state manipulation, with an
enhanced/fixed RestoreMXCSROnJNICalls is in order IMVHO.

FTR both `-Xcheck:jni` and `-XX:+RestoreMXCSROnJNICalls` already catch the 
problematic case being discussed.


$ .../jdk/bin/java ... compiler/floatingpoint/TestDenormalDouble
Exception in thread "main" java.lang.AssertionError: TEST FAILED: 0.0
        at 
compiler.floatingpoint.TestDenormalDouble.testDoubles(TestDenormalDouble.java:42)
        at 
compiler.floatingpoint.TestDenormalDouble.main(TestDenormalDouble.java:52)


$ .../jdk/bin/java ... -Xcheck:jni compiler/floatingpoint/TestDenormalDouble
Loading libfast-math.so
Java HotSpot(TM) 64-Bit Server VM warning: MXCSR changed by native JNI code, 
use -XX:+RestoreMXCSROnJNICall
Test passed.


$ .../jdk/bin/java ... -XX:+RestoreMXCSROnJNICalls 
compiler/floatingpoint/TestDenormalDouble
Loading libfast-math.so
Test passed.

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

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

Reply via email to