8215202: AArch64: jtreg test test/jdk/sun/nio/cs/FindEncoderBugs.java fails

Reviewed-by: aph
This commit is contained in:
Nick Gasson 2018-12-21 17:14:46 +00:00 committed by Andrew Haley
parent cb553175b7
commit 0e2172c7ba
2 changed files with 31 additions and 6 deletions
src/hotspot/cpu/aarch64
test/jdk/sun/nio/cs

@ -5648,12 +5648,12 @@ void MacroAssembler::encode_iso_array(Register src, Register dst,
orr(v5, T16B, Vtmp3, Vtmp4);
uzp1(Vtmp1, T16B, Vtmp1, Vtmp2);
uzp1(Vtmp3, T16B, Vtmp3, Vtmp4);
stpq(Vtmp1, Vtmp3, dst);
uzp2(v5, T16B, v4, v5); // high bytes
umov(tmp2, v5, D, 1);
fmovd(tmp1, v5);
orr(tmp1, tmp1, tmp2);
cbnz(tmp1, LOOP_8);
stpq(Vtmp1, Vtmp3, dst);
sub(len, len, 32);
add(dst, dst, 32);
add(src, src, 64);
@ -5671,7 +5671,6 @@ void MacroAssembler::encode_iso_array(Register src, Register dst,
prfm(Address(src, SoftwarePrefetchHintDistance));
uzp1(v4, T16B, Vtmp1, Vtmp2);
uzp1(v5, T16B, Vtmp3, Vtmp4);
stpq(v4, v5, dst);
orr(Vtmp1, T16B, Vtmp1, Vtmp2);
orr(Vtmp3, T16B, Vtmp3, Vtmp4);
uzp2(Vtmp1, T16B, Vtmp1, Vtmp3); // high bytes
@ -5679,6 +5678,7 @@ void MacroAssembler::encode_iso_array(Register src, Register dst,
fmovd(tmp1, Vtmp1);
orr(tmp1, tmp1, tmp2);
cbnz(tmp1, LOOP_8);
stpq(v4, v5, dst);
sub(len, len, 32);
add(dst, dst, 32);
add(src, src, 64);
@ -5693,9 +5693,9 @@ void MacroAssembler::encode_iso_array(Register src, Register dst,
ld1(Vtmp1, T8H, src);
uzp1(Vtmp2, T16B, Vtmp1, Vtmp1); // low bytes
uzp2(Vtmp3, T16B, Vtmp1, Vtmp1); // high bytes
strd(Vtmp2, dst);
fmovd(tmp1, Vtmp3);
cbnz(tmp1, NEXT_1);
strd(Vtmp2, dst);
sub(len, len, 8);
add(dst, dst, 8);
@ -5708,9 +5708,9 @@ void MacroAssembler::encode_iso_array(Register src, Register dst,
cbz(len, DONE);
BIND(NEXT_1);
ldrh(tmp1, Address(post(src, 2)));
strb(tmp1, Address(post(dst, 1)));
tst(tmp1, 0xff00);
br(NE, SET_RESULT);
strb(tmp1, Address(post(dst, 1)));
subs(len, len, 1);
br(GT, NEXT_1);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -180,7 +180,7 @@ public class FindEncoderBugs {
private final long failed0 = failed;
// legend: r=regular d=direct In=Input Ou=Output
static final int maxBufSize = 20;
static final int maxBufSize = 40;
static final CharBuffer[] rInBuffers = new CharBuffer[maxBufSize];
static final CharBuffer[] dInBuffers = new CharBuffer[maxBufSize];
@ -444,6 +444,28 @@ public class FindEncoderBugs {
}
}
void testISO88591InvalidChar() {
// Several architectures implement the ISO-8859-1 encoder as an
// intrinsic where the vectorised assembly has separate cases
// for different input sizes, so exhaustively test all sizes
// from 0 to maxBufSize to ensure we get coverage
for (int i = 0; i < CharsetTester.maxBufSize; i++) {
char[] ia = new char[i];
for (int j = 0; j < i; j++)
ia[j] = randomChar();
test(ia);
// Test break on unrepresentable character
for (int j = 0; j < i; j++) {
char[] iaInvalid = ia.clone();
iaInvalid[j] = (char)(randomChar() | 0x100);
test(iaInvalid);
}
}
}
void testPrefix(char[] prefix) {
if (prefix.length > 0)
System.out.printf("Testing prefix %s%n", string(prefix));
@ -492,6 +514,9 @@ public class FindEncoderBugs {
System.out.println("More ISCII testing...");
new CharsetTester(cs).testPrefix(new char[]{'\u094d'}); // Halant
new CharsetTester(cs).testPrefix(new char[]{'\u093c'}); // Nukta
} else if (csn.equals("ISO-8859-1")) {
System.out.println("More ISO-8859-1 testing...");
new CharsetTester(cs).testISO88591InvalidChar();
}
}