test/compiler/7196199/Test7196199.java

Thu, 17 Apr 2014 16:09:08 -0700

author
amurillo
date
Thu, 17 Apr 2014 16:09:08 -0700
changeset 6635
49b5160951dd
parent 0
f90c822e73f8
permissions
-rw-r--r--

Added tag hs25.20-b11 for changeset b6a2ba7d3ea7

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 /**
aoqi@0 26 * @test
aoqi@0 27 * @bug 7196199
aoqi@0 28 * @summary java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
aoqi@0 29 *
aoqi@0 30 * @run main/othervm/timeout=400 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CompileCommand=exclude,Test7196199.test -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 Test7196199
aoqi@0 31 */
aoqi@0 32
aoqi@0 33
aoqi@0 34 public class Test7196199 {
aoqi@0 35 private static final int ARRLEN = 97;
aoqi@0 36 private static final int ITERS = 5000;
aoqi@0 37 private static final int INI_ITERS = 1000;
aoqi@0 38 private static final int SFP_ITERS = 10000;
aoqi@0 39 private static final float SFP_ITERS_F = 10000.f;
aoqi@0 40 private static final float VALUE = 15.f;
aoqi@0 41 public static void main(String args[]) {
aoqi@0 42 int errn = test();
aoqi@0 43 if (errn > 0) {
aoqi@0 44 System.err.println("FAILED: " + errn + " errors");
aoqi@0 45 System.exit(97);
aoqi@0 46 }
aoqi@0 47 System.out.println("PASSED");
aoqi@0 48 }
aoqi@0 49
aoqi@0 50 static int test() {
aoqi@0 51 float[] a0 = new float[ARRLEN];
aoqi@0 52 float[] a1 = new float[ARRLEN];
aoqi@0 53 // Initialize
aoqi@0 54 for (int i=0; i<ARRLEN; i++) {
aoqi@0 55 a0[i] = 0.f;
aoqi@0 56 a1[i] = (float)i;
aoqi@0 57 }
aoqi@0 58 System.out.println("Warmup");
aoqi@0 59 for (int i=0; i<INI_ITERS; i++) {
aoqi@0 60 test_incrc(a0);
aoqi@0 61 test_incrv(a0, VALUE);
aoqi@0 62 test_addc(a0, a1);
aoqi@0 63 test_addv(a0, a1, VALUE);
aoqi@0 64 }
aoqi@0 65 // Test and verify results
aoqi@0 66 System.out.println("Verification");
aoqi@0 67 int errn = 0;
aoqi@0 68 for (int i=0; i<ARRLEN; i++)
aoqi@0 69 a0[i] = 0.f;
aoqi@0 70
aoqi@0 71 System.out.println(" test_incrc");
aoqi@0 72 for (int j=0; j<ITERS; j++) {
aoqi@0 73 test_incrc(a0);
aoqi@0 74 for (int i=0; i<ARRLEN; i++) {
aoqi@0 75 errn += verify("test_incrc: ", i, a0[i], VALUE*SFP_ITERS_F);
aoqi@0 76 a0[i] = 0.f; // Reset
aoqi@0 77 }
aoqi@0 78 }
aoqi@0 79
aoqi@0 80 System.out.println(" test_incrv");
aoqi@0 81 for (int j=0; j<ITERS; j++) {
aoqi@0 82 test_incrv(a0, VALUE);
aoqi@0 83 for (int i=0; i<ARRLEN; i++) {
aoqi@0 84 errn += verify("test_incrv: ", i, a0[i], VALUE*SFP_ITERS_F);
aoqi@0 85 a0[i] = 0.f; // Reset
aoqi@0 86 }
aoqi@0 87 }
aoqi@0 88
aoqi@0 89 System.out.println(" test_addc");
aoqi@0 90 for (int j=0; j<ITERS; j++) {
aoqi@0 91 test_addc(a0, a1);
aoqi@0 92 for (int i=0; i<ARRLEN; i++) {
aoqi@0 93 errn += verify("test_addc: ", i, a0[i], ((float)i + VALUE)*SFP_ITERS_F);
aoqi@0 94 a0[i] = 0.f; // Reset
aoqi@0 95 }
aoqi@0 96 }
aoqi@0 97
aoqi@0 98 System.out.println(" test_addv");
aoqi@0 99 for (int j=0; j<ITERS; j++) {
aoqi@0 100 test_addv(a0, a1, VALUE);
aoqi@0 101 for (int i=0; i<ARRLEN; i++) {
aoqi@0 102 errn += verify("test_addv: ", i, a0[i], ((float)i + VALUE)*SFP_ITERS_F);
aoqi@0 103 a0[i] = 0.f; // Reset
aoqi@0 104 }
aoqi@0 105 }
aoqi@0 106
aoqi@0 107 if (errn > 0)
aoqi@0 108 return errn;
aoqi@0 109
aoqi@0 110 System.out.println("Time");
aoqi@0 111 long start, end;
aoqi@0 112
aoqi@0 113 start = System.currentTimeMillis();
aoqi@0 114 for (int i=0; i<INI_ITERS; i++) {
aoqi@0 115 test_incrc(a0);
aoqi@0 116 }
aoqi@0 117 end = System.currentTimeMillis();
aoqi@0 118 System.out.println("test_incrc: " + (end - start));
aoqi@0 119
aoqi@0 120 start = System.currentTimeMillis();
aoqi@0 121 for (int i=0; i<INI_ITERS; i++) {
aoqi@0 122 test_incrv(a0, VALUE);
aoqi@0 123 }
aoqi@0 124 end = System.currentTimeMillis();
aoqi@0 125 System.out.println("test_incrv: " + (end - start));
aoqi@0 126
aoqi@0 127 start = System.currentTimeMillis();
aoqi@0 128 for (int i=0; i<INI_ITERS; i++) {
aoqi@0 129 test_addc(a0, a1);
aoqi@0 130 }
aoqi@0 131 end = System.currentTimeMillis();
aoqi@0 132 System.out.println("test_addc: " + (end - start));
aoqi@0 133
aoqi@0 134 start = System.currentTimeMillis();
aoqi@0 135 for (int i=0; i<INI_ITERS; i++) {
aoqi@0 136 test_addv(a0, a1, VALUE);
aoqi@0 137 }
aoqi@0 138 end = System.currentTimeMillis();
aoqi@0 139 System.out.println("test_addv: " + (end - start));
aoqi@0 140
aoqi@0 141 return errn;
aoqi@0 142 }
aoqi@0 143
aoqi@0 144 static void test_incrc(float[] a0) {
aoqi@0 145 // Non-counted loop with safepoint.
aoqi@0 146 for (long l = 0; l < SFP_ITERS; l++) {
aoqi@0 147 // Counted and vectorized loop.
aoqi@0 148 for (int i = 0; i < a0.length; i+=1) {
aoqi@0 149 a0[i] += VALUE;
aoqi@0 150 }
aoqi@0 151 }
aoqi@0 152 }
aoqi@0 153 static void test_incrv(float[] a0, float b) {
aoqi@0 154 // Non-counted loop with safepoint.
aoqi@0 155 for (long l = 0; l < SFP_ITERS; l++) {
aoqi@0 156 // Counted and vectorized loop.
aoqi@0 157 for (int i = 0; i < a0.length; i+=1) {
aoqi@0 158 a0[i] += b;
aoqi@0 159 }
aoqi@0 160 }
aoqi@0 161 }
aoqi@0 162 static void test_addc(float[] a0, float[] a1) {
aoqi@0 163 // Non-counted loop with safepoint.
aoqi@0 164 for (long l = 0; l < SFP_ITERS; l++) {
aoqi@0 165 // Counted and vectorized loop.
aoqi@0 166 for (int i = 0; i < a0.length; i+=1) {
aoqi@0 167 a0[i] += a1[i]+VALUE;
aoqi@0 168 }
aoqi@0 169 }
aoqi@0 170 }
aoqi@0 171 static void test_addv(float[] a0, float[] a1, float b) {
aoqi@0 172 // Non-counted loop with safepoint.
aoqi@0 173 for (long l = 0; l < SFP_ITERS; l++) {
aoqi@0 174 // Counted and vectorized loop.
aoqi@0 175 for (int i = 0; i < a0.length; i+=1) {
aoqi@0 176 a0[i] += a1[i]+b;
aoqi@0 177 }
aoqi@0 178 }
aoqi@0 179 }
aoqi@0 180
aoqi@0 181 static int verify(String text, int i, float elem, float val) {
aoqi@0 182 if (elem != val) {
aoqi@0 183 System.err.println(text + "[" + i + "] = " + elem + " != " + val);
aoqi@0 184 return 1;
aoqi@0 185 }
aoqi@0 186 return 0;
aoqi@0 187 }
aoqi@0 188 }
aoqi@0 189

mercurial