RFR: 8310268: RISC-V: misaligned memory access in String.Compare intrinsic

Fei Yang fyang at openjdk.org
Thu Jun 29 03:55:17 UTC 2023


On Mon, 26 Jun 2023 12:41:47 GMT, Vladimir Kempik <vkempik at openjdk.org> wrote:

> Clear performance degradation when we have to go into TAIL ( cases 15, 36 for LL. 7 and 15 for LU/UL)

It's a tradeoff which is acceptable to me provided that we already got most of the gain as compared to JDK mainline.
In fact, I meant something more simpler :

    if (str1_isL == str2_isL) { // LL or UU
      load_long_misaligned(tmp1, Address(str1), tmp3, isLL ? 1 : 2);
      load_long_misaligned(tmp2, Address(str2), tmp3, isLL ? 1 : 2);
    } else if (isLU) { // LU case
      load_int_misaligned(tmp1, Address(str1), tmp3, false);
      load_long_misaligned(tmp2, Address(str2), tmp3, 2);
      inflate_lo32(tmp3, tmp1);
      mv(tmp1, tmp3);
    } else { // UL case
      load_int_misaligned(tmp2, Address(str2), tmp3, false);
      load_long_misaligned(tmp1, Address(str1), tmp3, 2);
      inflate_lo32(tmp3, tmp2);
      mv(tmp2, tmp3);
    }

The preceding `beqz` added by https://github.com/VladimirKempik/jdk/commit/656af81f1aa3f026cf3e1868b3813c7488b2775f will have a negative impact for platforms like T-head which have fast unaligned accesses.

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

PR Comment: https://git.openjdk.org/jdk/pull/14534#issuecomment-1612394013


More information about the hotspot-dev mailing list