RFR: 8224828: aarch64: save and restore the rflags register in push_CPU_state and pop_CPU_state

Andrew Haley aph at redhat.com
Wed May 29 11:47:50 UTC 2019


On 5/29/19 11:10 AM, Yangfei (Felix) wrote:
>> On 28/05/2019 14:50, Andrew Haley wrote:
> 
>>> I don't think you should do this. Instead, please apply
>>>
>>>   effect(KILL cr);
>>>
>>> to instruct safePoint in aarch64.ad.
>> Yes, that is a far better fix.
> 
> I find x86 handles all registers including rflags in push_CPU_state/pop_CPU_state. 
> Was rflags intentionally neglected in push_CPU_state/ pop_CPU_state for the aarch64 port?  

I don't know. How well do you remember your intentions when coding six
years ago? :-)

If I had to guess, I'd say that the x86 code on which it was based was
not exactly clear: the comment was "Save Integer and Float state",
although you're quite right to say it saves the flags. CR is so very
volatile that I wouldn't expect it to be saved anywhere, really.

But it's of no matter. There isn't any need to save and restore the
flags: push_CPU_state/ pop_CPU_state are called from only two places,
RegisterSaver::save_live_registers and patch_callers_callsite, which
do not have any contract to save the flags.

> If true, then I would suggest renaming push_CPU_state/ pop_CPU_state to some other name.  

Probably. What we must do is correct this comment in
RegisterSaver::save_live_registers:

// Save registers, fpu state, and flags.

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


More information about the hotspot-runtime-dev mailing list