getAndAddInt() breaks AOT compilation for AArch64

stewartd.qdt stewartd.qdt at qualcommdatacenter.com
Wed Jun 6 15:47:28 UTC 2018


Please review the patch at https://github.com/oracle/graal/pull/453, which attempts to implement the support for immediate values in getAndAddInt().

Daniel

-----Original Message-----
From: stewartd.qdt 
Sent: Monday, June 4, 2018 12:26 PM
To: Andrew Haley <aph at redhat.com>; stewartd.qdt <stewartd.qdt at qualcommdatacenter.com>; graal-dev at openjdk.java.net
Cc: Zhongwei Yao <zhongwei.yao at linaro.org>; dean.long at oracle.com
Subject: RE: getAndAddInt() breaks AOT compilation for AArch64

Ah, I see! Thanks for pointing that out. I'll look at this as a separate patch. 

Daniel

-----Original Message-----
From: Andrew Haley [mailto:aph at redhat.com]
Sent: Monday, June 4, 2018 12:22 PM
To: stewartd.qdt <stewartd.qdt at qualcommdatacenter.com>; graal-dev at openjdk.java.net
Cc: Zhongwei Yao <zhongwei.yao at linaro.org>; dean.long at oracle.com
Subject: Re: getAndAddInt() breaks AOT compilation for AArch64

On 06/04/2018 03:58 PM, stewartd.qdt wrote:
> It is essentially the same as Zhongwei proposed and does not contain 
> any advanced handling for immediates. I think at this point simpler is 
> better. It also appeared to me that Hotspot does not have special 
> handling for the immediate cases either

It does so!

instruct get_and_addL(indirect mem, iRegLNoSp newval, iRegL incr) %{
  match(Set newval (GetAndAddL mem incr));
  ins_cost(INSN_COST * 10);
  format %{ "get_and_addL $newval, [$mem], $incr" %}
  ins_encode %{
    __ atomic_add($newval$$Register, $incr$$Register, as_Register($mem$$base));
  %}
  ins_pipe(pipe_serial);
%}

instruct get_and_addLi(indirect mem, iRegLNoSp newval, immLAddSub incr) %{
  match(Set newval (GetAndAddL mem incr));
  ins_cost(INSN_COST * 10);
  format %{ "get_and_addL $newval, [$mem], $incr" %}
  ins_encode %{
    __ atomic_add($newval$$Register, $incr$$constant, as_Register($mem$$base));
  %}
  ins_pipe(pipe_serial);
%}

> so I chose the simple route. 

Hmm.  Given that actually fixing it properly with an immediate increment isn't hard, I'm not sure I agree.  Sure, it's not a huge deal.

--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the graal-dev mailing list