RFR: 8300253: Introduce AArch64 nzcv accessors

Stuart Monteith smonteith at openjdk.org
Tue Jan 17 18:33:06 UTC 2023


On Tue, 17 Jan 2023 14:01:05 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Some code, such as verification code, might want to run without changing the state of the system. To do that, it's useful to be able to get and set the nzcv flags. This enhancement aims at adding accessors for that.
>
> src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp line 591:
> 
>> 589:     msr(0b011, 0b0100, 0b0010, 0b000, reg);
>> 590:   }
>> 591: 
> 
> We've tried never to to add such things speculatively, as much as anything else because it's impossible to test.

Could @fisk provide an example of where this might be used?
My assumption is that you are looking to execute code verification within, say, a GC memory barrier, and the code has been inserted in between where the condition codes might have been set and then used. This could avoid breaking the existing code when the verification code itself sets the condition codes.
It's not all of the pstate, but then this is just userspace, so it ought to be ok?

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

PR: https://git.openjdk.org/jdk/pull/12038


More information about the hotspot-dev mailing list