RFR: 8266267: Remove unnecessary jumps in Intel Math Library StubRoutines

Nils Eliasson neliasso at openjdk.java.net
Thu Apr 29 10:45:50 UTC 2021


On Thu, 29 Apr 2021 03:47:41 GMT, Jie Fu <jiefu at openjdk.org> wrote:

> Hi all,
> 
> May I get reviews for this small change?
> 
> If I look at the StubRoutines::libmPow carefully, an unnecessary jump instruction can be found, which is generated here [1].
> 
> - - - [BEGIN] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> StubRoutines::libmPow [0x00007f0f8455ddd1, 0x00007f0f8455ef05] (4404 bytes)
> --------------------------------------------------------------------------------
>   0x00007f0f8455ddd1:   push   %rbp
>   0x00007f0f8455ddd2:   mov    %rsp,%rbp
>   0x00007f0f8455ddd5:   jmpq   0x00007f0f8455ddda          <--- unnecessary jump
>   0x00007f0f8455ddda:   sub    $0x28,%rsp
>   0x00007f0f8455ddde:   vmovsd %xmm0,0x8(%rsp)
>   0x00007f0f8455dde4:   vmovsd %xmm1,0x10(%rsp)
>   ...
> 
> 
> And similar issues can be found for StubRoutines::libmLog and StubRoutines::libmExp.
> 
> - - - [BEGIN] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> StubRoutines::libmLog [0x00007f3fb94d48a6, 0x00007f3fb94d4b22] (636 bytes)
> --------------------------------------------------------------------------------
>   0x00007f3fb94d48a6:   push   %rbp
>   0x00007f3fb94d48a7:   mov    %rsp,%rbp
>   0x00007f3fb94d48aa:   jmpq   0x00007f3fb94d48af          <--- unnecessary jump
>   0x00007f3fb94d48af:   sub    $0x18,%rsp
>   0x00007f3fb94d48b3:   vmovsd %xmm0,(%rsp)
>   0x00007f3fb94d48b8:   movabs $0x3ff0000000000000,%rax
>   ...
> 
> 
> 
> - - - [BEGIN] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> StubRoutines::libmExp [0x00007f3fb94d4579, 0x00007f3fb94d48a6] (813 bytes)
> --------------------------------------------------------------------------------
>   0x00007f3fb94d4579:   push   %rbp
>   0x00007f3fb94d457a:   mov    %rsp,%rbp
>   0x00007f3fb94d457d:   jmpq   0x00007f3fb94d4582          <--- unnecessary jump
>   0x00007f3fb94d4582:   sub    $0x18,%rsp
>   0x00007f3fb94d4586:   vmovsd %xmm0,0x8(%rsp)
>   0x00007f3fb94d458c:   vunpcklpd %xmm0,%xmm0,%xmm0
> 
> 
> I can't find a reason why we need an extra jump there.
> So I suggest removing them.
> 
> Testing:
>   - tier1 ~ tier3 on Linux/x64, no regression
> 
> Am I missing something?
> 
> Thanks.
> Best regards,
> Jie

Looks good.

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

Marked as reviewed by neliasso (Reviewer).

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


More information about the hotspot-compiler-dev mailing list