1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/compiler/8004867/TestIntAtomicCAS.java Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,969 @@ 1.4 +/* 1.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +/** 1.29 + * @test 1.30 + * @bug 8004867 1.31 + * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" 1.32 + * 1.33 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicCAS 1.34 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicCAS 1.35 + */ 1.36 + 1.37 +import java.util.concurrent.atomic.AtomicIntegerArray; 1.38 + 1.39 +public class TestIntAtomicCAS { 1.40 + private static final int ARRLEN = 97; 1.41 + private static final int ITERS = 11000; 1.42 + private static final int OFFSET = 3; 1.43 + private static final int SCALE = 2; 1.44 + private static final int ALIGN_OFF = 8; 1.45 + private static final int UNALIGN_OFF = 5; 1.46 + 1.47 + public static void main(String args[]) { 1.48 + System.out.println("Testing Integer array atomic CAS operations"); 1.49 + int errn = test(false); 1.50 + if (errn > 0) { 1.51 + System.err.println("FAILED: " + errn + " errors"); 1.52 + System.exit(97); 1.53 + } 1.54 + System.out.println("PASSED"); 1.55 + } 1.56 + 1.57 + static int test(boolean test_only) { 1.58 + AtomicIntegerArray a1 = new AtomicIntegerArray(ARRLEN); 1.59 + AtomicIntegerArray a2 = new AtomicIntegerArray(ARRLEN); 1.60 + // Initialize 1.61 + for (int i=0; i<ARRLEN; i++) { 1.62 + a1.set(i, -1); 1.63 + a2.set(i, -1); 1.64 + } 1.65 + System.out.println("Warmup"); 1.66 + for (int i=0; i<ITERS; i++) { 1.67 + test_ci(a1); 1.68 + test_vi(a2, 123, -1); 1.69 + test_cp(a1, a2); 1.70 + test_2ci(a1, a2); 1.71 + test_2vi(a1, a2, 123, 103); 1.72 + test_ci_neg(a1, 123); 1.73 + test_vi_neg(a2, 123, 103); 1.74 + test_cp_neg(a1, a2); 1.75 + test_2ci_neg(a1, a2); 1.76 + test_2vi_neg(a1, a2, 123, 103); 1.77 + test_ci_oppos(a1, 123); 1.78 + test_vi_oppos(a2, 123, 103); 1.79 + test_cp_oppos(a1, a2); 1.80 + test_2ci_oppos(a1, a2); 1.81 + test_2vi_oppos(a1, a2, 123, 103); 1.82 + test_ci_off(a1, 123); 1.83 + test_vi_off(a2, 123, 103); 1.84 + test_cp_off(a1, a2); 1.85 + test_2ci_off(a1, a2); 1.86 + test_2vi_off(a1, a2, 123, 103); 1.87 + test_ci_inv(a1, OFFSET, 123); 1.88 + test_vi_inv(a2, 123, OFFSET, 103); 1.89 + test_cp_inv(a1, a2, OFFSET); 1.90 + test_2ci_inv(a1, a2, OFFSET); 1.91 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 1.92 + test_ci_scl(a1, 123); 1.93 + test_vi_scl(a2, 123, 103); 1.94 + test_cp_scl(a1, a2); 1.95 + test_2ci_scl(a1, a2); 1.96 + test_2vi_scl(a1, a2, 123, 103); 1.97 + test_cp_alndst(a1, a2); 1.98 + test_cp_alnsrc(a1, a2); 1.99 + test_2ci_aln(a1, a2); 1.100 + test_2vi_aln(a1, a2, 123, 103); 1.101 + test_cp_unalndst(a1, a2); 1.102 + test_cp_unalnsrc(a1, a2); 1.103 + test_2ci_unaln(a1, a2); 1.104 + test_2vi_unaln(a1, a2, 123, 103); 1.105 + } 1.106 + // Initialize 1.107 + for (int i=0; i<ARRLEN; i++) { 1.108 + a1.set(i, -1); 1.109 + a2.set(i, -1); 1.110 + } 1.111 + // Test and verify results 1.112 + System.out.println("Verification"); 1.113 + int errn = 0; 1.114 + { 1.115 + test_ci(a1); 1.116 + for (int i=0; i<ARRLEN; i++) { 1.117 + errn += verify("test_ci: a1", i, a1.get(i), -123); 1.118 + } 1.119 + test_vi(a2, 123, -1); 1.120 + for (int i=0; i<ARRLEN; i++) { 1.121 + errn += verify("test_vi: a2", i, a2.get(i), 123); 1.122 + } 1.123 + test_cp(a1, a2); 1.124 + for (int i=0; i<ARRLEN; i++) { 1.125 + errn += verify("test_cp: a1", i, a1.get(i), 123); 1.126 + } 1.127 + test_2ci(a1, a2); 1.128 + for (int i=0; i<ARRLEN; i++) { 1.129 + errn += verify("test_2ci: a1", i, a1.get(i), -123); 1.130 + errn += verify("test_2ci: a2", i, a2.get(i), -103); 1.131 + } 1.132 + test_2vi(a1, a2, 123, 103); 1.133 + for (int i=0; i<ARRLEN; i++) { 1.134 + errn += verify("test_2vi: a1", i, a1.get(i), 123); 1.135 + errn += verify("test_2vi: a2", i, a2.get(i), 103); 1.136 + } 1.137 + // Reset for negative stride 1.138 + for (int i=0; i<ARRLEN; i++) { 1.139 + a1.set(i, -1); 1.140 + a2.set(i, -1); 1.141 + } 1.142 + test_ci_neg(a1, -1); 1.143 + for (int i=0; i<ARRLEN; i++) { 1.144 + errn += verify("test_ci_neg: a1", i, a1.get(i), -123); 1.145 + } 1.146 + test_vi_neg(a2, 123, -1); 1.147 + for (int i=0; i<ARRLEN; i++) { 1.148 + errn += verify("test_vi_neg: a2", i, a2.get(i), 123); 1.149 + } 1.150 + test_cp_neg(a1, a2); 1.151 + for (int i=0; i<ARRLEN; i++) { 1.152 + errn += verify("test_cp_neg: a1", i, a1.get(i), 123); 1.153 + } 1.154 + test_2ci_neg(a1, a2); 1.155 + for (int i=0; i<ARRLEN; i++) { 1.156 + errn += verify("test_2ci_neg: a1", i, a1.get(i), -123); 1.157 + errn += verify("test_2ci_neg: a2", i, a2.get(i), -103); 1.158 + } 1.159 + test_2vi_neg(a1, a2, 123, 103); 1.160 + for (int i=0; i<ARRLEN; i++) { 1.161 + errn += verify("test_2vi_neg: a1", i, a1.get(i), 123); 1.162 + errn += verify("test_2vi_neg: a2", i, a2.get(i), 103); 1.163 + } 1.164 + // Reset for opposite stride 1.165 + for (int i=0; i<ARRLEN; i++) { 1.166 + a1.set(i, -1); 1.167 + a2.set(i, -1); 1.168 + } 1.169 + test_ci_oppos(a1, -1); 1.170 + for (int i=0; i<ARRLEN; i++) { 1.171 + errn += verify("test_ci_oppos: a1", i, a1.get(i), -123); 1.172 + } 1.173 + test_vi_oppos(a2, 123, -1); 1.174 + for (int i=0; i<ARRLEN; i++) { 1.175 + errn += verify("test_vi_oppos: a2", i, a2.get(i), 123); 1.176 + } 1.177 + test_cp_oppos(a1, a2); 1.178 + for (int i=0; i<ARRLEN; i++) { 1.179 + errn += verify("test_cp_oppos: a1", i, a1.get(i), 123); 1.180 + } 1.181 + test_2ci_oppos(a1, a2); 1.182 + for (int i=0; i<ARRLEN; i++) { 1.183 + errn += verify("test_2ci_oppos: a1", i, a1.get(i), -123); 1.184 + errn += verify("test_2ci_oppos: a2", i, a2.get(i), -103); 1.185 + } 1.186 + test_2vi_oppos(a1, a2, 123, 103); 1.187 + for (int i=0; i<ARRLEN; i++) { 1.188 + errn += verify("test_2vi_oppos: a1", i, a1.get(i), 123); 1.189 + errn += verify("test_2vi_oppos: a2", i, a2.get(i), 103); 1.190 + } 1.191 + // Reset for indexing with offset 1.192 + for (int i=0; i<ARRLEN; i++) { 1.193 + a1.set(i, -1); 1.194 + a2.set(i, -1); 1.195 + } 1.196 + test_ci_off(a1, -1); 1.197 + for (int i=OFFSET; i<ARRLEN; i++) { 1.198 + errn += verify("test_ci_off: a1", i, a1.get(i), -123); 1.199 + } 1.200 + test_vi_off(a2, 123, -1); 1.201 + for (int i=OFFSET; i<ARRLEN; i++) { 1.202 + errn += verify("test_vi_off: a2", i, a2.get(i), 123); 1.203 + } 1.204 + test_cp_off(a1, a2); 1.205 + for (int i=OFFSET; i<ARRLEN; i++) { 1.206 + errn += verify("test_cp_off: a1", i, a1.get(i), 123); 1.207 + } 1.208 + test_2ci_off(a1, a2); 1.209 + for (int i=OFFSET; i<ARRLEN; i++) { 1.210 + errn += verify("test_2ci_off: a1", i, a1.get(i), -123); 1.211 + errn += verify("test_2ci_off: a2", i, a2.get(i), -103); 1.212 + } 1.213 + test_2vi_off(a1, a2, 123, 103); 1.214 + for (int i=OFFSET; i<ARRLEN; i++) { 1.215 + errn += verify("test_2vi_off: a1", i, a1.get(i), 123); 1.216 + errn += verify("test_2vi_off: a2", i, a2.get(i), 103); 1.217 + } 1.218 + for (int i=0; i<OFFSET; i++) { 1.219 + errn += verify("test_2vi_off: a1", i, a1.get(i), -1); 1.220 + errn += verify("test_2vi_off: a2", i, a2.get(i), -1); 1.221 + } 1.222 + // Reset for indexing with invariant offset 1.223 + for (int i=0; i<ARRLEN; i++) { 1.224 + a1.set(i, -1); 1.225 + a2.set(i, -1); 1.226 + } 1.227 + test_ci_inv(a1, OFFSET, -1); 1.228 + for (int i=OFFSET; i<ARRLEN; i++) { 1.229 + errn += verify("test_ci_inv: a1", i, a1.get(i), -123); 1.230 + } 1.231 + test_vi_inv(a2, 123, OFFSET, -1); 1.232 + for (int i=OFFSET; i<ARRLEN; i++) { 1.233 + errn += verify("test_vi_inv: a2", i, a2.get(i), 123); 1.234 + } 1.235 + test_cp_inv(a1, a2, OFFSET); 1.236 + for (int i=OFFSET; i<ARRLEN; i++) { 1.237 + errn += verify("test_cp_inv: a1", i, a1.get(i), 123); 1.238 + } 1.239 + test_2ci_inv(a1, a2, OFFSET); 1.240 + for (int i=OFFSET; i<ARRLEN; i++) { 1.241 + errn += verify("test_2ci_inv: a1", i, a1.get(i), -123); 1.242 + errn += verify("test_2ci_inv: a2", i, a2.get(i), -103); 1.243 + } 1.244 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 1.245 + for (int i=OFFSET; i<ARRLEN; i++) { 1.246 + errn += verify("test_2vi_inv: a1", i, a1.get(i), 123); 1.247 + errn += verify("test_2vi_inv: a2", i, a2.get(i), 103); 1.248 + } 1.249 + for (int i=0; i<OFFSET; i++) { 1.250 + errn += verify("test_2vi_inv: a1", i, a1.get(i), -1); 1.251 + errn += verify("test_2vi_inv: a2", i, a2.get(i), -1); 1.252 + } 1.253 + // Reset for indexing with scale 1.254 + for (int i=0; i<ARRLEN; i++) { 1.255 + a1.set(i, -1); 1.256 + a2.set(i, -1); 1.257 + } 1.258 + test_ci_scl(a1, -1); 1.259 + for (int i=0; i<ARRLEN; i++) { 1.260 + int val = (i%SCALE != 0) ? -1 : -123; 1.261 + errn += verify("test_ci_scl: a1", i, a1.get(i), val); 1.262 + } 1.263 + test_vi_scl(a2, 123, -1); 1.264 + for (int i=0; i<ARRLEN; i++) { 1.265 + int val = (i%SCALE != 0) ? -1 : 123; 1.266 + errn += verify("test_vi_scl: a2", i, a2.get(i), val); 1.267 + } 1.268 + test_cp_scl(a1, a2); 1.269 + for (int i=0; i<ARRLEN; i++) { 1.270 + int val = (i%SCALE != 0) ? -1 : 123; 1.271 + errn += verify("test_cp_scl: a1", i, a1.get(i), val); 1.272 + } 1.273 + test_2ci_scl(a1, a2); 1.274 + for (int i=0; i<ARRLEN; i++) { 1.275 + if (i%SCALE != 0) { 1.276 + errn += verify("test_2ci_scl: a1", i, a1.get(i), -1); 1.277 + } else if (i*SCALE < ARRLEN) { 1.278 + errn += verify("test_2ci_scl: a1", i*SCALE, a1.get(i*SCALE), -123); 1.279 + } 1.280 + if (i%SCALE != 0) { 1.281 + errn += verify("test_2ci_scl: a2", i, a2.get(i), -1); 1.282 + } else if (i*SCALE < ARRLEN) { 1.283 + errn += verify("test_2ci_scl: a2", i*SCALE, a2.get(i*SCALE), -103); 1.284 + } 1.285 + } 1.286 + test_2vi_scl(a1, a2, 123, 103); 1.287 + for (int i=0; i<ARRLEN; i++) { 1.288 + if (i%SCALE != 0) { 1.289 + errn += verify("test_2vi_scl: a1", i, a1.get(i), -1); 1.290 + } else if (i*SCALE < ARRLEN) { 1.291 + errn += verify("test_2vi_scl: a1", i*SCALE, a1.get(i*SCALE), 123); 1.292 + } 1.293 + if (i%SCALE != 0) { 1.294 + errn += verify("test_2vi_scl: a2", i, a2.get(i), -1); 1.295 + } else if (i*SCALE < ARRLEN) { 1.296 + errn += verify("test_2vi_scl: a2", i*SCALE, a2.get(i*SCALE), 103); 1.297 + } 1.298 + } 1.299 + // Reset for 2 arrays with relative aligned offset 1.300 + for (int i=0; i<ARRLEN; i++) { 1.301 + a1.set(i, -1); 1.302 + a2.set(i, -1); 1.303 + } 1.304 + test_vi(a2, 123, -1); 1.305 + test_cp_alndst(a1, a2); 1.306 + for (int i=0; i<ALIGN_OFF; i++) { 1.307 + errn += verify("test_cp_alndst: a1", i, a1.get(i), -1); 1.308 + } 1.309 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.310 + errn += verify("test_cp_alndst: a1", i, a1.get(i), 123); 1.311 + } 1.312 + for (int i=0; i<ALIGN_OFF; i++) { 1.313 + a1.set(i, 123); 1.314 + } 1.315 + test_vi(a2, -123, 123); 1.316 + test_cp_alnsrc(a1, a2); 1.317 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 1.318 + errn += verify("test_cp_alnsrc: a1", i, a1.get(i), -123); 1.319 + } 1.320 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 1.321 + errn += verify("test_cp_alnsrc: a1", i, a1.get(i), 123); 1.322 + } 1.323 + for (int i=0; i<ARRLEN; i++) { 1.324 + a1.set(i, -1); 1.325 + a2.set(i, -1); 1.326 + } 1.327 + test_2ci_aln(a1, a2); 1.328 + for (int i=0; i<ALIGN_OFF; i++) { 1.329 + errn += verify("test_2ci_aln: a1", i, a1.get(i), -1); 1.330 + } 1.331 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.332 + errn += verify("test_2ci_aln: a1", i, a1.get(i), -123); 1.333 + } 1.334 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 1.335 + errn += verify("test_2ci_aln: a2", i, a2.get(i), -103); 1.336 + } 1.337 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 1.338 + errn += verify("test_2ci_aln: a2", i, a2.get(i), -1); 1.339 + } 1.340 + for (int i=0; i<ARRLEN; i++) { 1.341 + a1.set(i, -1); 1.342 + a2.set(i, -1); 1.343 + } 1.344 + test_2vi_aln(a1, a2, 123, 103); 1.345 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 1.346 + errn += verify("test_2vi_aln: a1", i, a1.get(i), 123); 1.347 + } 1.348 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 1.349 + errn += verify("test_2vi_aln: a1", i, a1.get(i), -1); 1.350 + } 1.351 + for (int i=0; i<ALIGN_OFF; i++) { 1.352 + errn += verify("test_2vi_aln: a2", i, a2.get(i), -1); 1.353 + } 1.354 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.355 + errn += verify("test_2vi_aln: a2", i, a2.get(i), 103); 1.356 + } 1.357 + 1.358 + // Reset for 2 arrays with relative unaligned offset 1.359 + for (int i=0; i<ARRLEN; i++) { 1.360 + a1.set(i, -1); 1.361 + a2.set(i, -1); 1.362 + } 1.363 + test_vi(a2, 123, -1); 1.364 + test_cp_unalndst(a1, a2); 1.365 + for (int i=0; i<UNALIGN_OFF; i++) { 1.366 + errn += verify("test_cp_unalndst: a1", i, a1.get(i), -1); 1.367 + } 1.368 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.369 + errn += verify("test_cp_unalndst: a1", i, a1.get(i), 123); 1.370 + } 1.371 + test_vi(a2, -123, 123); 1.372 + test_cp_unalnsrc(a1, a2); 1.373 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 1.374 + errn += verify("test_cp_unalnsrc: a1", i, a1.get(i), -123); 1.375 + } 1.376 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 1.377 + errn += verify("test_cp_unalnsrc: a1", i, a1.get(i), 123); 1.378 + } 1.379 + for (int i=0; i<ARRLEN; i++) { 1.380 + a1.set(i, -1); 1.381 + a2.set(i, -1); 1.382 + } 1.383 + test_2ci_unaln(a1, a2); 1.384 + for (int i=0; i<UNALIGN_OFF; i++) { 1.385 + errn += verify("test_2ci_unaln: a1", i, a1.get(i), -1); 1.386 + } 1.387 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.388 + errn += verify("test_2ci_unaln: a1", i, a1.get(i), -123); 1.389 + } 1.390 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 1.391 + errn += verify("test_2ci_unaln: a2", i, a2.get(i), -103); 1.392 + } 1.393 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 1.394 + errn += verify("test_2ci_unaln: a2", i, a2.get(i), -1); 1.395 + } 1.396 + for (int i=0; i<ARRLEN; i++) { 1.397 + a1.set(i, -1); 1.398 + a2.set(i, -1); 1.399 + } 1.400 + test_2vi_unaln(a1, a2, 123, 103); 1.401 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 1.402 + errn += verify("test_2vi_unaln: a1", i, a1.get(i), 123); 1.403 + } 1.404 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 1.405 + errn += verify("test_2vi_unaln: a1", i, a1.get(i), -1); 1.406 + } 1.407 + for (int i=0; i<UNALIGN_OFF; i++) { 1.408 + errn += verify("test_2vi_unaln: a2", i, a2.get(i), -1); 1.409 + } 1.410 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.411 + errn += verify("test_2vi_unaln: a2", i, a2.get(i), 103); 1.412 + } 1.413 + 1.414 + // Reset for aligned overlap initialization 1.415 + for (int i=0; i<ALIGN_OFF; i++) { 1.416 + a1.set(i, i); 1.417 + } 1.418 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.419 + a1.set(i, -1); 1.420 + } 1.421 + test_cp_alndst(a1, a1); 1.422 + for (int i=0; i<ARRLEN; i++) { 1.423 + int v = i%ALIGN_OFF; 1.424 + errn += verify("test_cp_alndst_overlap: a1", i, a1.get(i), v); 1.425 + } 1.426 + for (int i=0; i<ALIGN_OFF; i++) { 1.427 + a1.set((i+ALIGN_OFF), -1); 1.428 + } 1.429 + test_cp_alnsrc(a1, a1); 1.430 + for (int i=0; i<ALIGN_OFF; i++) { 1.431 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1.get(i), -1); 1.432 + } 1.433 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.434 + int v = i%ALIGN_OFF; 1.435 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1.get(i), v); 1.436 + } 1.437 + for (int i=0; i<ARRLEN; i++) { 1.438 + a1.set(i, -1); 1.439 + } 1.440 + test_2ci_aln(a1, a1); 1.441 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 1.442 + errn += verify("test_2ci_aln_overlap: a1", i, a1.get(i), -103); 1.443 + } 1.444 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 1.445 + errn += verify("test_2ci_aln_overlap: a1", i, a1.get(i), -123); 1.446 + } 1.447 + for (int i=0; i<ARRLEN; i++) { 1.448 + a1.set(i, -1); 1.449 + } 1.450 + test_2vi_aln(a1, a1, 123, 103); 1.451 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 1.452 + errn += verify("test_2vi_aln_overlap: a1", i, a1.get(i), 123); 1.453 + } 1.454 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 1.455 + errn += verify("test_2vi_aln_overlap: a1", i, a1.get(i), 103); 1.456 + } 1.457 + 1.458 + // Reset for unaligned overlap initialization 1.459 + for (int i=0; i<UNALIGN_OFF; i++) { 1.460 + a1.set(i, i); 1.461 + } 1.462 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.463 + a1.set(i, -1); 1.464 + } 1.465 + test_cp_unalndst(a1, a1); 1.466 + for (int i=0; i<ARRLEN; i++) { 1.467 + int v = i%UNALIGN_OFF; 1.468 + errn += verify("test_cp_unalndst_overlap: a1", i, a1.get(i), v); 1.469 + } 1.470 + for (int i=0; i<UNALIGN_OFF; i++) { 1.471 + a1.set((i+UNALIGN_OFF), -1); 1.472 + } 1.473 + test_cp_unalnsrc(a1, a1); 1.474 + for (int i=0; i<UNALIGN_OFF; i++) { 1.475 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1.get(i), -1); 1.476 + } 1.477 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.478 + int v = i%UNALIGN_OFF; 1.479 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1.get(i), v); 1.480 + } 1.481 + for (int i=0; i<ARRLEN; i++) { 1.482 + a1.set(i, -1); 1.483 + } 1.484 + test_2ci_unaln(a1, a1); 1.485 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 1.486 + errn += verify("test_2ci_unaln_overlap: a1", i, a1.get(i), -103); 1.487 + } 1.488 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 1.489 + errn += verify("test_2ci_unaln_overlap: a1", i, a1.get(i), -123); 1.490 + } 1.491 + for (int i=0; i<ARRLEN; i++) { 1.492 + a1.set(i, -1); 1.493 + } 1.494 + test_2vi_unaln(a1, a1, 123, 103); 1.495 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 1.496 + errn += verify("test_2vi_unaln_overlap: a1", i, a1.get(i), 123); 1.497 + } 1.498 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 1.499 + errn += verify("test_2vi_unaln_overlap: a1", i, a1.get(i), 103); 1.500 + } 1.501 + 1.502 + } 1.503 + 1.504 + if (errn > 0 || test_only) 1.505 + return errn; 1.506 + 1.507 + // Initialize 1.508 + for (int i=0; i<ARRLEN; i++) { 1.509 + a1.set(i, -1); 1.510 + a2.set(i, -1); 1.511 + } 1.512 + System.out.println("Time"); 1.513 + long start, end; 1.514 + start = System.currentTimeMillis(); 1.515 + for (int i=0; i<ITERS; i++) { 1.516 + test_ci(a1); 1.517 + } 1.518 + end = System.currentTimeMillis(); 1.519 + System.out.println("test_ci: " + (end - start)); 1.520 + start = System.currentTimeMillis(); 1.521 + for (int i=0; i<ITERS; i++) { 1.522 + test_vi(a2, 123, -1); 1.523 + } 1.524 + end = System.currentTimeMillis(); 1.525 + System.out.println("test_vi: " + (end - start)); 1.526 + start = System.currentTimeMillis(); 1.527 + for (int i=0; i<ITERS; i++) { 1.528 + test_cp(a1, a2); 1.529 + } 1.530 + end = System.currentTimeMillis(); 1.531 + System.out.println("test_cp: " + (end - start)); 1.532 + start = System.currentTimeMillis(); 1.533 + for (int i=0; i<ITERS; i++) { 1.534 + test_2ci(a1, a2); 1.535 + } 1.536 + end = System.currentTimeMillis(); 1.537 + System.out.println("test_2ci: " + (end - start)); 1.538 + start = System.currentTimeMillis(); 1.539 + for (int i=0; i<ITERS; i++) { 1.540 + test_2vi(a1, a2, 123, 103); 1.541 + } 1.542 + end = System.currentTimeMillis(); 1.543 + System.out.println("test_2vi: " + (end - start)); 1.544 + 1.545 + start = System.currentTimeMillis(); 1.546 + for (int i=0; i<ITERS; i++) { 1.547 + test_ci_neg(a1, 123); 1.548 + } 1.549 + end = System.currentTimeMillis(); 1.550 + System.out.println("test_ci_neg: " + (end - start)); 1.551 + start = System.currentTimeMillis(); 1.552 + for (int i=0; i<ITERS; i++) { 1.553 + test_vi_neg(a2, 123, 103); 1.554 + } 1.555 + end = System.currentTimeMillis(); 1.556 + System.out.println("test_vi_neg: " + (end - start)); 1.557 + start = System.currentTimeMillis(); 1.558 + for (int i=0; i<ITERS; i++) { 1.559 + test_cp_neg(a1, a2); 1.560 + } 1.561 + end = System.currentTimeMillis(); 1.562 + System.out.println("test_cp_neg: " + (end - start)); 1.563 + start = System.currentTimeMillis(); 1.564 + for (int i=0; i<ITERS; i++) { 1.565 + test_2ci_neg(a1, a2); 1.566 + } 1.567 + end = System.currentTimeMillis(); 1.568 + System.out.println("test_2ci_neg: " + (end - start)); 1.569 + start = System.currentTimeMillis(); 1.570 + for (int i=0; i<ITERS; i++) { 1.571 + test_2vi_neg(a1, a2, 123, 103); 1.572 + } 1.573 + end = System.currentTimeMillis(); 1.574 + System.out.println("test_2vi_neg: " + (end - start)); 1.575 + 1.576 + start = System.currentTimeMillis(); 1.577 + for (int i=0; i<ITERS; i++) { 1.578 + test_ci_oppos(a1, 123); 1.579 + } 1.580 + end = System.currentTimeMillis(); 1.581 + System.out.println("test_ci_oppos: " + (end - start)); 1.582 + start = System.currentTimeMillis(); 1.583 + for (int i=0; i<ITERS; i++) { 1.584 + test_vi_oppos(a2, 123, 103); 1.585 + } 1.586 + end = System.currentTimeMillis(); 1.587 + System.out.println("test_vi_oppos: " + (end - start)); 1.588 + start = System.currentTimeMillis(); 1.589 + for (int i=0; i<ITERS; i++) { 1.590 + test_cp_oppos(a1, a2); 1.591 + } 1.592 + end = System.currentTimeMillis(); 1.593 + System.out.println("test_cp_oppos: " + (end - start)); 1.594 + start = System.currentTimeMillis(); 1.595 + for (int i=0; i<ITERS; i++) { 1.596 + test_2ci_oppos(a1, a2); 1.597 + } 1.598 + end = System.currentTimeMillis(); 1.599 + System.out.println("test_2ci_oppos: " + (end - start)); 1.600 + start = System.currentTimeMillis(); 1.601 + for (int i=0; i<ITERS; i++) { 1.602 + test_2vi_oppos(a1, a2, 123, 103); 1.603 + } 1.604 + end = System.currentTimeMillis(); 1.605 + System.out.println("test_2vi_oppos: " + (end - start)); 1.606 + 1.607 + start = System.currentTimeMillis(); 1.608 + for (int i=0; i<ITERS; i++) { 1.609 + test_ci_off(a1, 123); 1.610 + } 1.611 + end = System.currentTimeMillis(); 1.612 + System.out.println("test_ci_off: " + (end - start)); 1.613 + start = System.currentTimeMillis(); 1.614 + for (int i=0; i<ITERS; i++) { 1.615 + test_vi_off(a2, 123, 103); 1.616 + } 1.617 + end = System.currentTimeMillis(); 1.618 + System.out.println("test_vi_off: " + (end - start)); 1.619 + start = System.currentTimeMillis(); 1.620 + for (int i=0; i<ITERS; i++) { 1.621 + test_cp_off(a1, a2); 1.622 + } 1.623 + end = System.currentTimeMillis(); 1.624 + System.out.println("test_cp_off: " + (end - start)); 1.625 + start = System.currentTimeMillis(); 1.626 + for (int i=0; i<ITERS; i++) { 1.627 + test_2ci_off(a1, a2); 1.628 + } 1.629 + end = System.currentTimeMillis(); 1.630 + System.out.println("test_2ci_off: " + (end - start)); 1.631 + start = System.currentTimeMillis(); 1.632 + for (int i=0; i<ITERS; i++) { 1.633 + test_2vi_off(a1, a2, 123, 103); 1.634 + } 1.635 + end = System.currentTimeMillis(); 1.636 + System.out.println("test_2vi_off: " + (end - start)); 1.637 + 1.638 + start = System.currentTimeMillis(); 1.639 + for (int i=0; i<ITERS; i++) { 1.640 + test_ci_inv(a1, OFFSET, 123); 1.641 + } 1.642 + end = System.currentTimeMillis(); 1.643 + System.out.println("test_ci_inv: " + (end - start)); 1.644 + start = System.currentTimeMillis(); 1.645 + for (int i=0; i<ITERS; i++) { 1.646 + test_vi_inv(a2, 123, OFFSET, 103); 1.647 + } 1.648 + end = System.currentTimeMillis(); 1.649 + System.out.println("test_vi_inv: " + (end - start)); 1.650 + start = System.currentTimeMillis(); 1.651 + for (int i=0; i<ITERS; i++) { 1.652 + test_cp_inv(a1, a2, OFFSET); 1.653 + } 1.654 + end = System.currentTimeMillis(); 1.655 + System.out.println("test_cp_inv: " + (end - start)); 1.656 + start = System.currentTimeMillis(); 1.657 + for (int i=0; i<ITERS; i++) { 1.658 + test_2ci_inv(a1, a2, OFFSET); 1.659 + } 1.660 + end = System.currentTimeMillis(); 1.661 + System.out.println("test_2ci_inv: " + (end - start)); 1.662 + start = System.currentTimeMillis(); 1.663 + for (int i=0; i<ITERS; i++) { 1.664 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 1.665 + } 1.666 + end = System.currentTimeMillis(); 1.667 + System.out.println("test_2vi_inv: " + (end - start)); 1.668 + 1.669 + start = System.currentTimeMillis(); 1.670 + for (int i=0; i<ITERS; i++) { 1.671 + test_ci_scl(a1, 123); 1.672 + } 1.673 + end = System.currentTimeMillis(); 1.674 + System.out.println("test_ci_scl: " + (end - start)); 1.675 + start = System.currentTimeMillis(); 1.676 + for (int i=0; i<ITERS; i++) { 1.677 + test_vi_scl(a2, 123, 103); 1.678 + } 1.679 + end = System.currentTimeMillis(); 1.680 + System.out.println("test_vi_scl: " + (end - start)); 1.681 + start = System.currentTimeMillis(); 1.682 + for (int i=0; i<ITERS; i++) { 1.683 + test_cp_scl(a1, a2); 1.684 + } 1.685 + end = System.currentTimeMillis(); 1.686 + System.out.println("test_cp_scl: " + (end - start)); 1.687 + start = System.currentTimeMillis(); 1.688 + for (int i=0; i<ITERS; i++) { 1.689 + test_2ci_scl(a1, a2); 1.690 + } 1.691 + end = System.currentTimeMillis(); 1.692 + System.out.println("test_2ci_scl: " + (end - start)); 1.693 + start = System.currentTimeMillis(); 1.694 + for (int i=0; i<ITERS; i++) { 1.695 + test_2vi_scl(a1, a2, 123, 103); 1.696 + } 1.697 + end = System.currentTimeMillis(); 1.698 + System.out.println("test_2vi_scl: " + (end - start)); 1.699 + 1.700 + start = System.currentTimeMillis(); 1.701 + for (int i=0; i<ITERS; i++) { 1.702 + test_cp_alndst(a1, a2); 1.703 + } 1.704 + end = System.currentTimeMillis(); 1.705 + System.out.println("test_cp_alndst: " + (end - start)); 1.706 + start = System.currentTimeMillis(); 1.707 + for (int i=0; i<ITERS; i++) { 1.708 + test_cp_alnsrc(a1, a2); 1.709 + } 1.710 + end = System.currentTimeMillis(); 1.711 + System.out.println("test_cp_alnsrc: " + (end - start)); 1.712 + start = System.currentTimeMillis(); 1.713 + for (int i=0; i<ITERS; i++) { 1.714 + test_2ci_aln(a1, a2); 1.715 + } 1.716 + end = System.currentTimeMillis(); 1.717 + System.out.println("test_2ci_aln: " + (end - start)); 1.718 + start = System.currentTimeMillis(); 1.719 + for (int i=0; i<ITERS; i++) { 1.720 + test_2vi_aln(a1, a2, 123, 103); 1.721 + } 1.722 + end = System.currentTimeMillis(); 1.723 + System.out.println("test_2vi_aln: " + (end - start)); 1.724 + 1.725 + start = System.currentTimeMillis(); 1.726 + for (int i=0; i<ITERS; i++) { 1.727 + test_cp_unalndst(a1, a2); 1.728 + } 1.729 + end = System.currentTimeMillis(); 1.730 + System.out.println("test_cp_unalndst: " + (end - start)); 1.731 + start = System.currentTimeMillis(); 1.732 + for (int i=0; i<ITERS; i++) { 1.733 + test_cp_unalnsrc(a1, a2); 1.734 + } 1.735 + end = System.currentTimeMillis(); 1.736 + System.out.println("test_cp_unalnsrc: " + (end - start)); 1.737 + start = System.currentTimeMillis(); 1.738 + for (int i=0; i<ITERS; i++) { 1.739 + test_2ci_unaln(a1, a2); 1.740 + } 1.741 + end = System.currentTimeMillis(); 1.742 + System.out.println("test_2ci_unaln: " + (end - start)); 1.743 + start = System.currentTimeMillis(); 1.744 + for (int i=0; i<ITERS; i++) { 1.745 + test_2vi_unaln(a1, a2, 123, 103); 1.746 + } 1.747 + end = System.currentTimeMillis(); 1.748 + System.out.println("test_2vi_unaln: " + (end - start)); 1.749 + 1.750 + return errn; 1.751 + } 1.752 + 1.753 + static void test_ci(AtomicIntegerArray a) { 1.754 + for (int i = 0; i < ARRLEN; i+=1) { 1.755 + a.compareAndSet(i, -1, -123); 1.756 + } 1.757 + } 1.758 + static void test_vi(AtomicIntegerArray a, int b, int old) { 1.759 + for (int i = 0; i < ARRLEN; i+=1) { 1.760 + a.compareAndSet(i, old, b); 1.761 + } 1.762 + } 1.763 + static void test_cp(AtomicIntegerArray a, AtomicIntegerArray b) { 1.764 + for (int i = 0; i < ARRLEN; i+=1) { 1.765 + a.compareAndSet(i, -123, b.get(i)); 1.766 + } 1.767 + } 1.768 + static void test_2ci(AtomicIntegerArray a, AtomicIntegerArray b) { 1.769 + for (int i = 0; i < ARRLEN; i+=1) { 1.770 + a.compareAndSet(i, 123, -123); 1.771 + b.compareAndSet(i, 123, -103); 1.772 + } 1.773 + } 1.774 + static void test_2vi(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 1.775 + for (int i = 0; i < ARRLEN; i+=1) { 1.776 + a.compareAndSet(i, -123, c); 1.777 + b.compareAndSet(i, -103, d); 1.778 + } 1.779 + } 1.780 + static void test_ci_neg(AtomicIntegerArray a, int old) { 1.781 + for (int i = ARRLEN-1; i >= 0; i-=1) { 1.782 + a.compareAndSet(i, old, -123); 1.783 + } 1.784 + } 1.785 + static void test_vi_neg(AtomicIntegerArray a, int b, int old) { 1.786 + for (int i = ARRLEN-1; i >= 0; i-=1) { 1.787 + a.compareAndSet(i, old, b); 1.788 + } 1.789 + } 1.790 + static void test_cp_neg(AtomicIntegerArray a, AtomicIntegerArray b) { 1.791 + for (int i = ARRLEN-1; i >= 0; i-=1) { 1.792 + a.compareAndSet(i, -123, b.get(i)); 1.793 + } 1.794 + } 1.795 + static void test_2ci_neg(AtomicIntegerArray a, AtomicIntegerArray b) { 1.796 + for (int i = ARRLEN-1; i >= 0; i-=1) { 1.797 + a.compareAndSet(i, 123, -123); 1.798 + b.compareAndSet(i, 123, -103); 1.799 + } 1.800 + } 1.801 + static void test_2vi_neg(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 1.802 + for (int i = ARRLEN-1; i >= 0; i-=1) { 1.803 + a.compareAndSet(i, -123, c); 1.804 + b.compareAndSet(i, -103, d); 1.805 + } 1.806 + } 1.807 + static void test_ci_oppos(AtomicIntegerArray a, int old) { 1.808 + int limit = ARRLEN-1; 1.809 + for (int i = 0; i < ARRLEN; i+=1) { 1.810 + a.compareAndSet((limit-i), old, -123); 1.811 + } 1.812 + } 1.813 + static void test_vi_oppos(AtomicIntegerArray a, int b, int old) { 1.814 + int limit = ARRLEN-1; 1.815 + for (int i = limit; i >= 0; i-=1) { 1.816 + a.compareAndSet((limit-i), old, b); 1.817 + } 1.818 + } 1.819 + static void test_cp_oppos(AtomicIntegerArray a, AtomicIntegerArray b) { 1.820 + int limit = ARRLEN-1; 1.821 + for (int i = 0; i < ARRLEN; i+=1) { 1.822 + a.compareAndSet(i, -123, b.get(limit-i)); 1.823 + } 1.824 + } 1.825 + static void test_2ci_oppos(AtomicIntegerArray a, AtomicIntegerArray b) { 1.826 + int limit = ARRLEN-1; 1.827 + for (int i = 0; i < ARRLEN; i+=1) { 1.828 + a.compareAndSet((limit-i), 123, -123); 1.829 + b.compareAndSet(i, 123, -103); 1.830 + } 1.831 + } 1.832 + static void test_2vi_oppos(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 1.833 + int limit = ARRLEN-1; 1.834 + for (int i = limit; i >= 0; i-=1) { 1.835 + a.compareAndSet(i, -123, c); 1.836 + b.compareAndSet((limit-i), -103, d); 1.837 + } 1.838 + } 1.839 + static void test_ci_off(AtomicIntegerArray a, int old) { 1.840 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 1.841 + a.compareAndSet((i+OFFSET), old, -123); 1.842 + } 1.843 + } 1.844 + static void test_vi_off(AtomicIntegerArray a, int b, int old) { 1.845 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 1.846 + a.compareAndSet((i+OFFSET), old, b); 1.847 + } 1.848 + } 1.849 + static void test_cp_off(AtomicIntegerArray a, AtomicIntegerArray b) { 1.850 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 1.851 + a.compareAndSet((i+OFFSET), -123, b.get(i+OFFSET)); 1.852 + } 1.853 + } 1.854 + static void test_2ci_off(AtomicIntegerArray a, AtomicIntegerArray b) { 1.855 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 1.856 + a.compareAndSet((i+OFFSET), 123, -123); 1.857 + b.compareAndSet((i+OFFSET), 123, -103); 1.858 + } 1.859 + } 1.860 + static void test_2vi_off(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 1.861 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 1.862 + a.compareAndSet((i+OFFSET), -123, c); 1.863 + b.compareAndSet((i+OFFSET), -103, d); 1.864 + } 1.865 + } 1.866 + static void test_ci_inv(AtomicIntegerArray a, int k, int old) { 1.867 + for (int i = 0; i < ARRLEN-k; i+=1) { 1.868 + a.compareAndSet((i+k), old, -123); 1.869 + } 1.870 + } 1.871 + static void test_vi_inv(AtomicIntegerArray a, int b, int k, int old) { 1.872 + for (int i = 0; i < ARRLEN-k; i+=1) { 1.873 + a.compareAndSet((i+k), old, b); 1.874 + } 1.875 + } 1.876 + static void test_cp_inv(AtomicIntegerArray a, AtomicIntegerArray b, int k) { 1.877 + for (int i = 0; i < ARRLEN-k; i+=1) { 1.878 + a.compareAndSet((i+k), -123, b.get(i+k)); 1.879 + } 1.880 + } 1.881 + static void test_2ci_inv(AtomicIntegerArray a, AtomicIntegerArray b, int k) { 1.882 + for (int i = 0; i < ARRLEN-k; i+=1) { 1.883 + a.compareAndSet((i+k), 123, -123); 1.884 + b.compareAndSet((i+k), 123, -103); 1.885 + } 1.886 + } 1.887 + static void test_2vi_inv(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d, int k) { 1.888 + for (int i = 0; i < ARRLEN-k; i+=1) { 1.889 + a.compareAndSet((i+k), -123, c); 1.890 + b.compareAndSet((i+k), -103, d); 1.891 + } 1.892 + } 1.893 + static void test_ci_scl(AtomicIntegerArray a, int old) { 1.894 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 1.895 + a.compareAndSet((i*SCALE), old, -123); 1.896 + } 1.897 + } 1.898 + static void test_vi_scl(AtomicIntegerArray a, int b, int old) { 1.899 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 1.900 + a.compareAndSet((i*SCALE), old, b); 1.901 + } 1.902 + } 1.903 + static void test_cp_scl(AtomicIntegerArray a, AtomicIntegerArray b) { 1.904 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 1.905 + a.compareAndSet((i*SCALE), -123, b.get(i*SCALE)); 1.906 + } 1.907 + } 1.908 + static void test_2ci_scl(AtomicIntegerArray a, AtomicIntegerArray b) { 1.909 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 1.910 + a.compareAndSet((i*SCALE), 123, -123); 1.911 + b.compareAndSet((i*SCALE), 123, -103); 1.912 + } 1.913 + } 1.914 + static void test_2vi_scl(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 1.915 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 1.916 + a.compareAndSet((i*SCALE), -123, c); 1.917 + b.compareAndSet((i*SCALE), -103, d); 1.918 + } 1.919 + } 1.920 + static void test_cp_alndst(AtomicIntegerArray a, AtomicIntegerArray b) { 1.921 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 1.922 + a.compareAndSet((i+ALIGN_OFF), -1, b.get(i)); 1.923 + } 1.924 + } 1.925 + static void test_cp_alnsrc(AtomicIntegerArray a, AtomicIntegerArray b) { 1.926 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 1.927 + a.getAndSet(i, b.get(i+ALIGN_OFF)); 1.928 + } 1.929 + } 1.930 + static void test_2ci_aln(AtomicIntegerArray a, AtomicIntegerArray b) { 1.931 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 1.932 + a.compareAndSet((i+ALIGN_OFF), -1, -123); 1.933 + b.getAndSet(i, -103); 1.934 + } 1.935 + } 1.936 + static void test_2vi_aln(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 1.937 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 1.938 + a.getAndSet(i, c); 1.939 + b.getAndSet((i+ALIGN_OFF), d); 1.940 + } 1.941 + } 1.942 + static void test_cp_unalndst(AtomicIntegerArray a, AtomicIntegerArray b) { 1.943 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 1.944 + a.compareAndSet((i+UNALIGN_OFF), -1, b.get(i)); 1.945 + } 1.946 + } 1.947 + static void test_cp_unalnsrc(AtomicIntegerArray a, AtomicIntegerArray b) { 1.948 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 1.949 + a.getAndSet(i, b.get(i+UNALIGN_OFF)); 1.950 + } 1.951 + } 1.952 + static void test_2ci_unaln(AtomicIntegerArray a, AtomicIntegerArray b) { 1.953 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 1.954 + a.compareAndSet((i+UNALIGN_OFF), -1, -123); 1.955 + b.getAndSet(i, -103); 1.956 + } 1.957 + } 1.958 + static void test_2vi_unaln(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 1.959 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 1.960 + a.getAndSet(i, c); 1.961 + b.getAndSet((i+UNALIGN_OFF), d); 1.962 + } 1.963 + } 1.964 + 1.965 + static int verify(String text, int i, int elem, int val) { 1.966 + if (elem != val) { 1.967 + System.err.println(text + "[" + i + "] = " + elem + " != " + val); 1.968 + return 1; 1.969 + } 1.970 + return 0; 1.971 + } 1.972 +}