RFR: 8261397: Try Catch Method Failing to Work When Dividing An Integer By 0 [v3]

David Holmes dholmes at openjdk.java.net
Thu Feb 18 02:30:40 UTC 2021


On Wed, 17 Feb 2021 20:01:53 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> On Mac ARM hardware running x86 JDK under Rosetta emulation, a div by 0 instruction causes the VM to crash.
>> 
>> The proposed fix (a workaround) for hotspot is to add **FPE_FLTINV** to the signal handler.
>> 
>> The actual fix needs to be done in macOS by Apple as the expected signal type here is **FPE_FLTDIV**
>> This issue has been filed with Apple and they are tracking it.
>
> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
> 
>   add comment

Hi Gerard,

I'm concerned by the general problem of encountering new bugs because we are running on an x64 emulation mode on ARM! Is there any way to detect this Rosetta environment? Is there a way to know from the hs_err file (we don't have one for this issue yet) that we executed under Rosetta?

How will we track this bug on Apple's side, such that we can eventually remove this workaround?

The workaround itself seems okay as far as it goes but what happens if native code triggers a real FPE_FLTINV that we will now treat as "div by zero"?

Thanks,
David

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

PR: https://git.openjdk.java.net/jdk/pull/2615


More information about the hotspot-runtime-dev mailing list