RFR: JDK-8320892: AArch64: Restore FPU control state after JNI [v3]

Andrew Haley aph at openjdk.org
Tue Nov 28 15:58:07 UTC 2023


On Tue, 28 Nov 2023 15:09:19 GMT, Andrew Dinn <adinn at openjdk.org> wrote:

>> Andrew Haley has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix thinko
>
> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 4440:
> 
>> 4438:     bfi(tmp1, zr, 22, 4); // Clear DN, FZ, and Rmode
>> 4439:     bfi(tmp1, zr, 8, 5);  // Clear exception-control bits (8-12)
>> 4440:     eor(tmp1, tmp1, tmp2);
> 
> Hmm? So . . .
> 1) We ensure tmp1 has the bits we want by clearing DN FZ Rmode and Exception bits
> 2) we XOR tmp1 with the original bits (saved in tmp2) and put the 'difference' in tmp1 (?)
> 3) If the difference is zero we skip
> 4) Otherwise we write tmp1 (i.e. the 'difference' bits) to fpcr (???)
> 
> Should this not be
> 
>     get_fpcr(tmp1);
>     mov(tmp2, tmp1);
>     bfi(tmp1, zr, 22, 4);
>     bfi(tmp1, zr, 8, 5);
>     eor(tmp2, tmp1, tmp2)
>     cbz(tmp2, OK);
>     set_fpcr(tmp1);
>     bind(OK);

Argh, yes. The curse of the last-minute change...

Good catch.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16851#discussion_r1408000231


More information about the hotspot-dev mailing list