# HG changeset patch # User aph # Date 1545412486 0 # Node ID b0686d0be73fa089eb4f60f5d10ebbe168e099f9 # Parent a92cd6585f605a3a33a27c5099f31d1a8c5f1c6d 8215202: AArch64: jtreg test test/jdk/sun/nio/cs/FindEncoderBugs.java fails Reviewed-by: aph Contributed-by: nick.gasson@arm.com diff -r a92cd6585f60 -r b0686d0be73f src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Fri Dec 21 11:02:36 2018 +0100 +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Fri Dec 21 17:14:46 2018 +0000 @@ -5648,12 +5648,12 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); diff -r a92cd6585f60 -r b0686d0be73f test/jdk/sun/nio/cs/FindEncoderBugs.java --- a/test/jdk/sun/nio/cs/FindEncoderBugs.java Fri Dec 21 11:02:36 2018 +0100 +++ b/test/jdk/sun/nio/cs/FindEncoderBugs.java Fri Dec 21 17:14:46 2018 +0000 @@ -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 @@ 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 @@ } } + 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 @@ 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(); } }