[aarch64-port-dev ] RFR: 8215202: AArch64: jtreg test test/jdk/sun/nio/cs/FindEncoderBugs.java fails

Nick Gasson (Arm Technology China) Nick.Gasson at arm.com
Tue Dec 11 08:05:21 UTC 2018


Hi,

Please help me review this patch to fix an issue with the ISO-8859-1
encoder intrinsic on AArch64 (nio-dev CC-ed due to test change).

Webrev: http://cr.openjdk.java.net/~njian/8215202/webrev.0/
Bug: https://bugs.openjdk.java.net/browse/JDK-8215202

The jtreg test test/jdk/sun/nio/cs/FindEncoderBugs.java fails with the
following error on AArch64 with compilation:

  Buffer overrun: ISO-8859-1 "\u8a8e"[0/1] => UNMAPPABLE[1] ""[0/19] -114
  failures=1

  Passed = 223410156, failed = 10000

  STDERR:
  java.lang.AssertionError: Some tests failed
          at FindEncoderBugs.main(FindEncoderBugs.java:526)

The problem is caused by the encoder function for the ISO-8859-1
character set writing one extra character to the output array when it
encounters a character it can't encode. This is implemented as an
intrinsic on AArch64, but the intrinsic doesn't exactly match the
original Java code in ISO_8859_1.java:

  @HotSpotIntrinsicCandidate
  private static int implEncodeISOArray(char[] sa, int sp,
                                        byte[] da, int dp, int len) {
      int i = 0;
      for (; i < len; i++) {
          char c = sa[sp++];
          if (c > '\u00FF') // (1)
              break;
          da[dp++] = (byte)c; // (2)
      }
      return i;
  }

In the intrinsic code statements (1) and (2) are swapped.

Also Extended the FindEncoderBugs test so that it hits all cases in
the intrinsic assembly. Currently only the final NEXT_1 section is
covered by this test.

Thanks,
Nick


More information about the aarch64-port-dev mailing list