Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263676

AArch64: one potential bug in C1 LIRGenerator::generate_address()

XMLWordPrintable

    • b15
    • aarch64
    • generic

        Noticed this issue when I am trying to backport: https://bugs.openjdk.java.net/browse/JDK-8263425

        Around line 180 we have:

                 __ add(index, LIR_OprFact::intptrConst(large_disp), tmp);
                 index = tmp;
               } else {
                 __ move(tmp, LIR_OprFact::intptrConst(large_disp)); <========
                 __ add(tmp, index, tmp);
                 index = tmp;
               }

        This is supposed to be calculating "tmp = large_disp" but it actually does "large_disp = tmp".
        Looks like this is missed by JDK-8263425.

        Proposed patch:
        diff --git a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp
        index 0056e4c7d36..a6c6dbe856f 100644
        --- a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp
        +++ b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp
        @@ -177,7 +177,7 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
                 __ add(index, LIR_OprFact::intptrConst(large_disp), tmp);
                 index = tmp;
               } else {
        - __ move(tmp, LIR_OprFact::intptrConst(large_disp));
        + __ move(LIR_OprFact::intptrConst(large_disp), tmp);
                 __ add(tmp, index, tmp);
                 index = tmp;
               }

              fyang Fei Yang
              fyang Fei Yang
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: