RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v10]

David Holmes dholmes at openjdk.org
Wed Oct 18 00:01:00 UTC 2023


On Tue, 17 Oct 2023 10:56:33 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> src/hotspot/cpu/x86/macroAssembler_x86.cpp line 5169:
>> 
>>> 5167:       // Perform a little arithmetic to make sure that denormal
>>> 5168:       // numbers are handled correctly, i.e. that the "Denormals Are
>>> 5169:       // Zeros" flag has not been set.
>> 
>> I don't understand what this part is doing. I thought it was simply checking so you could log/warn if the unexpected mode was detected. But it seems to cause MXCSR to not be restored when there is an issue, where I would expect you would always want to restore to overwrite the invalid mode the JNI call made. ??
>
> If we reach `FAIL`, MXCSR is reloaded from `addr_mxcsr_std()`, restoring correct IEEE behaviour. That's what RestoreMXCSROnJNICalls is supposed to do, as far as I can tell.
> 
> But I will take this part out, because there are other flags in MXCSR, so there is a potential compatibility problem if e.g. the Precision Mask were set in a JNI call.

Misread the code flow. So you were skipping the restore if you didn't think it was needed? The fact the restore was now conditional is what threw me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/10661#discussion_r1362939998


More information about the build-dev mailing list