[aarch64-port-dev ] RFR(XS): 8247979: aarch64: missing side effect of killing flags for clearArray_reg_reg

Yangfei (Felix) felix.yang at huawei.com
Tue Jun 23 00:42:54 UTC 2020


Hi,

    Bug: https://bugs.openjdk.java.net/browse/JDK-8247979 
    Webrev: http://cr.openjdk.java.net/~fyang/8247979/webrev.00 

    For clearArray_reg_reg in aarch64.ad, we call function: MacroAssembler::zero words(Register ptr, Register cnt).
    This function modifies the flags register by doing a cmp instruction at entry.  But this is not reflected on the side effect of clearArray_reg_reg.
    We didn't see this is triggering problems.  But this may pose similar risk as bug: 8224828: aarch64: rflags is not correct after safepoint poll.
    Tier1-3 tested on aarch64-linux-gnu.  OK?

diff -r 2342d5af52b7 src/hotspot/cpu/aarch64/aarch64.ad
--- a/src/hotspot/cpu/aarch64/aarch64.ad        Mon Jun 22 08:09:23 2020 +0200
+++ b/src/hotspot/cpu/aarch64/aarch64.ad        Mon Jun 22 15:58:05 2020 +0800
@@ -13845,7 +13845,7 @@
 instruct clearArray_reg_reg(iRegL_R11 cnt, iRegP_R10 base, Universe dummy, rFlagsReg cr)
 %{
   match(Set dummy (ClearArray cnt base));
-  effect(USE_KILL cnt, USE_KILL base);
+  effect(USE_KILL cnt, USE_KILL base, KILL cr);

   ins_cost(4 * INSN_COST);
   format %{ "ClearArray $cnt, $base" %}

BTW: clearArray_imm_reg does not have the issue since it calls a different function: MacroAssembler::zero_words(Register base, u_int64_t cnt)

13843 // clearing of an array
13844
13845 instruct clearArray_reg_reg(iRegL_R11 cnt, iRegP_R10 base, Universe dummy, rFlagsReg cr)
13846 %{
13847   match(Set dummy (ClearArray cnt base));
13848   effect(USE_KILL cnt, USE_KILL base);
13849
13850   ins_cost(4 * INSN_COST);
13851   format %{ "ClearArray $cnt, $base" %}
13852
13853   ins_encode %{
13854     __ zero_words($base$$Register, $cnt$$Register);
13855   %}
13856
13857   ins_pipe(pipe_class_memory);
13858 %}

4771 void MacroAssembler::zero_words(Register ptr, Register cnt)
4772 {
4773   assert(is_power_of_2(zero_words_block_size), "adjust this");
4774   assert(ptr == r10 && cnt == r11, "mismatch in register usage");
4775
4776   BLOCK_COMMENT("zero_words {");
4777   cmp(cnt, (u1)zero_words_block_size);                  <=================



More information about the aarch64-port-dev mailing list