Tue, 26 Feb 2013 11:52:06 +0100
Merge
1.1 --- a/.hgtags Fri Feb 22 11:01:01 2013 -0800 1.2 +++ b/.hgtags Tue Feb 26 11:52:06 2013 +0100 1.3 @@ -316,3 +316,5 @@ 1.4 412d722168bc23f8e6d98995202728678561417f hs25-b18 1.5 cdb46031e7184d37301288f5719121a63c7054b5 jdk8-b77 1.6 9f19f4a7d48a4ebe7f616b6068971ea5f8b075fa hs25-b19 1.7 +d5e12e7d2f719144d84903d9151455661c47b476 jdk8-b78 1.8 +555ec35a250783110aa070dbc8a8603f6cabe41f hs25-b20
2.1 --- a/agent/src/os/bsd/MacosxDebuggerLocal.m Fri Feb 22 11:01:01 2013 -0800 2.2 +++ b/agent/src/os/bsd/MacosxDebuggerLocal.m Tue Feb 26 11:52:06 2013 +0100 2.3 @@ -38,6 +38,8 @@ 2.4 #import <dlfcn.h> 2.5 #import <limits.h> 2.6 #import <errno.h> 2.7 +#import <sys/types.h> 2.8 +#import <sys/ptrace.h> 2.9 2.10 jboolean debug = JNI_FALSE; 2.11 2.12 @@ -430,6 +432,73 @@ 2.13 return (jint) usable_tid; 2.14 } 2.15 2.16 + 2.17 +static bool ptrace_continue(pid_t pid, int signal) { 2.18 + // pass the signal to the process so we don't swallow it 2.19 + int res; 2.20 + if ((res = ptrace(PT_CONTINUE, pid, (caddr_t)1, signal)) < 0) { 2.21 + fprintf(stderr, "attach: ptrace(PT_CONTINUE, %d) failed with %d\n", pid, res); 2.22 + return false; 2.23 + } 2.24 + return true; 2.25 +} 2.26 + 2.27 +// waits until the ATTACH has stopped the process 2.28 +// by signal SIGSTOP 2.29 +static bool ptrace_waitpid(pid_t pid) { 2.30 + int ret; 2.31 + int status; 2.32 + while (true) { 2.33 + // Wait for debuggee to stop. 2.34 + ret = waitpid(pid, &status, 0); 2.35 + if (ret >= 0) { 2.36 + if (WIFSTOPPED(status)) { 2.37 + // Any signal will stop the thread, make sure it is SIGSTOP. Otherwise SIGSTOP 2.38 + // will still be pending and delivered when the process is DETACHED and the process 2.39 + // will go to sleep. 2.40 + if (WSTOPSIG(status) == SIGSTOP) { 2.41 + // Debuggee stopped by SIGSTOP. 2.42 + return true; 2.43 + } 2.44 + if (!ptrace_continue(pid, WSTOPSIG(status))) { 2.45 + fprintf(stderr, "attach: Failed to correctly attach to VM. VM might HANG! [PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(status)); 2.46 + return false; 2.47 + } 2.48 + } else { 2.49 + fprintf(stderr, "attach: waitpid(): Child process exited/terminated (status = 0x%x)\n", status); 2.50 + return false; 2.51 + } 2.52 + } else { 2.53 + switch (errno) { 2.54 + case EINTR: 2.55 + continue; 2.56 + break; 2.57 + case ECHILD: 2.58 + fprintf(stderr, "attach: waitpid() failed. Child process pid (%d) does not exist \n", pid); 2.59 + break; 2.60 + case EINVAL: 2.61 + fprintf(stderr, "attach: waitpid() failed. Invalid options argument.\n"); 2.62 + break; 2.63 + default: 2.64 + fprintf(stderr, "attach: waitpid() failed. Unexpected error %d\n",errno); 2.65 + break; 2.66 + } 2.67 + return false; 2.68 + } 2.69 + } 2.70 +} 2.71 + 2.72 +// attach to a process/thread specified by "pid" 2.73 +static bool ptrace_attach(pid_t pid) { 2.74 + int res; 2.75 + if ((res = ptrace(PT_ATTACH, pid, 0, 0)) < 0) { 2.76 + fprintf(stderr, "ptrace(PT_ATTACH, %d) failed with %d\n", pid, res); 2.77 + return false; 2.78 + } else { 2.79 + return ptrace_waitpid(pid); 2.80 + } 2.81 +} 2.82 + 2.83 /* 2.84 * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal 2.85 * Method: attach0 2.86 @@ -445,7 +514,8 @@ 2.87 else 2.88 debug = JNI_FALSE; 2.89 if (debug) printf("attach0 called for jpid=%d\n", (int)jpid); 2.90 - 2.91 + 2.92 + // get the task from the pid 2.93 kern_return_t result; 2.94 task_t gTask = 0; 2.95 result = task_for_pid(mach_task_self(), jpid, &gTask); 2.96 @@ -455,6 +525,13 @@ 2.97 } 2.98 putTask(env, this_obj, gTask); 2.99 2.100 + // use ptrace to stop the process 2.101 + // on os x, ptrace only needs to be called on the process, not the individual threads 2.102 + if (ptrace_attach(jpid) != true) { 2.103 + mach_port_deallocate(mach_task_self(), gTask); 2.104 + THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process"); 2.105 + } 2.106 + 2.107 id symbolicator = nil; 2.108 id jrsSymbolicator = objc_lookUpClass("JRSSymbolicator"); 2.109 if (jrsSymbolicator != nil) { 2.110 @@ -486,6 +563,21 @@ 2.111 if (debug) printf("detach0 called\n"); 2.112 2.113 task_t gTask = getTask(env, this_obj); 2.114 + 2.115 + // detach from the ptraced process causing it to resume execution 2.116 + int pid; 2.117 + kern_return_t k_res; 2.118 + k_res = pid_for_task(gTask, &pid); 2.119 + if (k_res != KERN_SUCCESS) { 2.120 + fprintf(stderr, "detach: pid_for_task(%d) failed (%d)\n", pid, k_res); 2.121 + } 2.122 + else { 2.123 + int res = ptrace(PT_DETACH, pid, 0, 0); 2.124 + if (res < 0) { 2.125 + fprintf(stderr, "detach: ptrace(PT_DETACH, %d) failed (%d)\n", pid, res); 2.126 + } 2.127 + } 2.128 + 2.129 mach_port_deallocate(mach_task_self(), gTask); 2.130 id symbolicator = getSymbolicator(env, this_obj); 2.131 if (symbolicator != nil) {
3.1 --- a/agent/src/os/bsd/libproc_impl.c Fri Feb 22 11:01:01 2013 -0800 3.2 +++ b/agent/src/os/bsd/libproc_impl.c Tue Feb 26 11:52:06 2013 +0100 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -91,6 +91,14 @@ 3.11 } 3.12 } 3.13 3.14 +void print_error(const char* format,...) { 3.15 + va_list alist; 3.16 + va_start(alist, format); 3.17 + fputs("ERROR: ", stderr); 3.18 + vfprintf(stderr, format, alist); 3.19 + va_end(alist); 3.20 +} 3.21 + 3.22 bool is_debug() { 3.23 return _libsaproc_debug; 3.24 }
4.1 --- a/agent/src/os/bsd/libproc_impl.h Fri Feb 22 11:01:01 2013 -0800 4.2 +++ b/agent/src/os/bsd/libproc_impl.h Tue Feb 26 11:52:06 2013 +0100 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -107,6 +107,7 @@ 4.11 int pathmap_open(const char* name); 4.12 4.13 void print_debug(const char* format,...); 4.14 +void print_error(const char* format,...); 4.15 bool is_debug(); 4.16 4.17 typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
5.1 --- a/agent/src/os/bsd/ps_proc.c Fri Feb 22 11:01:01 2013 -0800 5.2 +++ b/agent/src/os/bsd/ps_proc.c Tue Feb 26 11:52:06 2013 +0100 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -129,42 +129,66 @@ 5.11 return (errno == 0)? true: false; 5.12 } 5.13 5.14 +static bool ptrace_continue(pid_t pid, int signal) { 5.15 + // pass the signal to the process so we don't swallow it 5.16 + if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) { 5.17 + print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid); 5.18 + return false; 5.19 + } 5.20 + return true; 5.21 +} 5.22 + 5.23 +// waits until the ATTACH has stopped the process 5.24 +// by signal SIGSTOP 5.25 +static bool ptrace_waitpid(pid_t pid) { 5.26 + int ret; 5.27 + int status; 5.28 + do { 5.29 + // Wait for debuggee to stop. 5.30 + ret = waitpid(pid, &status, 0); 5.31 + if (ret >= 0) { 5.32 + if (WIFSTOPPED(status)) { 5.33 + // Any signal will stop the thread, make sure it is SIGSTOP. Otherwise SIGSTOP 5.34 + // will still be pending and delivered when the process is DETACHED and the process 5.35 + // will go to sleep. 5.36 + if (WSTOPSIG(status) == SIGSTOP) { 5.37 + // Debuggee stopped by SIGSTOP. 5.38 + return true; 5.39 + } 5.40 + if (!ptrace_continue(pid, WSTOPSIG(status))) { 5.41 + print_error("Failed to correctly attach to VM. VM might HANG! [PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(status)); 5.42 + return false; 5.43 + } 5.44 + } else { 5.45 + print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status); 5.46 + return false; 5.47 + } 5.48 + } else { 5.49 + switch (errno) { 5.50 + case EINTR: 5.51 + continue; 5.52 + break; 5.53 + case ECHILD: 5.54 + print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid); 5.55 + break; 5.56 + case EINVAL: 5.57 + print_debug("waitpid() failed. Invalid options argument.\n"); 5.58 + break; 5.59 + default: 5.60 + print_debug("waitpid() failed. Unexpected error %d\n",errno); 5.61 + } 5.62 + return false; 5.63 + } 5.64 + } while(true); 5.65 +} 5.66 + 5.67 // attach to a process/thread specified by "pid" 5.68 static bool ptrace_attach(pid_t pid) { 5.69 if (ptrace(PT_ATTACH, pid, NULL, 0) < 0) { 5.70 print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid); 5.71 return false; 5.72 } else { 5.73 - int ret; 5.74 - int status; 5.75 - do { 5.76 - // Wait for debuggee to stop. 5.77 - ret = waitpid(pid, &status, 0); 5.78 - if (ret >= 0) { 5.79 - if (WIFSTOPPED(status)) { 5.80 - // Debuggee stopped. 5.81 - return true; 5.82 - } else { 5.83 - print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status); 5.84 - return false; 5.85 - } 5.86 - } else { 5.87 - switch (errno) { 5.88 - case EINTR: 5.89 - continue; 5.90 - break; 5.91 - case ECHILD: 5.92 - print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid); 5.93 - break; 5.94 - case EINVAL: 5.95 - print_debug("waitpid() failed. Invalid options argument.\n"); 5.96 - break; 5.97 - default: 5.98 - print_debug("waitpid() failed. Unexpected error %d\n",errno); 5.99 - } 5.100 - return false; 5.101 - } 5.102 - } while(true); 5.103 + return ptrace_waitpid(pid); 5.104 } 5.105 } 5.106
6.1 --- a/agent/src/os/linux/libproc_impl.c Fri Feb 22 11:01:01 2013 -0800 6.2 +++ b/agent/src/os/linux/libproc_impl.c Tue Feb 26 11:52:06 2013 +0100 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -92,6 +92,14 @@ 6.11 } 6.12 } 6.13 6.14 +void print_error(const char* format,...) { 6.15 + va_list alist; 6.16 + va_start(alist, format); 6.17 + fputs("ERROR: ", stderr); 6.18 + vfprintf(stderr, format, alist); 6.19 + va_end(alist); 6.20 +} 6.21 + 6.22 bool is_debug() { 6.23 return _libsaproc_debug; 6.24 }
7.1 --- a/agent/src/os/linux/libproc_impl.h Fri Feb 22 11:01:01 2013 -0800 7.2 +++ b/agent/src/os/linux/libproc_impl.h Tue Feb 26 11:52:06 2013 +0100 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -105,6 +105,7 @@ 7.11 int pathmap_open(const char* name); 7.12 7.13 void print_debug(const char* format,...); 7.14 +void print_error(const char* format,...); 7.15 bool is_debug(); 7.16 7.17 typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
8.1 --- a/agent/src/os/linux/ps_proc.c Fri Feb 22 11:01:01 2013 -0800 8.2 +++ b/agent/src/os/linux/ps_proc.c Tue Feb 26 11:52:06 2013 +0100 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -25,6 +25,7 @@ 8.11 #include <stdio.h> 8.12 #include <stdlib.h> 8.13 #include <string.h> 8.14 +#include <signal.h> 8.15 #include <errno.h> 8.16 #include <sys/ptrace.h> 8.17 #include "libproc_impl.h" 8.18 @@ -142,46 +143,71 @@ 8.19 8.20 } 8.21 8.22 +static bool ptrace_continue(pid_t pid, int signal) { 8.23 + // pass the signal to the process so we don't swallow it 8.24 + if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) { 8.25 + print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid); 8.26 + return false; 8.27 + } 8.28 + return true; 8.29 +} 8.30 + 8.31 +// waits until the ATTACH has stopped the process 8.32 +// by signal SIGSTOP 8.33 +static bool ptrace_waitpid(pid_t pid) { 8.34 + int ret; 8.35 + int status; 8.36 + while (true) { 8.37 + // Wait for debuggee to stop. 8.38 + ret = waitpid(pid, &status, 0); 8.39 + if (ret == -1 && errno == ECHILD) { 8.40 + // try cloned process. 8.41 + ret = waitpid(pid, &status, __WALL); 8.42 + } 8.43 + if (ret >= 0) { 8.44 + if (WIFSTOPPED(status)) { 8.45 + // Any signal will stop the thread, make sure it is SIGSTOP. Otherwise SIGSTOP 8.46 + // will still be pending and delivered when the process is DETACHED and the process 8.47 + // will go to sleep. 8.48 + if (WSTOPSIG(status) == SIGSTOP) { 8.49 + // Debuggee stopped by SIGSTOP. 8.50 + return true; 8.51 + } 8.52 + if (!ptrace_continue(pid, WSTOPSIG(status))) { 8.53 + print_error("Failed to correctly attach to VM. VM might HANG! [PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(status)); 8.54 + return false; 8.55 + } 8.56 + } else { 8.57 + print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status); 8.58 + return false; 8.59 + } 8.60 + } else { 8.61 + switch (errno) { 8.62 + case EINTR: 8.63 + continue; 8.64 + break; 8.65 + case ECHILD: 8.66 + print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid); 8.67 + break; 8.68 + case EINVAL: 8.69 + print_debug("waitpid() failed. Invalid options argument.\n"); 8.70 + break; 8.71 + default: 8.72 + print_debug("waitpid() failed. Unexpected error %d\n",errno); 8.73 + break; 8.74 + } 8.75 + return false; 8.76 + } 8.77 + } 8.78 +} 8.79 + 8.80 // attach to a process/thread specified by "pid" 8.81 static bool ptrace_attach(pid_t pid) { 8.82 if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) < 0) { 8.83 print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid); 8.84 return false; 8.85 } else { 8.86 - int ret; 8.87 - int status; 8.88 - do { 8.89 - // Wait for debuggee to stop. 8.90 - ret = waitpid(pid, &status, 0); 8.91 - if (ret == -1 && errno == ECHILD) { 8.92 - // try cloned process. 8.93 - ret = waitpid(pid, &status, __WALL); 8.94 - } 8.95 - if (ret >= 0) { 8.96 - if (WIFSTOPPED(status)) { 8.97 - // Debuggee stopped. 8.98 - return true; 8.99 - } else { 8.100 - print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status); 8.101 - return false; 8.102 - } 8.103 - } else { 8.104 - switch (errno) { 8.105 - case EINTR: 8.106 - continue; 8.107 - break; 8.108 - case ECHILD: 8.109 - print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid); 8.110 - break; 8.111 - case EINVAL: 8.112 - print_debug("waitpid() failed. Invalid options argument.\n"); 8.113 - break; 8.114 - default: 8.115 - print_debug("waitpid() failed. Unexpected error %d\n",errno); 8.116 - } 8.117 - return false; 8.118 - } 8.119 - } while(true); 8.120 + return ptrace_waitpid(pid); 8.121 } 8.122 } 8.123
9.1 --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java Fri Feb 22 11:01:01 2013 -0800 9.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java Tue Feb 26 11:52:06 2013 +0100 9.3 @@ -61,15 +61,13 @@ 9.4 CMSBitMap markBitMap = markBitMap(); 9.5 long addressSize = VM.getVM().getAddressSize(); 9.6 if ( markBitMap.isMarked(addr) && markBitMap.isMarked(addr.addOffsetTo(1*addressSize)) ) { 9.7 - System.err.println("Printezis bits are set..."); 9.8 Address nextOneAddr = markBitMap.getNextMarkedWordAddress(addr.addOffsetTo(2*addressSize)); 9.9 //return size in bytes 9.10 long size = (nextOneAddr.addOffsetTo(1*addressSize)).minus(addr); 9.11 return size; 9.12 } else { 9.13 - //missing Printezis marks 9.14 - System.err.println("Missing Printszis marks..."); 9.15 - return -1; 9.16 + //missing Printezis marks 9.17 + return -1; 9.18 } 9.19 9.20 }
10.1 --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java Fri Feb 22 11:01:01 2013 -0800 10.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java Tue Feb 26 11:52:06 2013 +0100 10.3 @@ -191,7 +191,6 @@ 10.4 //Find the object size using Printezis bits and skip over 10.5 long size = collector().blockSizeUsingPrintezisBits(cur); 10.6 if (size == -1) { 10.7 - System.err.println("Printezis bits not set..."); 10.8 break; 10.9 } 10.10 cur = cur.addOffsetTo(adjustObjectSizeInBytes(size));
11.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java Fri Feb 22 11:01:01 2013 -0800 11.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java Tue Feb 26 11:52:06 2013 +0100 11.3 @@ -184,7 +184,6 @@ 11.4 if (trapReasonName[index] == null) { 11.5 throw new InternalError("missing reason for " + index); 11.6 } 11.7 - System.out.println(trapReasonName[index]); 11.8 } 11.9 } 11.10
12.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Fri Feb 22 11:01:01 2013 -0800 12.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Tue Feb 26 11:52:06 2013 +0100 12.3 @@ -335,7 +335,6 @@ 12.4 } 12.5 if (obj == null) { 12.6 //Find the object size using Printezis bits and skip over 12.7 - System.err.println("Finding object size using Printezis bits and skipping over..."); 12.8 long size = 0; 12.9 12.10 if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle) ){
13.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Fri Feb 22 11:01:01 2013 -0800 13.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Tue Feb 26 11:52:06 2013 +0100 13.3 @@ -90,10 +90,6 @@ 13.4 /** Flags indicating whether we are attached to a core, C1, or C2 build */ 13.5 private boolean usingClientCompiler; 13.6 private boolean usingServerCompiler; 13.7 - /** Flag indicating whether UseTLAB is turned on */ 13.8 - private boolean useTLAB; 13.9 - /** Flag indicating whether invokedynamic support is on */ 13.10 - private boolean enableInvokeDynamic; 13.11 /** alignment constants */ 13.12 private boolean isLP64; 13.13 private int bytesPerLong; 13.14 @@ -326,9 +322,6 @@ 13.15 } 13.16 } 13.17 13.18 - useTLAB = (db.lookupIntConstant("UseTLAB").intValue() != 0); 13.19 - enableInvokeDynamic = (db.lookupIntConstant("EnableInvokeDynamic").intValue() != 0); 13.20 - 13.21 if (debugger != null) { 13.22 isLP64 = debugger.getMachineDescription().isLP64(); 13.23 } 13.24 @@ -579,15 +572,6 @@ 13.25 } 13.26 } 13.27 13.28 - /** Indicates whether Thread-Local Allocation Buffers are used */ 13.29 - public boolean getUseTLAB() { 13.30 - return useTLAB; 13.31 - } 13.32 - 13.33 - public boolean getEnableInvokeDynamic() { 13.34 - return enableInvokeDynamic; 13.35 - } 13.36 - 13.37 public TypeDataBase getTypeDataBase() { 13.38 return db; 13.39 } 13.40 @@ -822,6 +806,12 @@ 13.41 return objectAlignmentInBytes; 13.42 } 13.43 13.44 + /** Indicates whether Thread-Local Allocation Buffers are used */ 13.45 + public boolean getUseTLAB() { 13.46 + Flag flag = getCommandLineFlag("UseTLAB"); 13.47 + return (flag == null) ? false: flag.getBool(); 13.48 + } 13.49 + 13.50 // returns null, if not available. 13.51 public Flag[] getCommandLineFlags() { 13.52 if (commandLineFlags == null) {
14.1 --- a/make/bsd/makefiles/vm.make Fri Feb 22 11:01:01 2013 -0800 14.2 +++ b/make/bsd/makefiles/vm.make Tue Feb 26 11:52:06 2013 +0100 14.3 @@ -94,7 +94,12 @@ 14.4 # This is VERY important! The version define must only be supplied to vm_version.o 14.5 # If not, ccache will not re-use the cache at all, since the version string might contain 14.6 # a time and date. 14.7 -vm_version.o: CXXFLAGS += ${JRE_VERSION} 14.8 +CXXFLAGS/vm_version.o += ${JRE_VERSION} 14.9 + 14.10 +CXXFLAGS/BYFILE = $(CXXFLAGS/$@) 14.11 + 14.12 +# File specific flags 14.13 +CXXFLAGS += $(CXXFLAGS/BYFILE) 14.14 14.15 ifdef DEFAULT_LIBPATH 14.16 CXXFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
15.1 --- a/make/excludeSrc.make Fri Feb 22 11:01:01 2013 -0800 15.2 +++ b/make/excludeSrc.make Tue Feb 26 11:52:06 2013 +0100 15.3 @@ -78,7 +78,7 @@ 15.4 15.5 Src_Files_EXCLUDE += \ 15.6 cmsAdaptiveSizePolicy.cpp cmsCollectorPolicy.cpp \ 15.7 - cmsGCAdaptivePolicyCounters.cpp cmsLockVerifier.cpp cmsPermGen.cpp compactibleFreeListSpace.cpp \ 15.8 + cmsGCAdaptivePolicyCounters.cpp cmsLockVerifier.cpp compactibleFreeListSpace.cpp \ 15.9 concurrentMarkSweepGeneration.cpp concurrentMarkSweepThread.cpp \ 15.10 freeChunk.cpp adaptiveFreeList.cpp promotionInfo.cpp vmCMSOperations.cpp collectionSetChooser.cpp \ 15.11 concurrentG1Refine.cpp concurrentG1RefineThread.cpp concurrentMark.cpp concurrentMarkThread.cpp \ 15.12 @@ -91,11 +91,11 @@ 15.13 gcTaskManager.cpp gcTaskThread.cpp objectStartArray.cpp parallelScavengeHeap.cpp parMarkBitMap.cpp \ 15.14 pcTasks.cpp psAdaptiveSizePolicy.cpp psCompactionManager.cpp psGCAdaptivePolicyCounters.cpp \ 15.15 psGenerationCounters.cpp psMarkSweep.cpp psMarkSweepDecorator.cpp psOldGen.cpp psParallelCompact.cpp \ 15.16 - psPermGen.cpp psPromotionLAB.cpp psPromotionManager.cpp psScavenge.cpp psTasks.cpp psVirtualspace.cpp \ 15.17 + psPromotionLAB.cpp psPromotionManager.cpp psScavenge.cpp psTasks.cpp psVirtualspace.cpp \ 15.18 psYoungGen.cpp vmPSOperations.cpp asParNewGeneration.cpp parCardTableModRefBS.cpp \ 15.19 parGCAllocBuffer.cpp parNewGeneration.cpp mutableSpace.cpp gSpaceCounters.cpp allocationStats.cpp \ 15.20 spaceCounters.cpp gcAdaptivePolicyCounters.cpp mutableNUMASpace.cpp immutableSpace.cpp \ 15.21 - immutableSpace.cpp g1MemoryPool.cpp psMemoryPool.cpp yieldWorkingGroup.cpp g1Log.cpp 15.22 + immutableSpace.cpp g1MemoryPool.cpp psMemoryPool.cpp yieldingWorkGroup.cpp g1Log.cpp 15.23 endif 15.24 15.25 ifeq ($(INCLUDE_NMT), false)
16.1 --- a/make/hotspot_version Fri Feb 22 11:01:01 2013 -0800 16.2 +++ b/make/hotspot_version Tue Feb 26 11:52:06 2013 +0100 16.3 @@ -35,7 +35,7 @@ 16.4 16.5 HS_MAJOR_VER=25 16.6 HS_MINOR_VER=0 16.7 -HS_BUILD_NUMBER=20 16.8 +HS_BUILD_NUMBER=21 16.9 16.10 JDK_MAJOR_VER=1 16.11 JDK_MINOR_VER=8
17.1 --- a/make/linux/makefiles/vm.make Fri Feb 22 11:01:01 2013 -0800 17.2 +++ b/make/linux/makefiles/vm.make Tue Feb 26 11:52:06 2013 +0100 17.3 @@ -100,7 +100,13 @@ 17.4 # This is VERY important! The version define must only be supplied to vm_version.o 17.5 # If not, ccache will not re-use the cache at all, since the version string might contain 17.6 # a time and date. 17.7 -vm_version.o: CXXFLAGS += ${JRE_VERSION} 17.8 +CXXFLAGS/vm_version.o += ${JRE_VERSION} 17.9 + 17.10 +CXXFLAGS/BYFILE = $(CXXFLAGS/$@) 17.11 + 17.12 +# File specific flags 17.13 +CXXFLAGS += $(CXXFLAGS/BYFILE) 17.14 + 17.15 17.16 ifndef JAVASE_EMBEDDED 17.17 ifneq (${ARCH},arm)
18.1 --- a/make/solaris/makefiles/vm.make Fri Feb 22 11:01:01 2013 -0800 18.2 +++ b/make/solaris/makefiles/vm.make Tue Feb 26 11:52:06 2013 +0100 18.3 @@ -88,7 +88,13 @@ 18.4 # This is VERY important! The version define must only be supplied to vm_version.o 18.5 # If not, ccache will not re-use the cache at all, since the version string might contain 18.6 # a time and date. 18.7 -vm_version.o: CXXFLAGS += ${JRE_VERSION} 18.8 +CXXFLAGS/vm_version.o += ${JRE_VERSION} 18.9 + 18.10 +CXXFLAGS/BYFILE = $(CXXFLAGS/$@) 18.11 + 18.12 +# File specific flags 18.13 +CXXFLAGS += $(CXXFLAGS/BYFILE) 18.14 + 18.15 18.16 # CFLAGS_WARN holds compiler options to suppress/enable warnings. 18.17 CFLAGS += $(CFLAGS_WARN)
19.1 --- a/src/os/bsd/vm/os_bsd.cpp Fri Feb 22 11:01:01 2013 -0800 19.2 +++ b/src/os/bsd/vm/os_bsd.cpp Tue Feb 26 11:52:06 2013 +0100 19.3 @@ -2887,7 +2887,9 @@ 19.4 19.5 void signalHandler(int sig, siginfo_t* info, void* uc) { 19.6 assert(info != NULL && uc != NULL, "it must be old kernel"); 19.7 + int orig_errno = errno; // Preserve errno value over signal handler. 19.8 JVM_handle_bsd_signal(sig, info, uc, true); 19.9 + errno = orig_errno; 19.10 } 19.11 19.12
20.1 --- a/src/os/linux/vm/os_linux.cpp Fri Feb 22 11:01:01 2013 -0800 20.2 +++ b/src/os/linux/vm/os_linux.cpp Tue Feb 26 11:52:06 2013 +0100 20.3 @@ -3653,7 +3653,9 @@ 20.4 20.5 void signalHandler(int sig, siginfo_t* info, void* uc) { 20.6 assert(info != NULL && uc != NULL, "it must be old kernel"); 20.7 + int orig_errno = errno; // Preserve errno value over signal handler. 20.8 JVM_handle_linux_signal(sig, info, uc, true); 20.9 + errno = orig_errno; 20.10 } 20.11 20.12
21.1 --- a/src/os/solaris/vm/os_solaris.cpp Fri Feb 22 11:01:01 2013 -0800 21.2 +++ b/src/os/solaris/vm/os_solaris.cpp Tue Feb 26 11:52:06 2013 +0100 21.3 @@ -1865,7 +1865,7 @@ 21.4 21.5 // Die immediately, no exit hook, no abort hook, no cleanup. 21.6 void os::die() { 21.7 - _exit(-1); 21.8 + ::abort(); // dump core (for debugging) 21.9 } 21.10 21.11 // unused 21.12 @@ -4317,7 +4317,9 @@ 21.13 21.14 21.15 void signalHandler(int sig, siginfo_t* info, void* ucVoid) { 21.16 + int orig_errno = errno; // Preserve errno value over signal handler. 21.17 JVM_handle_solaris_signal(sig, info, ucVoid, true); 21.18 + errno = orig_errno; 21.19 } 21.20 21.21 /* Do not delete - if guarantee is ever removed, a signal handler (even empty)
22.1 --- a/src/os/windows/vm/os_windows.cpp Fri Feb 22 11:01:01 2013 -0800 22.2 +++ b/src/os/windows/vm/os_windows.cpp Tue Feb 26 11:52:06 2013 +0100 22.3 @@ -1940,7 +1940,7 @@ 22.4 22.5 // a counter for each possible signal value, including signal_thread exit signal 22.6 static volatile jint pending_signals[NSIG+1] = { 0 }; 22.7 -static HANDLE sig_sem; 22.8 +static HANDLE sig_sem = NULL; 22.9 22.10 void os::signal_init_pd() { 22.11 // Initialize signal structures 22.12 @@ -1970,10 +1970,11 @@ 22.13 22.14 void os::signal_notify(int signal_number) { 22.15 BOOL ret; 22.16 - 22.17 - Atomic::inc(&pending_signals[signal_number]); 22.18 - ret = ::ReleaseSemaphore(sig_sem, 1, NULL); 22.19 - assert(ret != 0, "ReleaseSemaphore() failed"); 22.20 + if (sig_sem != NULL) { 22.21 + Atomic::inc(&pending_signals[signal_number]); 22.22 + ret = ::ReleaseSemaphore(sig_sem, 1, NULL); 22.23 + assert(ret != 0, "ReleaseSemaphore() failed"); 22.24 + } 22.25 } 22.26 22.27 static int check_pending_signals(bool wait_for_signal) {
23.1 --- a/src/share/vm/c1/c1_LIR.cpp Fri Feb 22 11:01:01 2013 -0800 23.2 +++ b/src/share/vm/c1/c1_LIR.cpp Tue Feb 26 11:52:06 2013 +0100 23.3 @@ -814,7 +814,7 @@ 23.4 23.5 // only visit register parameters 23.6 int n = opJavaCall->_arguments->length(); 23.7 - for (int i = 0; i < n; i++) { 23.8 + for (int i = opJavaCall->_receiver->is_valid() ? 1 : 0; i < n; i++) { 23.9 if (!opJavaCall->_arguments->at(i)->is_pointer()) { 23.10 do_input(*opJavaCall->_arguments->adr_at(i)); 23.11 }
24.1 --- a/src/share/vm/classfile/verifier.cpp Fri Feb 22 11:01:01 2013 -0800 24.2 +++ b/src/share/vm/classfile/verifier.cpp Tue Feb 26 11:52:06 2013 +0100 24.3 @@ -1,5 +1,5 @@ 24.4 /* 24.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 24.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.8 * 24.9 * This code is free software; you can redistribute it and/or modify it 24.10 @@ -61,7 +61,8 @@ 24.11 # include "bytes_ppc.hpp" 24.12 #endif 24.13 24.14 -#define NOFAILOVER_MAJOR_VERSION 51 24.15 +#define NOFAILOVER_MAJOR_VERSION 51 24.16 +#define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52 24.17 24.18 // Access to external entry for VerifyClassCodes - old byte code verifier 24.19 24.20 @@ -2317,6 +2318,11 @@ 24.21 types = (1 << JVM_CONSTANT_InterfaceMethodref) | 24.22 (1 << JVM_CONSTANT_Methodref); 24.23 break; 24.24 + case Bytecodes::_invokestatic: 24.25 + types = (_klass->major_version() < STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION) ? 24.26 + (1 << JVM_CONSTANT_Methodref) : 24.27 + ((1 << JVM_CONSTANT_InterfaceMethodref) | (1 << JVM_CONSTANT_Methodref)); 24.28 + break; 24.29 default: 24.30 types = 1 << JVM_CONSTANT_Methodref; 24.31 }
25.1 --- a/src/share/vm/oops/method.hpp Fri Feb 22 11:01:01 2013 -0800 25.2 +++ b/src/share/vm/oops/method.hpp Tue Feb 26 11:52:06 2013 +0100 25.3 @@ -456,6 +456,8 @@ 25.4 void print_codes_on(int from, int to, outputStream* st) const PRODUCT_RETURN; 25.5 25.6 // method parameters 25.7 + bool has_method_parameters() const 25.8 + { return constMethod()->has_method_parameters(); } 25.9 int method_parameters_length() const 25.10 { return constMethod()->method_parameters_length(); } 25.11 MethodParametersElement* method_parameters_start() const
26.1 --- a/src/share/vm/opto/library_call.cpp Fri Feb 22 11:01:01 2013 -0800 26.2 +++ b/src/share/vm/opto/library_call.cpp Tue Feb 26 11:52:06 2013 +0100 26.3 @@ -1481,10 +1481,10 @@ 26.4 Node* arg = round_double_node(argument(0)); 26.5 Node* n; 26.6 switch (id) { 26.7 - case vmIntrinsics::_dabs: n = new (C) AbsDNode( arg); break; 26.8 - case vmIntrinsics::_dsqrt: n = new (C) SqrtDNode(0, arg); break; 26.9 - case vmIntrinsics::_dlog: n = new (C) LogDNode( arg); break; 26.10 - case vmIntrinsics::_dlog10: n = new (C) Log10DNode( arg); break; 26.11 + case vmIntrinsics::_dabs: n = new (C) AbsDNode( arg); break; 26.12 + case vmIntrinsics::_dsqrt: n = new (C) SqrtDNode(C, control(), arg); break; 26.13 + case vmIntrinsics::_dlog: n = new (C) LogDNode(C, control(), arg); break; 26.14 + case vmIntrinsics::_dlog10: n = new (C) Log10DNode(C, control(), arg); break; 26.15 default: fatal_unexpected_iid(id); break; 26.16 } 26.17 set_result(_gvn.transform(n)); 26.18 @@ -1499,9 +1499,9 @@ 26.19 Node* n = NULL; 26.20 26.21 switch (id) { 26.22 - case vmIntrinsics::_dsin: n = new (C) SinDNode(arg); break; 26.23 - case vmIntrinsics::_dcos: n = new (C) CosDNode(arg); break; 26.24 - case vmIntrinsics::_dtan: n = new (C) TanDNode(arg); break; 26.25 + case vmIntrinsics::_dsin: n = new (C) SinDNode(C, control(), arg); break; 26.26 + case vmIntrinsics::_dcos: n = new (C) CosDNode(C, control(), arg); break; 26.27 + case vmIntrinsics::_dtan: n = new (C) TanDNode(C, control(), arg); break; 26.28 default: fatal_unexpected_iid(id); break; 26.29 } 26.30 n = _gvn.transform(n);
27.1 --- a/src/share/vm/opto/subnode.hpp Fri Feb 22 11:01:01 2013 -0800 27.2 +++ b/src/share/vm/opto/subnode.hpp Tue Feb 26 11:52:06 2013 +0100 27.3 @@ -399,7 +399,10 @@ 27.4 // Cosinus of a double 27.5 class CosDNode : public Node { 27.6 public: 27.7 - CosDNode( Node *in1 ) : Node(0, in1) {} 27.8 + CosDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { 27.9 + init_flags(Flag_is_expensive); 27.10 + C->add_expensive_node(this); 27.11 + } 27.12 virtual int Opcode() const; 27.13 const Type *bottom_type() const { return Type::DOUBLE; } 27.14 virtual uint ideal_reg() const { return Op_RegD; } 27.15 @@ -410,7 +413,10 @@ 27.16 // Sinus of a double 27.17 class SinDNode : public Node { 27.18 public: 27.19 - SinDNode( Node *in1 ) : Node(0, in1) {} 27.20 + SinDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { 27.21 + init_flags(Flag_is_expensive); 27.22 + C->add_expensive_node(this); 27.23 + } 27.24 virtual int Opcode() const; 27.25 const Type *bottom_type() const { return Type::DOUBLE; } 27.26 virtual uint ideal_reg() const { return Op_RegD; } 27.27 @@ -422,7 +428,10 @@ 27.28 // tangens of a double 27.29 class TanDNode : public Node { 27.30 public: 27.31 - TanDNode(Node *in1 ) : Node(0, in1) {} 27.32 + TanDNode(Compile* C, Node *c,Node *in1) : Node(c, in1) { 27.33 + init_flags(Flag_is_expensive); 27.34 + C->add_expensive_node(this); 27.35 + } 27.36 virtual int Opcode() const; 27.37 const Type *bottom_type() const { return Type::DOUBLE; } 27.38 virtual uint ideal_reg() const { return Op_RegD; } 27.39 @@ -445,7 +454,10 @@ 27.40 // square root a double 27.41 class SqrtDNode : public Node { 27.42 public: 27.43 - SqrtDNode(Node *c, Node *in1 ) : Node(c, in1) {} 27.44 + SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { 27.45 + init_flags(Flag_is_expensive); 27.46 + C->add_expensive_node(this); 27.47 + } 27.48 virtual int Opcode() const; 27.49 const Type *bottom_type() const { return Type::DOUBLE; } 27.50 virtual uint ideal_reg() const { return Op_RegD; } 27.51 @@ -470,7 +482,10 @@ 27.52 // Log_e of a double 27.53 class LogDNode : public Node { 27.54 public: 27.55 - LogDNode( Node *in1 ) : Node(0, in1) {} 27.56 + LogDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { 27.57 + init_flags(Flag_is_expensive); 27.58 + C->add_expensive_node(this); 27.59 + } 27.60 virtual int Opcode() const; 27.61 const Type *bottom_type() const { return Type::DOUBLE; } 27.62 virtual uint ideal_reg() const { return Op_RegD; } 27.63 @@ -481,7 +496,10 @@ 27.64 // Log_10 of a double 27.65 class Log10DNode : public Node { 27.66 public: 27.67 - Log10DNode( Node *in1 ) : Node(0, in1) {} 27.68 + Log10DNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { 27.69 + init_flags(Flag_is_expensive); 27.70 + C->add_expensive_node(this); 27.71 + } 27.72 virtual int Opcode() const; 27.73 const Type *bottom_type() const { return Type::DOUBLE; } 27.74 virtual uint ideal_reg() const { return Op_RegD; }
28.1 --- a/src/share/vm/opto/superword.cpp Fri Feb 22 11:01:01 2013 -0800 28.2 +++ b/src/share/vm/opto/superword.cpp Tue Feb 26 11:52:06 2013 +0100 28.3 @@ -143,7 +143,8 @@ 28.4 28.5 // Ready the block 28.6 28.7 - construct_bb(); 28.8 + if (!construct_bb()) 28.9 + return; // Exit if no interesting nodes or complex graph. 28.10 28.11 dependence_graph(); 28.12 28.13 @@ -615,6 +616,7 @@ 28.14 if (n == stop) break; 28.15 preds.push(n); 28.16 prev = n; 28.17 + assert(n->is_Mem(), err_msg_res("unexpected node %s", n->Name())); 28.18 n = n->in(MemNode::Memory); 28.19 } 28.20 } 28.21 @@ -1578,7 +1580,7 @@ 28.22 28.23 //------------------------------construct_bb--------------------------- 28.24 // Construct reverse postorder list of block members 28.25 -void SuperWord::construct_bb() { 28.26 +bool SuperWord::construct_bb() { 28.27 Node* entry = bb(); 28.28 28.29 assert(_stk.length() == 0, "stk is empty"); 28.30 @@ -1596,6 +1598,12 @@ 28.31 Node *n = lpt()->_body.at(i); 28.32 set_bb_idx(n, i); // Create a temporary map 28.33 if (in_bb(n)) { 28.34 + if (n->is_LoadStore() || n->is_MergeMem() || 28.35 + (n->is_Proj() && !n->as_Proj()->is_CFG())) { 28.36 + // Bailout if the loop has LoadStore, MergeMem or data Proj 28.37 + // nodes. Superword optimization does not work with them. 28.38 + return false; 28.39 + } 28.40 bb_ct++; 28.41 if (!n->is_CFG()) { 28.42 bool found = false; 28.43 @@ -1620,6 +1628,10 @@ 28.44 if (in_bb(n) && (n->is_Phi() && n->bottom_type() == Type::MEMORY)) { 28.45 Node* n_tail = n->in(LoopNode::LoopBackControl); 28.46 if (n_tail != n->in(LoopNode::EntryControl)) { 28.47 + if (!n_tail->is_Mem()) { 28.48 + assert(n_tail->is_Mem(), err_msg_res("unexpected node for memory slice: %s", n_tail->Name())); 28.49 + return false; // Bailout 28.50 + } 28.51 _mem_slice_head.push(n); 28.52 _mem_slice_tail.push(n_tail); 28.53 } 28.54 @@ -1695,6 +1707,7 @@ 28.55 } 28.56 #endif 28.57 assert(rpo_idx == -1 && bb_ct == _block.length(), "all block members found"); 28.58 + return (_mem_slice_head.length() > 0) || (_data_entry.length() > 0); 28.59 } 28.60 28.61 //------------------------------initialize_bb---------------------------
29.1 --- a/src/share/vm/opto/superword.hpp Fri Feb 22 11:01:01 2013 -0800 29.2 +++ b/src/share/vm/opto/superword.hpp Tue Feb 26 11:52:06 2013 +0100 29.3 @@ -380,7 +380,7 @@ 29.4 // Is use->in(u_idx) a vector use? 29.5 bool is_vector_use(Node* use, int u_idx); 29.6 // Construct reverse postorder list of block members 29.7 - void construct_bb(); 29.8 + bool construct_bb(); 29.9 // Initialize per node info 29.10 void initialize_bb(); 29.11 // Insert n into block after pos
30.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp Fri Feb 22 11:01:01 2013 -0800 30.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp Tue Feb 26 11:52:06 2013 +0100 30.3 @@ -1558,6 +1558,18 @@ 30.4 } break; 30.5 } 30.6 } // end for each bytecode 30.7 + 30.8 + // We also need to rewrite the parameter name indexes, if there is 30.9 + // method parameter data present 30.10 + if(method->has_method_parameters()) { 30.11 + const int len = method->method_parameters_length(); 30.12 + MethodParametersElement* elem = method->method_parameters_start(); 30.13 + 30.14 + for (int i = 0; i < len; i++) { 30.15 + const u2 cp_index = elem[i].name_cp_index; 30.16 + elem[i].name_cp_index = find_new_index(cp_index); 30.17 + } 30.18 + } 30.19 } // end rewrite_cp_refs_in_method() 30.20 30.21
31.1 --- a/src/share/vm/runtime/arguments.cpp Fri Feb 22 11:01:01 2013 -0800 31.2 +++ b/src/share/vm/runtime/arguments.cpp Tue Feb 26 11:52:06 2013 +0100 31.3 @@ -1738,16 +1738,6 @@ 31.4 return false; 31.5 } 31.6 31.7 -static void force_serial_gc() { 31.8 - FLAG_SET_DEFAULT(UseSerialGC, true); 31.9 - FLAG_SET_DEFAULT(UseParNewGC, false); 31.10 - FLAG_SET_DEFAULT(UseConcMarkSweepGC, false); 31.11 - FLAG_SET_DEFAULT(CMSIncrementalMode, false); // special CMS suboption 31.12 - FLAG_SET_DEFAULT(UseParallelGC, false); 31.13 - FLAG_SET_DEFAULT(UseParallelOldGC, false); 31.14 - FLAG_SET_DEFAULT(UseG1GC, false); 31.15 -} 31.16 - 31.17 static bool verify_serial_gc_flags() { 31.18 return (UseSerialGC && 31.19 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC || 31.20 @@ -2498,7 +2488,12 @@ 31.21 } 31.22 // Out of the box management support 31.23 if (match_option(option, "-Dcom.sun.management", &tail)) { 31.24 +#if INCLUDE_MANAGEMENT 31.25 FLAG_SET_CMDLINE(bool, ManagementServer, true); 31.26 +#else 31.27 + vm_exit_during_initialization( 31.28 + "-Dcom.sun.management is not supported in this VM.", NULL); 31.29 +#endif 31.30 } 31.31 // -Xint 31.32 } else if (match_option(option, "-Xint", &tail)) { 31.33 @@ -2844,6 +2839,11 @@ 31.34 // away and will cause VM initialization failures! 31.35 warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release."); 31.36 FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true); 31.37 +#if !INCLUDE_MANAGEMENT 31.38 + } else if (match_option(option, "-XX:+ManagementServer", &tail)) { 31.39 + vm_exit_during_initialization( 31.40 + "ManagementServer is not supported in this VM.", NULL); 31.41 +#endif // INCLUDE_MANAGEMENT 31.42 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx 31.43 // Skip -XX:Flags= since that case has already been handled 31.44 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) { 31.45 @@ -3072,6 +3072,27 @@ 31.46 } \ 31.47 } while(0) 31.48 31.49 + 31.50 +#define UNSUPPORTED_GC_OPTION(gc) \ 31.51 +do { \ 31.52 + if (gc) { \ 31.53 + if (FLAG_IS_CMDLINE(gc)) { \ 31.54 + warning(#gc " is not supported in this VM. Using Serial GC."); \ 31.55 + } \ 31.56 + FLAG_SET_DEFAULT(gc, false); \ 31.57 + } \ 31.58 +} while(0) 31.59 + 31.60 +static void force_serial_gc() { 31.61 + FLAG_SET_DEFAULT(UseSerialGC, true); 31.62 + FLAG_SET_DEFAULT(CMSIncrementalMode, false); // special CMS suboption 31.63 + UNSUPPORTED_GC_OPTION(UseG1GC); 31.64 + UNSUPPORTED_GC_OPTION(UseParallelGC); 31.65 + UNSUPPORTED_GC_OPTION(UseParallelOldGC); 31.66 + UNSUPPORTED_GC_OPTION(UseConcMarkSweepGC); 31.67 + UNSUPPORTED_GC_OPTION(UseParNewGC); 31.68 +} 31.69 + 31.70 // Parse entry point called from JNI_CreateJavaVM 31.71 31.72 jint Arguments::parse(const JavaVMInitArgs* args) { 31.73 @@ -3187,28 +3208,15 @@ 31.74 hotspotrc, hotspotrc); 31.75 } 31.76 31.77 -#if (defined JAVASE_EMBEDDED || defined ARM) 31.78 - UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); 31.79 -#endif 31.80 - 31.81 #ifdef _ALLBSD_SOURCE // UseLargePages is not yet supported on BSD. 31.82 UNSUPPORTED_OPTION(UseLargePages, "-XX:+UseLargePages"); 31.83 #endif 31.84 31.85 -#if !INCLUDE_ALL_GCS 31.86 - if (UseParallelGC) { 31.87 - warning("Parallel GC is not supported in this VM. Using Serial GC."); 31.88 - } 31.89 - if (UseParallelOldGC) { 31.90 - warning("Parallel Old GC is not supported in this VM. Using Serial GC."); 31.91 - } 31.92 - if (UseConcMarkSweepGC) { 31.93 - warning("Concurrent Mark Sweep GC is not supported in this VM. Using Serial GC."); 31.94 - } 31.95 - if (UseParNewGC) { 31.96 - warning("Par New GC is not supported in this VM. Using Serial GC."); 31.97 - } 31.98 -#endif // INCLUDE_ALL_GCS 31.99 +#if INCLUDE_ALL_GCS 31.100 + #if (defined JAVASE_EMBEDDED || defined ARM) 31.101 + UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); 31.102 + #endif 31.103 +#endif 31.104 31.105 #ifndef PRODUCT 31.106 if (TraceBytecodesAt != 0) {
32.1 --- a/src/share/vm/runtime/vmStructs.cpp Fri Feb 22 11:01:01 2013 -0800 32.2 +++ b/src/share/vm/runtime/vmStructs.cpp Tue Feb 26 11:52:06 2013 +0100 32.3 @@ -2109,8 +2109,6 @@ 32.4 /* Useful globals */ \ 32.5 /******************/ \ 32.6 \ 32.7 - declare_constant(UseTLAB) \ 32.8 - declare_constant(EnableInvokeDynamic) \ 32.9 \ 32.10 /**************/ \ 32.11 /* Stack bias */ \
33.1 --- a/src/share/vm/utilities/yieldingWorkgroup.cpp Fri Feb 22 11:01:01 2013 -0800 33.2 +++ b/src/share/vm/utilities/yieldingWorkgroup.cpp Tue Feb 26 11:52:06 2013 +0100 33.3 @@ -24,9 +24,7 @@ 33.4 33.5 #include "precompiled.hpp" 33.6 #include "utilities/macros.hpp" 33.7 -#if INCLUDE_ALL_GCS 33.8 #include "utilities/yieldingWorkgroup.hpp" 33.9 -#endif // INCLUDE_ALL_GCS 33.10 33.11 // Forward declaration of classes declared here. 33.12
34.1 --- a/test/compiler/5091921/Test6850611.java Fri Feb 22 11:01:01 2013 -0800 34.2 +++ b/test/compiler/5091921/Test6850611.java Tue Feb 26 11:52:06 2013 +0100 34.3 @@ -1,5 +1,5 @@ 34.4 /* 34.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 34.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 34.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 34.8 * 34.9 * This code is free software; you can redistribute it and/or modify it 34.10 @@ -27,7 +27,7 @@ 34.11 * @bug 6850611 34.12 * @summary int / long arithmetic seems to be broken in 1.6.0_14 HotSpot Server VM (Win XP) 34.13 * 34.14 - * @run main Test6850611 34.15 + * @run main/timeout=480 Test6850611 34.16 */ 34.17 34.18 public class Test6850611 {
35.1 --- a/test/compiler/5091921/Test6890943.java Fri Feb 22 11:01:01 2013 -0800 35.2 +++ b/test/compiler/5091921/Test6890943.java Tue Feb 26 11:52:06 2013 +0100 35.3 @@ -1,5 +1,5 @@ 35.4 /* 35.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 35.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 35.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.8 * 35.9 * This code is free software; you can redistribute it and/or modify it 35.10 @@ -27,7 +27,7 @@ 35.11 * @bug 6890943 35.12 * @summary JVM mysteriously gives wrong result on 64-bit 1.6 VMs in hotspot mode. 35.13 * 35.14 - * @run shell Test6890943.sh 35.15 + * @run shell/timeout=240 Test6890943.sh 35.16 */ 35.17 import java.util.*; 35.18 import java.io.*;
36.1 --- a/test/compiler/5091921/Test6890943.sh Fri Feb 22 11:01:01 2013 -0800 36.2 +++ b/test/compiler/5091921/Test6890943.sh Tue Feb 26 11:52:06 2013 +0100 36.3 @@ -1,6 +1,6 @@ 36.4 #!/bin/sh 36.5 # 36.6 -# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 36.7 +# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 36.8 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.9 # 36.10 # This code is free software; you can redistribute it and/or modify it 36.11 @@ -52,7 +52,10 @@ 36.12 36.13 ${TESTJAVA}/bin/javac -d . Test6890943.java 36.14 36.15 -${TESTJAVA}/bin/java -XX:-PrintVMOptions ${TESTVMOPTS} Test6890943 < input6890943.txt > test.out 2>&1 36.16 +${TESTJAVA}/bin/java -XX:-PrintVMOptions -XX:+IgnoreUnrecognizedVMOptions ${TESTVMOPTS} Test6890943 < input6890943.txt > pretest.out 2>&1 36.17 + 36.18 +# This test sometimes tickles an unrelated performance warning that interferes with diff. 36.19 +grep -v 'warning: Performance bug: SystemDictionary' pretest.out > test.out 36.20 36.21 diff output6890943.txt test.out 36.22
37.1 --- a/test/compiler/5091921/Test6905845.java Fri Feb 22 11:01:01 2013 -0800 37.2 +++ b/test/compiler/5091921/Test6905845.java Tue Feb 26 11:52:06 2013 +0100 37.3 @@ -1,5 +1,5 @@ 37.4 /* 37.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 37.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 37.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.8 * 37.9 * This code is free software; you can redistribute it and/or modify it 37.10 @@ -27,7 +27,7 @@ 37.11 * @bug 6905845 37.12 * @summary Server VM improperly optimizing away loop. 37.13 * 37.14 - * @run main Test6905845 37.15 + * @run main/timeout=480 Test6905845 37.16 */ 37.17 37.18 public class Test6905845 {
38.1 --- a/test/compiler/5091921/Test6992759.java Fri Feb 22 11:01:01 2013 -0800 38.2 +++ b/test/compiler/5091921/Test6992759.java Tue Feb 26 11:52:06 2013 +0100 38.3 @@ -1,5 +1,5 @@ 38.4 /* 38.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 38.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 38.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.8 * 38.9 * This code is free software; you can redistribute it and/or modify it 38.10 @@ -27,7 +27,7 @@ 38.11 * @bug 6992759 38.12 * @summary Bad code generated for integer <= comparison, fails for Integer.MAX_VALUE 38.13 * 38.14 - * @run main Test6992759 38.15 + * @run main/timeout=240 Test6992759 38.16 */ 38.17 38.18 public class Test6992759 {
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/test/compiler/8004867/TestIntAtomicCAS.java Tue Feb 26 11:52:06 2013 +0100 39.3 @@ -0,0 +1,969 @@ 39.4 +/* 39.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 39.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.7 + * 39.8 + * This code is free software; you can redistribute it and/or modify it 39.9 + * under the terms of the GNU General Public License version 2 only, as 39.10 + * published by the Free Software Foundation. 39.11 + * 39.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 39.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 39.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 39.15 + * version 2 for more details (a copy is included in the LICENSE file that 39.16 + * accompanied this code). 39.17 + * 39.18 + * You should have received a copy of the GNU General Public License version 39.19 + * 2 along with this work; if not, write to the Free Software Foundation, 39.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 39.21 + * 39.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 39.23 + * or visit www.oracle.com if you need additional information or have any 39.24 + * questions. 39.25 + * 39.26 + */ 39.27 + 39.28 +/** 39.29 + * @test 39.30 + * @bug 8004867 39.31 + * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" 39.32 + * 39.33 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicCAS 39.34 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicCAS 39.35 + */ 39.36 + 39.37 +import java.util.concurrent.atomic.AtomicIntegerArray; 39.38 + 39.39 +public class TestIntAtomicCAS { 39.40 + private static final int ARRLEN = 97; 39.41 + private static final int ITERS = 11000; 39.42 + private static final int OFFSET = 3; 39.43 + private static final int SCALE = 2; 39.44 + private static final int ALIGN_OFF = 8; 39.45 + private static final int UNALIGN_OFF = 5; 39.46 + 39.47 + public static void main(String args[]) { 39.48 + System.out.println("Testing Integer array atomic CAS operations"); 39.49 + int errn = test(false); 39.50 + if (errn > 0) { 39.51 + System.err.println("FAILED: " + errn + " errors"); 39.52 + System.exit(97); 39.53 + } 39.54 + System.out.println("PASSED"); 39.55 + } 39.56 + 39.57 + static int test(boolean test_only) { 39.58 + AtomicIntegerArray a1 = new AtomicIntegerArray(ARRLEN); 39.59 + AtomicIntegerArray a2 = new AtomicIntegerArray(ARRLEN); 39.60 + // Initialize 39.61 + for (int i=0; i<ARRLEN; i++) { 39.62 + a1.set(i, -1); 39.63 + a2.set(i, -1); 39.64 + } 39.65 + System.out.println("Warmup"); 39.66 + for (int i=0; i<ITERS; i++) { 39.67 + test_ci(a1); 39.68 + test_vi(a2, 123, -1); 39.69 + test_cp(a1, a2); 39.70 + test_2ci(a1, a2); 39.71 + test_2vi(a1, a2, 123, 103); 39.72 + test_ci_neg(a1, 123); 39.73 + test_vi_neg(a2, 123, 103); 39.74 + test_cp_neg(a1, a2); 39.75 + test_2ci_neg(a1, a2); 39.76 + test_2vi_neg(a1, a2, 123, 103); 39.77 + test_ci_oppos(a1, 123); 39.78 + test_vi_oppos(a2, 123, 103); 39.79 + test_cp_oppos(a1, a2); 39.80 + test_2ci_oppos(a1, a2); 39.81 + test_2vi_oppos(a1, a2, 123, 103); 39.82 + test_ci_off(a1, 123); 39.83 + test_vi_off(a2, 123, 103); 39.84 + test_cp_off(a1, a2); 39.85 + test_2ci_off(a1, a2); 39.86 + test_2vi_off(a1, a2, 123, 103); 39.87 + test_ci_inv(a1, OFFSET, 123); 39.88 + test_vi_inv(a2, 123, OFFSET, 103); 39.89 + test_cp_inv(a1, a2, OFFSET); 39.90 + test_2ci_inv(a1, a2, OFFSET); 39.91 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 39.92 + test_ci_scl(a1, 123); 39.93 + test_vi_scl(a2, 123, 103); 39.94 + test_cp_scl(a1, a2); 39.95 + test_2ci_scl(a1, a2); 39.96 + test_2vi_scl(a1, a2, 123, 103); 39.97 + test_cp_alndst(a1, a2); 39.98 + test_cp_alnsrc(a1, a2); 39.99 + test_2ci_aln(a1, a2); 39.100 + test_2vi_aln(a1, a2, 123, 103); 39.101 + test_cp_unalndst(a1, a2); 39.102 + test_cp_unalnsrc(a1, a2); 39.103 + test_2ci_unaln(a1, a2); 39.104 + test_2vi_unaln(a1, a2, 123, 103); 39.105 + } 39.106 + // Initialize 39.107 + for (int i=0; i<ARRLEN; i++) { 39.108 + a1.set(i, -1); 39.109 + a2.set(i, -1); 39.110 + } 39.111 + // Test and verify results 39.112 + System.out.println("Verification"); 39.113 + int errn = 0; 39.114 + { 39.115 + test_ci(a1); 39.116 + for (int i=0; i<ARRLEN; i++) { 39.117 + errn += verify("test_ci: a1", i, a1.get(i), -123); 39.118 + } 39.119 + test_vi(a2, 123, -1); 39.120 + for (int i=0; i<ARRLEN; i++) { 39.121 + errn += verify("test_vi: a2", i, a2.get(i), 123); 39.122 + } 39.123 + test_cp(a1, a2); 39.124 + for (int i=0; i<ARRLEN; i++) { 39.125 + errn += verify("test_cp: a1", i, a1.get(i), 123); 39.126 + } 39.127 + test_2ci(a1, a2); 39.128 + for (int i=0; i<ARRLEN; i++) { 39.129 + errn += verify("test_2ci: a1", i, a1.get(i), -123); 39.130 + errn += verify("test_2ci: a2", i, a2.get(i), -103); 39.131 + } 39.132 + test_2vi(a1, a2, 123, 103); 39.133 + for (int i=0; i<ARRLEN; i++) { 39.134 + errn += verify("test_2vi: a1", i, a1.get(i), 123); 39.135 + errn += verify("test_2vi: a2", i, a2.get(i), 103); 39.136 + } 39.137 + // Reset for negative stride 39.138 + for (int i=0; i<ARRLEN; i++) { 39.139 + a1.set(i, -1); 39.140 + a2.set(i, -1); 39.141 + } 39.142 + test_ci_neg(a1, -1); 39.143 + for (int i=0; i<ARRLEN; i++) { 39.144 + errn += verify("test_ci_neg: a1", i, a1.get(i), -123); 39.145 + } 39.146 + test_vi_neg(a2, 123, -1); 39.147 + for (int i=0; i<ARRLEN; i++) { 39.148 + errn += verify("test_vi_neg: a2", i, a2.get(i), 123); 39.149 + } 39.150 + test_cp_neg(a1, a2); 39.151 + for (int i=0; i<ARRLEN; i++) { 39.152 + errn += verify("test_cp_neg: a1", i, a1.get(i), 123); 39.153 + } 39.154 + test_2ci_neg(a1, a2); 39.155 + for (int i=0; i<ARRLEN; i++) { 39.156 + errn += verify("test_2ci_neg: a1", i, a1.get(i), -123); 39.157 + errn += verify("test_2ci_neg: a2", i, a2.get(i), -103); 39.158 + } 39.159 + test_2vi_neg(a1, a2, 123, 103); 39.160 + for (int i=0; i<ARRLEN; i++) { 39.161 + errn += verify("test_2vi_neg: a1", i, a1.get(i), 123); 39.162 + errn += verify("test_2vi_neg: a2", i, a2.get(i), 103); 39.163 + } 39.164 + // Reset for opposite stride 39.165 + for (int i=0; i<ARRLEN; i++) { 39.166 + a1.set(i, -1); 39.167 + a2.set(i, -1); 39.168 + } 39.169 + test_ci_oppos(a1, -1); 39.170 + for (int i=0; i<ARRLEN; i++) { 39.171 + errn += verify("test_ci_oppos: a1", i, a1.get(i), -123); 39.172 + } 39.173 + test_vi_oppos(a2, 123, -1); 39.174 + for (int i=0; i<ARRLEN; i++) { 39.175 + errn += verify("test_vi_oppos: a2", i, a2.get(i), 123); 39.176 + } 39.177 + test_cp_oppos(a1, a2); 39.178 + for (int i=0; i<ARRLEN; i++) { 39.179 + errn += verify("test_cp_oppos: a1", i, a1.get(i), 123); 39.180 + } 39.181 + test_2ci_oppos(a1, a2); 39.182 + for (int i=0; i<ARRLEN; i++) { 39.183 + errn += verify("test_2ci_oppos: a1", i, a1.get(i), -123); 39.184 + errn += verify("test_2ci_oppos: a2", i, a2.get(i), -103); 39.185 + } 39.186 + test_2vi_oppos(a1, a2, 123, 103); 39.187 + for (int i=0; i<ARRLEN; i++) { 39.188 + errn += verify("test_2vi_oppos: a1", i, a1.get(i), 123); 39.189 + errn += verify("test_2vi_oppos: a2", i, a2.get(i), 103); 39.190 + } 39.191 + // Reset for indexing with offset 39.192 + for (int i=0; i<ARRLEN; i++) { 39.193 + a1.set(i, -1); 39.194 + a2.set(i, -1); 39.195 + } 39.196 + test_ci_off(a1, -1); 39.197 + for (int i=OFFSET; i<ARRLEN; i++) { 39.198 + errn += verify("test_ci_off: a1", i, a1.get(i), -123); 39.199 + } 39.200 + test_vi_off(a2, 123, -1); 39.201 + for (int i=OFFSET; i<ARRLEN; i++) { 39.202 + errn += verify("test_vi_off: a2", i, a2.get(i), 123); 39.203 + } 39.204 + test_cp_off(a1, a2); 39.205 + for (int i=OFFSET; i<ARRLEN; i++) { 39.206 + errn += verify("test_cp_off: a1", i, a1.get(i), 123); 39.207 + } 39.208 + test_2ci_off(a1, a2); 39.209 + for (int i=OFFSET; i<ARRLEN; i++) { 39.210 + errn += verify("test_2ci_off: a1", i, a1.get(i), -123); 39.211 + errn += verify("test_2ci_off: a2", i, a2.get(i), -103); 39.212 + } 39.213 + test_2vi_off(a1, a2, 123, 103); 39.214 + for (int i=OFFSET; i<ARRLEN; i++) { 39.215 + errn += verify("test_2vi_off: a1", i, a1.get(i), 123); 39.216 + errn += verify("test_2vi_off: a2", i, a2.get(i), 103); 39.217 + } 39.218 + for (int i=0; i<OFFSET; i++) { 39.219 + errn += verify("test_2vi_off: a1", i, a1.get(i), -1); 39.220 + errn += verify("test_2vi_off: a2", i, a2.get(i), -1); 39.221 + } 39.222 + // Reset for indexing with invariant offset 39.223 + for (int i=0; i<ARRLEN; i++) { 39.224 + a1.set(i, -1); 39.225 + a2.set(i, -1); 39.226 + } 39.227 + test_ci_inv(a1, OFFSET, -1); 39.228 + for (int i=OFFSET; i<ARRLEN; i++) { 39.229 + errn += verify("test_ci_inv: a1", i, a1.get(i), -123); 39.230 + } 39.231 + test_vi_inv(a2, 123, OFFSET, -1); 39.232 + for (int i=OFFSET; i<ARRLEN; i++) { 39.233 + errn += verify("test_vi_inv: a2", i, a2.get(i), 123); 39.234 + } 39.235 + test_cp_inv(a1, a2, OFFSET); 39.236 + for (int i=OFFSET; i<ARRLEN; i++) { 39.237 + errn += verify("test_cp_inv: a1", i, a1.get(i), 123); 39.238 + } 39.239 + test_2ci_inv(a1, a2, OFFSET); 39.240 + for (int i=OFFSET; i<ARRLEN; i++) { 39.241 + errn += verify("test_2ci_inv: a1", i, a1.get(i), -123); 39.242 + errn += verify("test_2ci_inv: a2", i, a2.get(i), -103); 39.243 + } 39.244 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 39.245 + for (int i=OFFSET; i<ARRLEN; i++) { 39.246 + errn += verify("test_2vi_inv: a1", i, a1.get(i), 123); 39.247 + errn += verify("test_2vi_inv: a2", i, a2.get(i), 103); 39.248 + } 39.249 + for (int i=0; i<OFFSET; i++) { 39.250 + errn += verify("test_2vi_inv: a1", i, a1.get(i), -1); 39.251 + errn += verify("test_2vi_inv: a2", i, a2.get(i), -1); 39.252 + } 39.253 + // Reset for indexing with scale 39.254 + for (int i=0; i<ARRLEN; i++) { 39.255 + a1.set(i, -1); 39.256 + a2.set(i, -1); 39.257 + } 39.258 + test_ci_scl(a1, -1); 39.259 + for (int i=0; i<ARRLEN; i++) { 39.260 + int val = (i%SCALE != 0) ? -1 : -123; 39.261 + errn += verify("test_ci_scl: a1", i, a1.get(i), val); 39.262 + } 39.263 + test_vi_scl(a2, 123, -1); 39.264 + for (int i=0; i<ARRLEN; i++) { 39.265 + int val = (i%SCALE != 0) ? -1 : 123; 39.266 + errn += verify("test_vi_scl: a2", i, a2.get(i), val); 39.267 + } 39.268 + test_cp_scl(a1, a2); 39.269 + for (int i=0; i<ARRLEN; i++) { 39.270 + int val = (i%SCALE != 0) ? -1 : 123; 39.271 + errn += verify("test_cp_scl: a1", i, a1.get(i), val); 39.272 + } 39.273 + test_2ci_scl(a1, a2); 39.274 + for (int i=0; i<ARRLEN; i++) { 39.275 + if (i%SCALE != 0) { 39.276 + errn += verify("test_2ci_scl: a1", i, a1.get(i), -1); 39.277 + } else if (i*SCALE < ARRLEN) { 39.278 + errn += verify("test_2ci_scl: a1", i*SCALE, a1.get(i*SCALE), -123); 39.279 + } 39.280 + if (i%SCALE != 0) { 39.281 + errn += verify("test_2ci_scl: a2", i, a2.get(i), -1); 39.282 + } else if (i*SCALE < ARRLEN) { 39.283 + errn += verify("test_2ci_scl: a2", i*SCALE, a2.get(i*SCALE), -103); 39.284 + } 39.285 + } 39.286 + test_2vi_scl(a1, a2, 123, 103); 39.287 + for (int i=0; i<ARRLEN; i++) { 39.288 + if (i%SCALE != 0) { 39.289 + errn += verify("test_2vi_scl: a1", i, a1.get(i), -1); 39.290 + } else if (i*SCALE < ARRLEN) { 39.291 + errn += verify("test_2vi_scl: a1", i*SCALE, a1.get(i*SCALE), 123); 39.292 + } 39.293 + if (i%SCALE != 0) { 39.294 + errn += verify("test_2vi_scl: a2", i, a2.get(i), -1); 39.295 + } else if (i*SCALE < ARRLEN) { 39.296 + errn += verify("test_2vi_scl: a2", i*SCALE, a2.get(i*SCALE), 103); 39.297 + } 39.298 + } 39.299 + // Reset for 2 arrays with relative aligned offset 39.300 + for (int i=0; i<ARRLEN; i++) { 39.301 + a1.set(i, -1); 39.302 + a2.set(i, -1); 39.303 + } 39.304 + test_vi(a2, 123, -1); 39.305 + test_cp_alndst(a1, a2); 39.306 + for (int i=0; i<ALIGN_OFF; i++) { 39.307 + errn += verify("test_cp_alndst: a1", i, a1.get(i), -1); 39.308 + } 39.309 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 39.310 + errn += verify("test_cp_alndst: a1", i, a1.get(i), 123); 39.311 + } 39.312 + for (int i=0; i<ALIGN_OFF; i++) { 39.313 + a1.set(i, 123); 39.314 + } 39.315 + test_vi(a2, -123, 123); 39.316 + test_cp_alnsrc(a1, a2); 39.317 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 39.318 + errn += verify("test_cp_alnsrc: a1", i, a1.get(i), -123); 39.319 + } 39.320 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 39.321 + errn += verify("test_cp_alnsrc: a1", i, a1.get(i), 123); 39.322 + } 39.323 + for (int i=0; i<ARRLEN; i++) { 39.324 + a1.set(i, -1); 39.325 + a2.set(i, -1); 39.326 + } 39.327 + test_2ci_aln(a1, a2); 39.328 + for (int i=0; i<ALIGN_OFF; i++) { 39.329 + errn += verify("test_2ci_aln: a1", i, a1.get(i), -1); 39.330 + } 39.331 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 39.332 + errn += verify("test_2ci_aln: a1", i, a1.get(i), -123); 39.333 + } 39.334 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 39.335 + errn += verify("test_2ci_aln: a2", i, a2.get(i), -103); 39.336 + } 39.337 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 39.338 + errn += verify("test_2ci_aln: a2", i, a2.get(i), -1); 39.339 + } 39.340 + for (int i=0; i<ARRLEN; i++) { 39.341 + a1.set(i, -1); 39.342 + a2.set(i, -1); 39.343 + } 39.344 + test_2vi_aln(a1, a2, 123, 103); 39.345 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 39.346 + errn += verify("test_2vi_aln: a1", i, a1.get(i), 123); 39.347 + } 39.348 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 39.349 + errn += verify("test_2vi_aln: a1", i, a1.get(i), -1); 39.350 + } 39.351 + for (int i=0; i<ALIGN_OFF; i++) { 39.352 + errn += verify("test_2vi_aln: a2", i, a2.get(i), -1); 39.353 + } 39.354 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 39.355 + errn += verify("test_2vi_aln: a2", i, a2.get(i), 103); 39.356 + } 39.357 + 39.358 + // Reset for 2 arrays with relative unaligned offset 39.359 + for (int i=0; i<ARRLEN; i++) { 39.360 + a1.set(i, -1); 39.361 + a2.set(i, -1); 39.362 + } 39.363 + test_vi(a2, 123, -1); 39.364 + test_cp_unalndst(a1, a2); 39.365 + for (int i=0; i<UNALIGN_OFF; i++) { 39.366 + errn += verify("test_cp_unalndst: a1", i, a1.get(i), -1); 39.367 + } 39.368 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 39.369 + errn += verify("test_cp_unalndst: a1", i, a1.get(i), 123); 39.370 + } 39.371 + test_vi(a2, -123, 123); 39.372 + test_cp_unalnsrc(a1, a2); 39.373 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 39.374 + errn += verify("test_cp_unalnsrc: a1", i, a1.get(i), -123); 39.375 + } 39.376 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 39.377 + errn += verify("test_cp_unalnsrc: a1", i, a1.get(i), 123); 39.378 + } 39.379 + for (int i=0; i<ARRLEN; i++) { 39.380 + a1.set(i, -1); 39.381 + a2.set(i, -1); 39.382 + } 39.383 + test_2ci_unaln(a1, a2); 39.384 + for (int i=0; i<UNALIGN_OFF; i++) { 39.385 + errn += verify("test_2ci_unaln: a1", i, a1.get(i), -1); 39.386 + } 39.387 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 39.388 + errn += verify("test_2ci_unaln: a1", i, a1.get(i), -123); 39.389 + } 39.390 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 39.391 + errn += verify("test_2ci_unaln: a2", i, a2.get(i), -103); 39.392 + } 39.393 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 39.394 + errn += verify("test_2ci_unaln: a2", i, a2.get(i), -1); 39.395 + } 39.396 + for (int i=0; i<ARRLEN; i++) { 39.397 + a1.set(i, -1); 39.398 + a2.set(i, -1); 39.399 + } 39.400 + test_2vi_unaln(a1, a2, 123, 103); 39.401 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 39.402 + errn += verify("test_2vi_unaln: a1", i, a1.get(i), 123); 39.403 + } 39.404 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 39.405 + errn += verify("test_2vi_unaln: a1", i, a1.get(i), -1); 39.406 + } 39.407 + for (int i=0; i<UNALIGN_OFF; i++) { 39.408 + errn += verify("test_2vi_unaln: a2", i, a2.get(i), -1); 39.409 + } 39.410 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 39.411 + errn += verify("test_2vi_unaln: a2", i, a2.get(i), 103); 39.412 + } 39.413 + 39.414 + // Reset for aligned overlap initialization 39.415 + for (int i=0; i<ALIGN_OFF; i++) { 39.416 + a1.set(i, i); 39.417 + } 39.418 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 39.419 + a1.set(i, -1); 39.420 + } 39.421 + test_cp_alndst(a1, a1); 39.422 + for (int i=0; i<ARRLEN; i++) { 39.423 + int v = i%ALIGN_OFF; 39.424 + errn += verify("test_cp_alndst_overlap: a1", i, a1.get(i), v); 39.425 + } 39.426 + for (int i=0; i<ALIGN_OFF; i++) { 39.427 + a1.set((i+ALIGN_OFF), -1); 39.428 + } 39.429 + test_cp_alnsrc(a1, a1); 39.430 + for (int i=0; i<ALIGN_OFF; i++) { 39.431 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1.get(i), -1); 39.432 + } 39.433 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 39.434 + int v = i%ALIGN_OFF; 39.435 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1.get(i), v); 39.436 + } 39.437 + for (int i=0; i<ARRLEN; i++) { 39.438 + a1.set(i, -1); 39.439 + } 39.440 + test_2ci_aln(a1, a1); 39.441 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 39.442 + errn += verify("test_2ci_aln_overlap: a1", i, a1.get(i), -103); 39.443 + } 39.444 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 39.445 + errn += verify("test_2ci_aln_overlap: a1", i, a1.get(i), -123); 39.446 + } 39.447 + for (int i=0; i<ARRLEN; i++) { 39.448 + a1.set(i, -1); 39.449 + } 39.450 + test_2vi_aln(a1, a1, 123, 103); 39.451 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 39.452 + errn += verify("test_2vi_aln_overlap: a1", i, a1.get(i), 123); 39.453 + } 39.454 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 39.455 + errn += verify("test_2vi_aln_overlap: a1", i, a1.get(i), 103); 39.456 + } 39.457 + 39.458 + // Reset for unaligned overlap initialization 39.459 + for (int i=0; i<UNALIGN_OFF; i++) { 39.460 + a1.set(i, i); 39.461 + } 39.462 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 39.463 + a1.set(i, -1); 39.464 + } 39.465 + test_cp_unalndst(a1, a1); 39.466 + for (int i=0; i<ARRLEN; i++) { 39.467 + int v = i%UNALIGN_OFF; 39.468 + errn += verify("test_cp_unalndst_overlap: a1", i, a1.get(i), v); 39.469 + } 39.470 + for (int i=0; i<UNALIGN_OFF; i++) { 39.471 + a1.set((i+UNALIGN_OFF), -1); 39.472 + } 39.473 + test_cp_unalnsrc(a1, a1); 39.474 + for (int i=0; i<UNALIGN_OFF; i++) { 39.475 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1.get(i), -1); 39.476 + } 39.477 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 39.478 + int v = i%UNALIGN_OFF; 39.479 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1.get(i), v); 39.480 + } 39.481 + for (int i=0; i<ARRLEN; i++) { 39.482 + a1.set(i, -1); 39.483 + } 39.484 + test_2ci_unaln(a1, a1); 39.485 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 39.486 + errn += verify("test_2ci_unaln_overlap: a1", i, a1.get(i), -103); 39.487 + } 39.488 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 39.489 + errn += verify("test_2ci_unaln_overlap: a1", i, a1.get(i), -123); 39.490 + } 39.491 + for (int i=0; i<ARRLEN; i++) { 39.492 + a1.set(i, -1); 39.493 + } 39.494 + test_2vi_unaln(a1, a1, 123, 103); 39.495 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 39.496 + errn += verify("test_2vi_unaln_overlap: a1", i, a1.get(i), 123); 39.497 + } 39.498 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 39.499 + errn += verify("test_2vi_unaln_overlap: a1", i, a1.get(i), 103); 39.500 + } 39.501 + 39.502 + } 39.503 + 39.504 + if (errn > 0 || test_only) 39.505 + return errn; 39.506 + 39.507 + // Initialize 39.508 + for (int i=0; i<ARRLEN; i++) { 39.509 + a1.set(i, -1); 39.510 + a2.set(i, -1); 39.511 + } 39.512 + System.out.println("Time"); 39.513 + long start, end; 39.514 + start = System.currentTimeMillis(); 39.515 + for (int i=0; i<ITERS; i++) { 39.516 + test_ci(a1); 39.517 + } 39.518 + end = System.currentTimeMillis(); 39.519 + System.out.println("test_ci: " + (end - start)); 39.520 + start = System.currentTimeMillis(); 39.521 + for (int i=0; i<ITERS; i++) { 39.522 + test_vi(a2, 123, -1); 39.523 + } 39.524 + end = System.currentTimeMillis(); 39.525 + System.out.println("test_vi: " + (end - start)); 39.526 + start = System.currentTimeMillis(); 39.527 + for (int i=0; i<ITERS; i++) { 39.528 + test_cp(a1, a2); 39.529 + } 39.530 + end = System.currentTimeMillis(); 39.531 + System.out.println("test_cp: " + (end - start)); 39.532 + start = System.currentTimeMillis(); 39.533 + for (int i=0; i<ITERS; i++) { 39.534 + test_2ci(a1, a2); 39.535 + } 39.536 + end = System.currentTimeMillis(); 39.537 + System.out.println("test_2ci: " + (end - start)); 39.538 + start = System.currentTimeMillis(); 39.539 + for (int i=0; i<ITERS; i++) { 39.540 + test_2vi(a1, a2, 123, 103); 39.541 + } 39.542 + end = System.currentTimeMillis(); 39.543 + System.out.println("test_2vi: " + (end - start)); 39.544 + 39.545 + start = System.currentTimeMillis(); 39.546 + for (int i=0; i<ITERS; i++) { 39.547 + test_ci_neg(a1, 123); 39.548 + } 39.549 + end = System.currentTimeMillis(); 39.550 + System.out.println("test_ci_neg: " + (end - start)); 39.551 + start = System.currentTimeMillis(); 39.552 + for (int i=0; i<ITERS; i++) { 39.553 + test_vi_neg(a2, 123, 103); 39.554 + } 39.555 + end = System.currentTimeMillis(); 39.556 + System.out.println("test_vi_neg: " + (end - start)); 39.557 + start = System.currentTimeMillis(); 39.558 + for (int i=0; i<ITERS; i++) { 39.559 + test_cp_neg(a1, a2); 39.560 + } 39.561 + end = System.currentTimeMillis(); 39.562 + System.out.println("test_cp_neg: " + (end - start)); 39.563 + start = System.currentTimeMillis(); 39.564 + for (int i=0; i<ITERS; i++) { 39.565 + test_2ci_neg(a1, a2); 39.566 + } 39.567 + end = System.currentTimeMillis(); 39.568 + System.out.println("test_2ci_neg: " + (end - start)); 39.569 + start = System.currentTimeMillis(); 39.570 + for (int i=0; i<ITERS; i++) { 39.571 + test_2vi_neg(a1, a2, 123, 103); 39.572 + } 39.573 + end = System.currentTimeMillis(); 39.574 + System.out.println("test_2vi_neg: " + (end - start)); 39.575 + 39.576 + start = System.currentTimeMillis(); 39.577 + for (int i=0; i<ITERS; i++) { 39.578 + test_ci_oppos(a1, 123); 39.579 + } 39.580 + end = System.currentTimeMillis(); 39.581 + System.out.println("test_ci_oppos: " + (end - start)); 39.582 + start = System.currentTimeMillis(); 39.583 + for (int i=0; i<ITERS; i++) { 39.584 + test_vi_oppos(a2, 123, 103); 39.585 + } 39.586 + end = System.currentTimeMillis(); 39.587 + System.out.println("test_vi_oppos: " + (end - start)); 39.588 + start = System.currentTimeMillis(); 39.589 + for (int i=0; i<ITERS; i++) { 39.590 + test_cp_oppos(a1, a2); 39.591 + } 39.592 + end = System.currentTimeMillis(); 39.593 + System.out.println("test_cp_oppos: " + (end - start)); 39.594 + start = System.currentTimeMillis(); 39.595 + for (int i=0; i<ITERS; i++) { 39.596 + test_2ci_oppos(a1, a2); 39.597 + } 39.598 + end = System.currentTimeMillis(); 39.599 + System.out.println("test_2ci_oppos: " + (end - start)); 39.600 + start = System.currentTimeMillis(); 39.601 + for (int i=0; i<ITERS; i++) { 39.602 + test_2vi_oppos(a1, a2, 123, 103); 39.603 + } 39.604 + end = System.currentTimeMillis(); 39.605 + System.out.println("test_2vi_oppos: " + (end - start)); 39.606 + 39.607 + start = System.currentTimeMillis(); 39.608 + for (int i=0; i<ITERS; i++) { 39.609 + test_ci_off(a1, 123); 39.610 + } 39.611 + end = System.currentTimeMillis(); 39.612 + System.out.println("test_ci_off: " + (end - start)); 39.613 + start = System.currentTimeMillis(); 39.614 + for (int i=0; i<ITERS; i++) { 39.615 + test_vi_off(a2, 123, 103); 39.616 + } 39.617 + end = System.currentTimeMillis(); 39.618 + System.out.println("test_vi_off: " + (end - start)); 39.619 + start = System.currentTimeMillis(); 39.620 + for (int i=0; i<ITERS; i++) { 39.621 + test_cp_off(a1, a2); 39.622 + } 39.623 + end = System.currentTimeMillis(); 39.624 + System.out.println("test_cp_off: " + (end - start)); 39.625 + start = System.currentTimeMillis(); 39.626 + for (int i=0; i<ITERS; i++) { 39.627 + test_2ci_off(a1, a2); 39.628 + } 39.629 + end = System.currentTimeMillis(); 39.630 + System.out.println("test_2ci_off: " + (end - start)); 39.631 + start = System.currentTimeMillis(); 39.632 + for (int i=0; i<ITERS; i++) { 39.633 + test_2vi_off(a1, a2, 123, 103); 39.634 + } 39.635 + end = System.currentTimeMillis(); 39.636 + System.out.println("test_2vi_off: " + (end - start)); 39.637 + 39.638 + start = System.currentTimeMillis(); 39.639 + for (int i=0; i<ITERS; i++) { 39.640 + test_ci_inv(a1, OFFSET, 123); 39.641 + } 39.642 + end = System.currentTimeMillis(); 39.643 + System.out.println("test_ci_inv: " + (end - start)); 39.644 + start = System.currentTimeMillis(); 39.645 + for (int i=0; i<ITERS; i++) { 39.646 + test_vi_inv(a2, 123, OFFSET, 103); 39.647 + } 39.648 + end = System.currentTimeMillis(); 39.649 + System.out.println("test_vi_inv: " + (end - start)); 39.650 + start = System.currentTimeMillis(); 39.651 + for (int i=0; i<ITERS; i++) { 39.652 + test_cp_inv(a1, a2, OFFSET); 39.653 + } 39.654 + end = System.currentTimeMillis(); 39.655 + System.out.println("test_cp_inv: " + (end - start)); 39.656 + start = System.currentTimeMillis(); 39.657 + for (int i=0; i<ITERS; i++) { 39.658 + test_2ci_inv(a1, a2, OFFSET); 39.659 + } 39.660 + end = System.currentTimeMillis(); 39.661 + System.out.println("test_2ci_inv: " + (end - start)); 39.662 + start = System.currentTimeMillis(); 39.663 + for (int i=0; i<ITERS; i++) { 39.664 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 39.665 + } 39.666 + end = System.currentTimeMillis(); 39.667 + System.out.println("test_2vi_inv: " + (end - start)); 39.668 + 39.669 + start = System.currentTimeMillis(); 39.670 + for (int i=0; i<ITERS; i++) { 39.671 + test_ci_scl(a1, 123); 39.672 + } 39.673 + end = System.currentTimeMillis(); 39.674 + System.out.println("test_ci_scl: " + (end - start)); 39.675 + start = System.currentTimeMillis(); 39.676 + for (int i=0; i<ITERS; i++) { 39.677 + test_vi_scl(a2, 123, 103); 39.678 + } 39.679 + end = System.currentTimeMillis(); 39.680 + System.out.println("test_vi_scl: " + (end - start)); 39.681 + start = System.currentTimeMillis(); 39.682 + for (int i=0; i<ITERS; i++) { 39.683 + test_cp_scl(a1, a2); 39.684 + } 39.685 + end = System.currentTimeMillis(); 39.686 + System.out.println("test_cp_scl: " + (end - start)); 39.687 + start = System.currentTimeMillis(); 39.688 + for (int i=0; i<ITERS; i++) { 39.689 + test_2ci_scl(a1, a2); 39.690 + } 39.691 + end = System.currentTimeMillis(); 39.692 + System.out.println("test_2ci_scl: " + (end - start)); 39.693 + start = System.currentTimeMillis(); 39.694 + for (int i=0; i<ITERS; i++) { 39.695 + test_2vi_scl(a1, a2, 123, 103); 39.696 + } 39.697 + end = System.currentTimeMillis(); 39.698 + System.out.println("test_2vi_scl: " + (end - start)); 39.699 + 39.700 + start = System.currentTimeMillis(); 39.701 + for (int i=0; i<ITERS; i++) { 39.702 + test_cp_alndst(a1, a2); 39.703 + } 39.704 + end = System.currentTimeMillis(); 39.705 + System.out.println("test_cp_alndst: " + (end - start)); 39.706 + start = System.currentTimeMillis(); 39.707 + for (int i=0; i<ITERS; i++) { 39.708 + test_cp_alnsrc(a1, a2); 39.709 + } 39.710 + end = System.currentTimeMillis(); 39.711 + System.out.println("test_cp_alnsrc: " + (end - start)); 39.712 + start = System.currentTimeMillis(); 39.713 + for (int i=0; i<ITERS; i++) { 39.714 + test_2ci_aln(a1, a2); 39.715 + } 39.716 + end = System.currentTimeMillis(); 39.717 + System.out.println("test_2ci_aln: " + (end - start)); 39.718 + start = System.currentTimeMillis(); 39.719 + for (int i=0; i<ITERS; i++) { 39.720 + test_2vi_aln(a1, a2, 123, 103); 39.721 + } 39.722 + end = System.currentTimeMillis(); 39.723 + System.out.println("test_2vi_aln: " + (end - start)); 39.724 + 39.725 + start = System.currentTimeMillis(); 39.726 + for (int i=0; i<ITERS; i++) { 39.727 + test_cp_unalndst(a1, a2); 39.728 + } 39.729 + end = System.currentTimeMillis(); 39.730 + System.out.println("test_cp_unalndst: " + (end - start)); 39.731 + start = System.currentTimeMillis(); 39.732 + for (int i=0; i<ITERS; i++) { 39.733 + test_cp_unalnsrc(a1, a2); 39.734 + } 39.735 + end = System.currentTimeMillis(); 39.736 + System.out.println("test_cp_unalnsrc: " + (end - start)); 39.737 + start = System.currentTimeMillis(); 39.738 + for (int i=0; i<ITERS; i++) { 39.739 + test_2ci_unaln(a1, a2); 39.740 + } 39.741 + end = System.currentTimeMillis(); 39.742 + System.out.println("test_2ci_unaln: " + (end - start)); 39.743 + start = System.currentTimeMillis(); 39.744 + for (int i=0; i<ITERS; i++) { 39.745 + test_2vi_unaln(a1, a2, 123, 103); 39.746 + } 39.747 + end = System.currentTimeMillis(); 39.748 + System.out.println("test_2vi_unaln: " + (end - start)); 39.749 + 39.750 + return errn; 39.751 + } 39.752 + 39.753 + static void test_ci(AtomicIntegerArray a) { 39.754 + for (int i = 0; i < ARRLEN; i+=1) { 39.755 + a.compareAndSet(i, -1, -123); 39.756 + } 39.757 + } 39.758 + static void test_vi(AtomicIntegerArray a, int b, int old) { 39.759 + for (int i = 0; i < ARRLEN; i+=1) { 39.760 + a.compareAndSet(i, old, b); 39.761 + } 39.762 + } 39.763 + static void test_cp(AtomicIntegerArray a, AtomicIntegerArray b) { 39.764 + for (int i = 0; i < ARRLEN; i+=1) { 39.765 + a.compareAndSet(i, -123, b.get(i)); 39.766 + } 39.767 + } 39.768 + static void test_2ci(AtomicIntegerArray a, AtomicIntegerArray b) { 39.769 + for (int i = 0; i < ARRLEN; i+=1) { 39.770 + a.compareAndSet(i, 123, -123); 39.771 + b.compareAndSet(i, 123, -103); 39.772 + } 39.773 + } 39.774 + static void test_2vi(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 39.775 + for (int i = 0; i < ARRLEN; i+=1) { 39.776 + a.compareAndSet(i, -123, c); 39.777 + b.compareAndSet(i, -103, d); 39.778 + } 39.779 + } 39.780 + static void test_ci_neg(AtomicIntegerArray a, int old) { 39.781 + for (int i = ARRLEN-1; i >= 0; i-=1) { 39.782 + a.compareAndSet(i, old, -123); 39.783 + } 39.784 + } 39.785 + static void test_vi_neg(AtomicIntegerArray a, int b, int old) { 39.786 + for (int i = ARRLEN-1; i >= 0; i-=1) { 39.787 + a.compareAndSet(i, old, b); 39.788 + } 39.789 + } 39.790 + static void test_cp_neg(AtomicIntegerArray a, AtomicIntegerArray b) { 39.791 + for (int i = ARRLEN-1; i >= 0; i-=1) { 39.792 + a.compareAndSet(i, -123, b.get(i)); 39.793 + } 39.794 + } 39.795 + static void test_2ci_neg(AtomicIntegerArray a, AtomicIntegerArray b) { 39.796 + for (int i = ARRLEN-1; i >= 0; i-=1) { 39.797 + a.compareAndSet(i, 123, -123); 39.798 + b.compareAndSet(i, 123, -103); 39.799 + } 39.800 + } 39.801 + static void test_2vi_neg(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 39.802 + for (int i = ARRLEN-1; i >= 0; i-=1) { 39.803 + a.compareAndSet(i, -123, c); 39.804 + b.compareAndSet(i, -103, d); 39.805 + } 39.806 + } 39.807 + static void test_ci_oppos(AtomicIntegerArray a, int old) { 39.808 + int limit = ARRLEN-1; 39.809 + for (int i = 0; i < ARRLEN; i+=1) { 39.810 + a.compareAndSet((limit-i), old, -123); 39.811 + } 39.812 + } 39.813 + static void test_vi_oppos(AtomicIntegerArray a, int b, int old) { 39.814 + int limit = ARRLEN-1; 39.815 + for (int i = limit; i >= 0; i-=1) { 39.816 + a.compareAndSet((limit-i), old, b); 39.817 + } 39.818 + } 39.819 + static void test_cp_oppos(AtomicIntegerArray a, AtomicIntegerArray b) { 39.820 + int limit = ARRLEN-1; 39.821 + for (int i = 0; i < ARRLEN; i+=1) { 39.822 + a.compareAndSet(i, -123, b.get(limit-i)); 39.823 + } 39.824 + } 39.825 + static void test_2ci_oppos(AtomicIntegerArray a, AtomicIntegerArray b) { 39.826 + int limit = ARRLEN-1; 39.827 + for (int i = 0; i < ARRLEN; i+=1) { 39.828 + a.compareAndSet((limit-i), 123, -123); 39.829 + b.compareAndSet(i, 123, -103); 39.830 + } 39.831 + } 39.832 + static void test_2vi_oppos(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 39.833 + int limit = ARRLEN-1; 39.834 + for (int i = limit; i >= 0; i-=1) { 39.835 + a.compareAndSet(i, -123, c); 39.836 + b.compareAndSet((limit-i), -103, d); 39.837 + } 39.838 + } 39.839 + static void test_ci_off(AtomicIntegerArray a, int old) { 39.840 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 39.841 + a.compareAndSet((i+OFFSET), old, -123); 39.842 + } 39.843 + } 39.844 + static void test_vi_off(AtomicIntegerArray a, int b, int old) { 39.845 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 39.846 + a.compareAndSet((i+OFFSET), old, b); 39.847 + } 39.848 + } 39.849 + static void test_cp_off(AtomicIntegerArray a, AtomicIntegerArray b) { 39.850 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 39.851 + a.compareAndSet((i+OFFSET), -123, b.get(i+OFFSET)); 39.852 + } 39.853 + } 39.854 + static void test_2ci_off(AtomicIntegerArray a, AtomicIntegerArray b) { 39.855 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 39.856 + a.compareAndSet((i+OFFSET), 123, -123); 39.857 + b.compareAndSet((i+OFFSET), 123, -103); 39.858 + } 39.859 + } 39.860 + static void test_2vi_off(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 39.861 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 39.862 + a.compareAndSet((i+OFFSET), -123, c); 39.863 + b.compareAndSet((i+OFFSET), -103, d); 39.864 + } 39.865 + } 39.866 + static void test_ci_inv(AtomicIntegerArray a, int k, int old) { 39.867 + for (int i = 0; i < ARRLEN-k; i+=1) { 39.868 + a.compareAndSet((i+k), old, -123); 39.869 + } 39.870 + } 39.871 + static void test_vi_inv(AtomicIntegerArray a, int b, int k, int old) { 39.872 + for (int i = 0; i < ARRLEN-k; i+=1) { 39.873 + a.compareAndSet((i+k), old, b); 39.874 + } 39.875 + } 39.876 + static void test_cp_inv(AtomicIntegerArray a, AtomicIntegerArray b, int k) { 39.877 + for (int i = 0; i < ARRLEN-k; i+=1) { 39.878 + a.compareAndSet((i+k), -123, b.get(i+k)); 39.879 + } 39.880 + } 39.881 + static void test_2ci_inv(AtomicIntegerArray a, AtomicIntegerArray b, int k) { 39.882 + for (int i = 0; i < ARRLEN-k; i+=1) { 39.883 + a.compareAndSet((i+k), 123, -123); 39.884 + b.compareAndSet((i+k), 123, -103); 39.885 + } 39.886 + } 39.887 + static void test_2vi_inv(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d, int k) { 39.888 + for (int i = 0; i < ARRLEN-k; i+=1) { 39.889 + a.compareAndSet((i+k), -123, c); 39.890 + b.compareAndSet((i+k), -103, d); 39.891 + } 39.892 + } 39.893 + static void test_ci_scl(AtomicIntegerArray a, int old) { 39.894 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 39.895 + a.compareAndSet((i*SCALE), old, -123); 39.896 + } 39.897 + } 39.898 + static void test_vi_scl(AtomicIntegerArray a, int b, int old) { 39.899 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 39.900 + a.compareAndSet((i*SCALE), old, b); 39.901 + } 39.902 + } 39.903 + static void test_cp_scl(AtomicIntegerArray a, AtomicIntegerArray b) { 39.904 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 39.905 + a.compareAndSet((i*SCALE), -123, b.get(i*SCALE)); 39.906 + } 39.907 + } 39.908 + static void test_2ci_scl(AtomicIntegerArray a, AtomicIntegerArray b) { 39.909 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 39.910 + a.compareAndSet((i*SCALE), 123, -123); 39.911 + b.compareAndSet((i*SCALE), 123, -103); 39.912 + } 39.913 + } 39.914 + static void test_2vi_scl(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 39.915 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 39.916 + a.compareAndSet((i*SCALE), -123, c); 39.917 + b.compareAndSet((i*SCALE), -103, d); 39.918 + } 39.919 + } 39.920 + static void test_cp_alndst(AtomicIntegerArray a, AtomicIntegerArray b) { 39.921 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 39.922 + a.compareAndSet((i+ALIGN_OFF), -1, b.get(i)); 39.923 + } 39.924 + } 39.925 + static void test_cp_alnsrc(AtomicIntegerArray a, AtomicIntegerArray b) { 39.926 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 39.927 + a.getAndSet(i, b.get(i+ALIGN_OFF)); 39.928 + } 39.929 + } 39.930 + static void test_2ci_aln(AtomicIntegerArray a, AtomicIntegerArray b) { 39.931 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 39.932 + a.compareAndSet((i+ALIGN_OFF), -1, -123); 39.933 + b.getAndSet(i, -103); 39.934 + } 39.935 + } 39.936 + static void test_2vi_aln(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 39.937 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 39.938 + a.getAndSet(i, c); 39.939 + b.getAndSet((i+ALIGN_OFF), d); 39.940 + } 39.941 + } 39.942 + static void test_cp_unalndst(AtomicIntegerArray a, AtomicIntegerArray b) { 39.943 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 39.944 + a.compareAndSet((i+UNALIGN_OFF), -1, b.get(i)); 39.945 + } 39.946 + } 39.947 + static void test_cp_unalnsrc(AtomicIntegerArray a, AtomicIntegerArray b) { 39.948 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 39.949 + a.getAndSet(i, b.get(i+UNALIGN_OFF)); 39.950 + } 39.951 + } 39.952 + static void test_2ci_unaln(AtomicIntegerArray a, AtomicIntegerArray b) { 39.953 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 39.954 + a.compareAndSet((i+UNALIGN_OFF), -1, -123); 39.955 + b.getAndSet(i, -103); 39.956 + } 39.957 + } 39.958 + static void test_2vi_unaln(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 39.959 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 39.960 + a.getAndSet(i, c); 39.961 + b.getAndSet((i+UNALIGN_OFF), d); 39.962 + } 39.963 + } 39.964 + 39.965 + static int verify(String text, int i, int elem, int val) { 39.966 + if (elem != val) { 39.967 + System.err.println(text + "[" + i + "] = " + elem + " != " + val); 39.968 + return 1; 39.969 + } 39.970 + return 0; 39.971 + } 39.972 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 40.2 +++ b/test/compiler/8004867/TestIntAtomicOrdered.java Tue Feb 26 11:52:06 2013 +0100 40.3 @@ -0,0 +1,969 @@ 40.4 +/* 40.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 40.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 40.7 + * 40.8 + * This code is free software; you can redistribute it and/or modify it 40.9 + * under the terms of the GNU General Public License version 2 only, as 40.10 + * published by the Free Software Foundation. 40.11 + * 40.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 40.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 40.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 40.15 + * version 2 for more details (a copy is included in the LICENSE file that 40.16 + * accompanied this code). 40.17 + * 40.18 + * You should have received a copy of the GNU General Public License version 40.19 + * 2 along with this work; if not, write to the Free Software Foundation, 40.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 40.21 + * 40.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 40.23 + * or visit www.oracle.com if you need additional information or have any 40.24 + * questions. 40.25 + * 40.26 + */ 40.27 + 40.28 +/** 40.29 + * @test 40.30 + * @bug 8004867 40.31 + * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" 40.32 + * 40.33 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicOrdered 40.34 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicOrdered 40.35 + */ 40.36 + 40.37 +import java.util.concurrent.atomic.AtomicIntegerArray; 40.38 + 40.39 +public class TestIntAtomicOrdered { 40.40 + private static final int ARRLEN = 97; 40.41 + private static final int ITERS = 11000; 40.42 + private static final int OFFSET = 3; 40.43 + private static final int SCALE = 2; 40.44 + private static final int ALIGN_OFF = 8; 40.45 + private static final int UNALIGN_OFF = 5; 40.46 + 40.47 + public static void main(String args[]) { 40.48 + System.out.println("Testing Integer array atomic ordered operations"); 40.49 + int errn = test(false); 40.50 + if (errn > 0) { 40.51 + System.err.println("FAILED: " + errn + " errors"); 40.52 + System.exit(97); 40.53 + } 40.54 + System.out.println("PASSED"); 40.55 + } 40.56 + 40.57 + static int test(boolean test_only) { 40.58 + AtomicIntegerArray a1 = new AtomicIntegerArray(ARRLEN); 40.59 + AtomicIntegerArray a2 = new AtomicIntegerArray(ARRLEN); 40.60 + // Initialize 40.61 + for (int i=0; i<ARRLEN; i++) { 40.62 + a1.lazySet(i, -1); 40.63 + a2.lazySet(i, -1); 40.64 + } 40.65 + System.out.println("Warmup"); 40.66 + for (int i=0; i<ITERS; i++) { 40.67 + test_ci(a1); 40.68 + test_vi(a2, 123, -1); 40.69 + test_cp(a1, a2); 40.70 + test_2ci(a1, a2); 40.71 + test_2vi(a1, a2, 123, 103); 40.72 + test_ci_neg(a1, 123); 40.73 + test_vi_neg(a2, 123, 103); 40.74 + test_cp_neg(a1, a2); 40.75 + test_2ci_neg(a1, a2); 40.76 + test_2vi_neg(a1, a2, 123, 103); 40.77 + test_ci_oppos(a1, 123); 40.78 + test_vi_oppos(a2, 123, 103); 40.79 + test_cp_oppos(a1, a2); 40.80 + test_2ci_oppos(a1, a2); 40.81 + test_2vi_oppos(a1, a2, 123, 103); 40.82 + test_ci_off(a1, 123); 40.83 + test_vi_off(a2, 123, 103); 40.84 + test_cp_off(a1, a2); 40.85 + test_2ci_off(a1, a2); 40.86 + test_2vi_off(a1, a2, 123, 103); 40.87 + test_ci_inv(a1, OFFSET, 123); 40.88 + test_vi_inv(a2, 123, OFFSET, 103); 40.89 + test_cp_inv(a1, a2, OFFSET); 40.90 + test_2ci_inv(a1, a2, OFFSET); 40.91 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 40.92 + test_ci_scl(a1, 123); 40.93 + test_vi_scl(a2, 123, 103); 40.94 + test_cp_scl(a1, a2); 40.95 + test_2ci_scl(a1, a2); 40.96 + test_2vi_scl(a1, a2, 123, 103); 40.97 + test_cp_alndst(a1, a2); 40.98 + test_cp_alnsrc(a1, a2); 40.99 + test_2ci_aln(a1, a2); 40.100 + test_2vi_aln(a1, a2, 123, 103); 40.101 + test_cp_unalndst(a1, a2); 40.102 + test_cp_unalnsrc(a1, a2); 40.103 + test_2ci_unaln(a1, a2); 40.104 + test_2vi_unaln(a1, a2, 123, 103); 40.105 + } 40.106 + // Initialize 40.107 + for (int i=0; i<ARRLEN; i++) { 40.108 + a1.lazySet(i, -1); 40.109 + a2.lazySet(i, -1); 40.110 + } 40.111 + // Test and verify results 40.112 + System.out.println("Verification"); 40.113 + int errn = 0; 40.114 + { 40.115 + test_ci(a1); 40.116 + for (int i=0; i<ARRLEN; i++) { 40.117 + errn += verify("test_ci: a1", i, a1.get(i), -123); 40.118 + } 40.119 + test_vi(a2, 123, -1); 40.120 + for (int i=0; i<ARRLEN; i++) { 40.121 + errn += verify("test_vi: a2", i, a2.get(i), 123); 40.122 + } 40.123 + test_cp(a1, a2); 40.124 + for (int i=0; i<ARRLEN; i++) { 40.125 + errn += verify("test_cp: a1", i, a1.get(i), 123); 40.126 + } 40.127 + test_2ci(a1, a2); 40.128 + for (int i=0; i<ARRLEN; i++) { 40.129 + errn += verify("test_2ci: a1", i, a1.get(i), -123); 40.130 + errn += verify("test_2ci: a2", i, a2.get(i), -103); 40.131 + } 40.132 + test_2vi(a1, a2, 123, 103); 40.133 + for (int i=0; i<ARRLEN; i++) { 40.134 + errn += verify("test_2vi: a1", i, a1.get(i), 123); 40.135 + errn += verify("test_2vi: a2", i, a2.get(i), 103); 40.136 + } 40.137 + // Reset for negative stride 40.138 + for (int i=0; i<ARRLEN; i++) { 40.139 + a1.lazySet(i, -1); 40.140 + a2.lazySet(i, -1); 40.141 + } 40.142 + test_ci_neg(a1, -1); 40.143 + for (int i=0; i<ARRLEN; i++) { 40.144 + errn += verify("test_ci_neg: a1", i, a1.get(i), -123); 40.145 + } 40.146 + test_vi_neg(a2, 123, -1); 40.147 + for (int i=0; i<ARRLEN; i++) { 40.148 + errn += verify("test_vi_neg: a2", i, a2.get(i), 123); 40.149 + } 40.150 + test_cp_neg(a1, a2); 40.151 + for (int i=0; i<ARRLEN; i++) { 40.152 + errn += verify("test_cp_neg: a1", i, a1.get(i), 123); 40.153 + } 40.154 + test_2ci_neg(a1, a2); 40.155 + for (int i=0; i<ARRLEN; i++) { 40.156 + errn += verify("test_2ci_neg: a1", i, a1.get(i), -123); 40.157 + errn += verify("test_2ci_neg: a2", i, a2.get(i), -103); 40.158 + } 40.159 + test_2vi_neg(a1, a2, 123, 103); 40.160 + for (int i=0; i<ARRLEN; i++) { 40.161 + errn += verify("test_2vi_neg: a1", i, a1.get(i), 123); 40.162 + errn += verify("test_2vi_neg: a2", i, a2.get(i), 103); 40.163 + } 40.164 + // Reset for opposite stride 40.165 + for (int i=0; i<ARRLEN; i++) { 40.166 + a1.lazySet(i, -1); 40.167 + a2.lazySet(i, -1); 40.168 + } 40.169 + test_ci_oppos(a1, -1); 40.170 + for (int i=0; i<ARRLEN; i++) { 40.171 + errn += verify("test_ci_oppos: a1", i, a1.get(i), -123); 40.172 + } 40.173 + test_vi_oppos(a2, 123, -1); 40.174 + for (int i=0; i<ARRLEN; i++) { 40.175 + errn += verify("test_vi_oppos: a2", i, a2.get(i), 123); 40.176 + } 40.177 + test_cp_oppos(a1, a2); 40.178 + for (int i=0; i<ARRLEN; i++) { 40.179 + errn += verify("test_cp_oppos: a1", i, a1.get(i), 123); 40.180 + } 40.181 + test_2ci_oppos(a1, a2); 40.182 + for (int i=0; i<ARRLEN; i++) { 40.183 + errn += verify("test_2ci_oppos: a1", i, a1.get(i), -123); 40.184 + errn += verify("test_2ci_oppos: a2", i, a2.get(i), -103); 40.185 + } 40.186 + test_2vi_oppos(a1, a2, 123, 103); 40.187 + for (int i=0; i<ARRLEN; i++) { 40.188 + errn += verify("test_2vi_oppos: a1", i, a1.get(i), 123); 40.189 + errn += verify("test_2vi_oppos: a2", i, a2.get(i), 103); 40.190 + } 40.191 + // Reset for indexing with offset 40.192 + for (int i=0; i<ARRLEN; i++) { 40.193 + a1.lazySet(i, -1); 40.194 + a2.lazySet(i, -1); 40.195 + } 40.196 + test_ci_off(a1, -1); 40.197 + for (int i=OFFSET; i<ARRLEN; i++) { 40.198 + errn += verify("test_ci_off: a1", i, a1.get(i), -123); 40.199 + } 40.200 + test_vi_off(a2, 123, -1); 40.201 + for (int i=OFFSET; i<ARRLEN; i++) { 40.202 + errn += verify("test_vi_off: a2", i, a2.get(i), 123); 40.203 + } 40.204 + test_cp_off(a1, a2); 40.205 + for (int i=OFFSET; i<ARRLEN; i++) { 40.206 + errn += verify("test_cp_off: a1", i, a1.get(i), 123); 40.207 + } 40.208 + test_2ci_off(a1, a2); 40.209 + for (int i=OFFSET; i<ARRLEN; i++) { 40.210 + errn += verify("test_2ci_off: a1", i, a1.get(i), -123); 40.211 + errn += verify("test_2ci_off: a2", i, a2.get(i), -103); 40.212 + } 40.213 + test_2vi_off(a1, a2, 123, 103); 40.214 + for (int i=OFFSET; i<ARRLEN; i++) { 40.215 + errn += verify("test_2vi_off: a1", i, a1.get(i), 123); 40.216 + errn += verify("test_2vi_off: a2", i, a2.get(i), 103); 40.217 + } 40.218 + for (int i=0; i<OFFSET; i++) { 40.219 + errn += verify("test_2vi_off: a1", i, a1.get(i), -1); 40.220 + errn += verify("test_2vi_off: a2", i, a2.get(i), -1); 40.221 + } 40.222 + // Reset for indexing with invariant offset 40.223 + for (int i=0; i<ARRLEN; i++) { 40.224 + a1.lazySet(i, -1); 40.225 + a2.lazySet(i, -1); 40.226 + } 40.227 + test_ci_inv(a1, OFFSET, -1); 40.228 + for (int i=OFFSET; i<ARRLEN; i++) { 40.229 + errn += verify("test_ci_inv: a1", i, a1.get(i), -123); 40.230 + } 40.231 + test_vi_inv(a2, 123, OFFSET, -1); 40.232 + for (int i=OFFSET; i<ARRLEN; i++) { 40.233 + errn += verify("test_vi_inv: a2", i, a2.get(i), 123); 40.234 + } 40.235 + test_cp_inv(a1, a2, OFFSET); 40.236 + for (int i=OFFSET; i<ARRLEN; i++) { 40.237 + errn += verify("test_cp_inv: a1", i, a1.get(i), 123); 40.238 + } 40.239 + test_2ci_inv(a1, a2, OFFSET); 40.240 + for (int i=OFFSET; i<ARRLEN; i++) { 40.241 + errn += verify("test_2ci_inv: a1", i, a1.get(i), -123); 40.242 + errn += verify("test_2ci_inv: a2", i, a2.get(i), -103); 40.243 + } 40.244 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 40.245 + for (int i=OFFSET; i<ARRLEN; i++) { 40.246 + errn += verify("test_2vi_inv: a1", i, a1.get(i), 123); 40.247 + errn += verify("test_2vi_inv: a2", i, a2.get(i), 103); 40.248 + } 40.249 + for (int i=0; i<OFFSET; i++) { 40.250 + errn += verify("test_2vi_inv: a1", i, a1.get(i), -1); 40.251 + errn += verify("test_2vi_inv: a2", i, a2.get(i), -1); 40.252 + } 40.253 + // Reset for indexing with scale 40.254 + for (int i=0; i<ARRLEN; i++) { 40.255 + a1.lazySet(i, -1); 40.256 + a2.lazySet(i, -1); 40.257 + } 40.258 + test_ci_scl(a1, -1); 40.259 + for (int i=0; i<ARRLEN; i++) { 40.260 + int val = (i%SCALE != 0) ? -1 : -123; 40.261 + errn += verify("test_ci_scl: a1", i, a1.get(i), val); 40.262 + } 40.263 + test_vi_scl(a2, 123, -1); 40.264 + for (int i=0; i<ARRLEN; i++) { 40.265 + int val = (i%SCALE != 0) ? -1 : 123; 40.266 + errn += verify("test_vi_scl: a2", i, a2.get(i), val); 40.267 + } 40.268 + test_cp_scl(a1, a2); 40.269 + for (int i=0; i<ARRLEN; i++) { 40.270 + int val = (i%SCALE != 0) ? -1 : 123; 40.271 + errn += verify("test_cp_scl: a1", i, a1.get(i), val); 40.272 + } 40.273 + test_2ci_scl(a1, a2); 40.274 + for (int i=0; i<ARRLEN; i++) { 40.275 + if (i%SCALE != 0) { 40.276 + errn += verify("test_2ci_scl: a1", i, a1.get(i), -1); 40.277 + } else if (i*SCALE < ARRLEN) { 40.278 + errn += verify("test_2ci_scl: a1", i*SCALE, a1.get(i*SCALE), -123); 40.279 + } 40.280 + if (i%SCALE != 0) { 40.281 + errn += verify("test_2ci_scl: a2", i, a2.get(i), -1); 40.282 + } else if (i*SCALE < ARRLEN) { 40.283 + errn += verify("test_2ci_scl: a2", i*SCALE, a2.get(i*SCALE), -103); 40.284 + } 40.285 + } 40.286 + test_2vi_scl(a1, a2, 123, 103); 40.287 + for (int i=0; i<ARRLEN; i++) { 40.288 + if (i%SCALE != 0) { 40.289 + errn += verify("test_2vi_scl: a1", i, a1.get(i), -1); 40.290 + } else if (i*SCALE < ARRLEN) { 40.291 + errn += verify("test_2vi_scl: a1", i*SCALE, a1.get(i*SCALE), 123); 40.292 + } 40.293 + if (i%SCALE != 0) { 40.294 + errn += verify("test_2vi_scl: a2", i, a2.get(i), -1); 40.295 + } else if (i*SCALE < ARRLEN) { 40.296 + errn += verify("test_2vi_scl: a2", i*SCALE, a2.get(i*SCALE), 103); 40.297 + } 40.298 + } 40.299 + // Reset for 2 arrays with relative aligned offset 40.300 + for (int i=0; i<ARRLEN; i++) { 40.301 + a1.lazySet(i, -1); 40.302 + a2.lazySet(i, -1); 40.303 + } 40.304 + test_vi(a2, 123, -1); 40.305 + test_cp_alndst(a1, a2); 40.306 + for (int i=0; i<ALIGN_OFF; i++) { 40.307 + errn += verify("test_cp_alndst: a1", i, a1.get(i), -1); 40.308 + } 40.309 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 40.310 + errn += verify("test_cp_alndst: a1", i, a1.get(i), 123); 40.311 + } 40.312 + for (int i=0; i<ALIGN_OFF; i++) { 40.313 + a1.lazySet(i, 123); 40.314 + } 40.315 + test_vi(a2, -123, 123); 40.316 + test_cp_alnsrc(a1, a2); 40.317 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 40.318 + errn += verify("test_cp_alnsrc: a1", i, a1.get(i), -123); 40.319 + } 40.320 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 40.321 + errn += verify("test_cp_alnsrc: a1", i, a1.get(i), 123); 40.322 + } 40.323 + for (int i=0; i<ARRLEN; i++) { 40.324 + a1.lazySet(i, -1); 40.325 + a2.lazySet(i, -1); 40.326 + } 40.327 + test_2ci_aln(a1, a2); 40.328 + for (int i=0; i<ALIGN_OFF; i++) { 40.329 + errn += verify("test_2ci_aln: a1", i, a1.get(i), -1); 40.330 + } 40.331 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 40.332 + errn += verify("test_2ci_aln: a1", i, a1.get(i), -123); 40.333 + } 40.334 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 40.335 + errn += verify("test_2ci_aln: a2", i, a2.get(i), -103); 40.336 + } 40.337 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 40.338 + errn += verify("test_2ci_aln: a2", i, a2.get(i), -1); 40.339 + } 40.340 + for (int i=0; i<ARRLEN; i++) { 40.341 + a1.lazySet(i, -1); 40.342 + a2.lazySet(i, -1); 40.343 + } 40.344 + test_2vi_aln(a1, a2, 123, 103); 40.345 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 40.346 + errn += verify("test_2vi_aln: a1", i, a1.get(i), 123); 40.347 + } 40.348 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 40.349 + errn += verify("test_2vi_aln: a1", i, a1.get(i), -1); 40.350 + } 40.351 + for (int i=0; i<ALIGN_OFF; i++) { 40.352 + errn += verify("test_2vi_aln: a2", i, a2.get(i), -1); 40.353 + } 40.354 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 40.355 + errn += verify("test_2vi_aln: a2", i, a2.get(i), 103); 40.356 + } 40.357 + 40.358 + // Reset for 2 arrays with relative unaligned offset 40.359 + for (int i=0; i<ARRLEN; i++) { 40.360 + a1.lazySet(i, -1); 40.361 + a2.lazySet(i, -1); 40.362 + } 40.363 + test_vi(a2, 123, -1); 40.364 + test_cp_unalndst(a1, a2); 40.365 + for (int i=0; i<UNALIGN_OFF; i++) { 40.366 + errn += verify("test_cp_unalndst: a1", i, a1.get(i), -1); 40.367 + } 40.368 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 40.369 + errn += verify("test_cp_unalndst: a1", i, a1.get(i), 123); 40.370 + } 40.371 + test_vi(a2, -123, 123); 40.372 + test_cp_unalnsrc(a1, a2); 40.373 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 40.374 + errn += verify("test_cp_unalnsrc: a1", i, a1.get(i), -123); 40.375 + } 40.376 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 40.377 + errn += verify("test_cp_unalnsrc: a1", i, a1.get(i), 123); 40.378 + } 40.379 + for (int i=0; i<ARRLEN; i++) { 40.380 + a1.lazySet(i, -1); 40.381 + a2.lazySet(i, -1); 40.382 + } 40.383 + test_2ci_unaln(a1, a2); 40.384 + for (int i=0; i<UNALIGN_OFF; i++) { 40.385 + errn += verify("test_2ci_unaln: a1", i, a1.get(i), -1); 40.386 + } 40.387 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 40.388 + errn += verify("test_2ci_unaln: a1", i, a1.get(i), -123); 40.389 + } 40.390 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 40.391 + errn += verify("test_2ci_unaln: a2", i, a2.get(i), -103); 40.392 + } 40.393 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 40.394 + errn += verify("test_2ci_unaln: a2", i, a2.get(i), -1); 40.395 + } 40.396 + for (int i=0; i<ARRLEN; i++) { 40.397 + a1.lazySet(i, -1); 40.398 + a2.lazySet(i, -1); 40.399 + } 40.400 + test_2vi_unaln(a1, a2, 123, 103); 40.401 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 40.402 + errn += verify("test_2vi_unaln: a1", i, a1.get(i), 123); 40.403 + } 40.404 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 40.405 + errn += verify("test_2vi_unaln: a1", i, a1.get(i), -1); 40.406 + } 40.407 + for (int i=0; i<UNALIGN_OFF; i++) { 40.408 + errn += verify("test_2vi_unaln: a2", i, a2.get(i), -1); 40.409 + } 40.410 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 40.411 + errn += verify("test_2vi_unaln: a2", i, a2.get(i), 103); 40.412 + } 40.413 + 40.414 + // Reset for aligned overlap initialization 40.415 + for (int i=0; i<ALIGN_OFF; i++) { 40.416 + a1.lazySet(i, i); 40.417 + } 40.418 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 40.419 + a1.lazySet(i, -1); 40.420 + } 40.421 + test_cp_alndst(a1, a1); 40.422 + for (int i=0; i<ARRLEN; i++) { 40.423 + int v = i%ALIGN_OFF; 40.424 + errn += verify("test_cp_alndst_overlap: a1", i, a1.get(i), v); 40.425 + } 40.426 + for (int i=0; i<ALIGN_OFF; i++) { 40.427 + a1.lazySet((i+ALIGN_OFF), -1); 40.428 + } 40.429 + test_cp_alnsrc(a1, a1); 40.430 + for (int i=0; i<ALIGN_OFF; i++) { 40.431 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1.get(i), -1); 40.432 + } 40.433 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 40.434 + int v = i%ALIGN_OFF; 40.435 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1.get(i), v); 40.436 + } 40.437 + for (int i=0; i<ARRLEN; i++) { 40.438 + a1.lazySet(i, -1); 40.439 + } 40.440 + test_2ci_aln(a1, a1); 40.441 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 40.442 + errn += verify("test_2ci_aln_overlap: a1", i, a1.get(i), -103); 40.443 + } 40.444 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 40.445 + errn += verify("test_2ci_aln_overlap: a1", i, a1.get(i), -123); 40.446 + } 40.447 + for (int i=0; i<ARRLEN; i++) { 40.448 + a1.lazySet(i, -1); 40.449 + } 40.450 + test_2vi_aln(a1, a1, 123, 103); 40.451 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 40.452 + errn += verify("test_2vi_aln_overlap: a1", i, a1.get(i), 123); 40.453 + } 40.454 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 40.455 + errn += verify("test_2vi_aln_overlap: a1", i, a1.get(i), 103); 40.456 + } 40.457 + 40.458 + // Reset for unaligned overlap initialization 40.459 + for (int i=0; i<UNALIGN_OFF; i++) { 40.460 + a1.lazySet(i, i); 40.461 + } 40.462 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 40.463 + a1.lazySet(i, -1); 40.464 + } 40.465 + test_cp_unalndst(a1, a1); 40.466 + for (int i=0; i<ARRLEN; i++) { 40.467 + int v = i%UNALIGN_OFF; 40.468 + errn += verify("test_cp_unalndst_overlap: a1", i, a1.get(i), v); 40.469 + } 40.470 + for (int i=0; i<UNALIGN_OFF; i++) { 40.471 + a1.lazySet((i+UNALIGN_OFF), -1); 40.472 + } 40.473 + test_cp_unalnsrc(a1, a1); 40.474 + for (int i=0; i<UNALIGN_OFF; i++) { 40.475 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1.get(i), -1); 40.476 + } 40.477 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 40.478 + int v = i%UNALIGN_OFF; 40.479 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1.get(i), v); 40.480 + } 40.481 + for (int i=0; i<ARRLEN; i++) { 40.482 + a1.lazySet(i, -1); 40.483 + } 40.484 + test_2ci_unaln(a1, a1); 40.485 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 40.486 + errn += verify("test_2ci_unaln_overlap: a1", i, a1.get(i), -103); 40.487 + } 40.488 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 40.489 + errn += verify("test_2ci_unaln_overlap: a1", i, a1.get(i), -123); 40.490 + } 40.491 + for (int i=0; i<ARRLEN; i++) { 40.492 + a1.lazySet(i, -1); 40.493 + } 40.494 + test_2vi_unaln(a1, a1, 123, 103); 40.495 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 40.496 + errn += verify("test_2vi_unaln_overlap: a1", i, a1.get(i), 123); 40.497 + } 40.498 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 40.499 + errn += verify("test_2vi_unaln_overlap: a1", i, a1.get(i), 103); 40.500 + } 40.501 + 40.502 + } 40.503 + 40.504 + if (errn > 0 || test_only) 40.505 + return errn; 40.506 + 40.507 + // Initialize 40.508 + for (int i=0; i<ARRLEN; i++) { 40.509 + a1.lazySet(i, -1); 40.510 + a2.lazySet(i, -1); 40.511 + } 40.512 + System.out.println("Time"); 40.513 + long start, end; 40.514 + start = System.currentTimeMillis(); 40.515 + for (int i=0; i<ITERS; i++) { 40.516 + test_ci(a1); 40.517 + } 40.518 + end = System.currentTimeMillis(); 40.519 + System.out.println("test_ci: " + (end - start)); 40.520 + start = System.currentTimeMillis(); 40.521 + for (int i=0; i<ITERS; i++) { 40.522 + test_vi(a2, 123, -1); 40.523 + } 40.524 + end = System.currentTimeMillis(); 40.525 + System.out.println("test_vi: " + (end - start)); 40.526 + start = System.currentTimeMillis(); 40.527 + for (int i=0; i<ITERS; i++) { 40.528 + test_cp(a1, a2); 40.529 + } 40.530 + end = System.currentTimeMillis(); 40.531 + System.out.println("test_cp: " + (end - start)); 40.532 + start = System.currentTimeMillis(); 40.533 + for (int i=0; i<ITERS; i++) { 40.534 + test_2ci(a1, a2); 40.535 + } 40.536 + end = System.currentTimeMillis(); 40.537 + System.out.println("test_2ci: " + (end - start)); 40.538 + start = System.currentTimeMillis(); 40.539 + for (int i=0; i<ITERS; i++) { 40.540 + test_2vi(a1, a2, 123, 103); 40.541 + } 40.542 + end = System.currentTimeMillis(); 40.543 + System.out.println("test_2vi: " + (end - start)); 40.544 + 40.545 + start = System.currentTimeMillis(); 40.546 + for (int i=0; i<ITERS; i++) { 40.547 + test_ci_neg(a1, 123); 40.548 + } 40.549 + end = System.currentTimeMillis(); 40.550 + System.out.println("test_ci_neg: " + (end - start)); 40.551 + start = System.currentTimeMillis(); 40.552 + for (int i=0; i<ITERS; i++) { 40.553 + test_vi_neg(a2, 123, 103); 40.554 + } 40.555 + end = System.currentTimeMillis(); 40.556 + System.out.println("test_vi_neg: " + (end - start)); 40.557 + start = System.currentTimeMillis(); 40.558 + for (int i=0; i<ITERS; i++) { 40.559 + test_cp_neg(a1, a2); 40.560 + } 40.561 + end = System.currentTimeMillis(); 40.562 + System.out.println("test_cp_neg: " + (end - start)); 40.563 + start = System.currentTimeMillis(); 40.564 + for (int i=0; i<ITERS; i++) { 40.565 + test_2ci_neg(a1, a2); 40.566 + } 40.567 + end = System.currentTimeMillis(); 40.568 + System.out.println("test_2ci_neg: " + (end - start)); 40.569 + start = System.currentTimeMillis(); 40.570 + for (int i=0; i<ITERS; i++) { 40.571 + test_2vi_neg(a1, a2, 123, 103); 40.572 + } 40.573 + end = System.currentTimeMillis(); 40.574 + System.out.println("test_2vi_neg: " + (end - start)); 40.575 + 40.576 + start = System.currentTimeMillis(); 40.577 + for (int i=0; i<ITERS; i++) { 40.578 + test_ci_oppos(a1, 123); 40.579 + } 40.580 + end = System.currentTimeMillis(); 40.581 + System.out.println("test_ci_oppos: " + (end - start)); 40.582 + start = System.currentTimeMillis(); 40.583 + for (int i=0; i<ITERS; i++) { 40.584 + test_vi_oppos(a2, 123, 103); 40.585 + } 40.586 + end = System.currentTimeMillis(); 40.587 + System.out.println("test_vi_oppos: " + (end - start)); 40.588 + start = System.currentTimeMillis(); 40.589 + for (int i=0; i<ITERS; i++) { 40.590 + test_cp_oppos(a1, a2); 40.591 + } 40.592 + end = System.currentTimeMillis(); 40.593 + System.out.println("test_cp_oppos: " + (end - start)); 40.594 + start = System.currentTimeMillis(); 40.595 + for (int i=0; i<ITERS; i++) { 40.596 + test_2ci_oppos(a1, a2); 40.597 + } 40.598 + end = System.currentTimeMillis(); 40.599 + System.out.println("test_2ci_oppos: " + (end - start)); 40.600 + start = System.currentTimeMillis(); 40.601 + for (int i=0; i<ITERS; i++) { 40.602 + test_2vi_oppos(a1, a2, 123, 103); 40.603 + } 40.604 + end = System.currentTimeMillis(); 40.605 + System.out.println("test_2vi_oppos: " + (end - start)); 40.606 + 40.607 + start = System.currentTimeMillis(); 40.608 + for (int i=0; i<ITERS; i++) { 40.609 + test_ci_off(a1, 123); 40.610 + } 40.611 + end = System.currentTimeMillis(); 40.612 + System.out.println("test_ci_off: " + (end - start)); 40.613 + start = System.currentTimeMillis(); 40.614 + for (int i=0; i<ITERS; i++) { 40.615 + test_vi_off(a2, 123, 103); 40.616 + } 40.617 + end = System.currentTimeMillis(); 40.618 + System.out.println("test_vi_off: " + (end - start)); 40.619 + start = System.currentTimeMillis(); 40.620 + for (int i=0; i<ITERS; i++) { 40.621 + test_cp_off(a1, a2); 40.622 + } 40.623 + end = System.currentTimeMillis(); 40.624 + System.out.println("test_cp_off: " + (end - start)); 40.625 + start = System.currentTimeMillis(); 40.626 + for (int i=0; i<ITERS; i++) { 40.627 + test_2ci_off(a1, a2); 40.628 + } 40.629 + end = System.currentTimeMillis(); 40.630 + System.out.println("test_2ci_off: " + (end - start)); 40.631 + start = System.currentTimeMillis(); 40.632 + for (int i=0; i<ITERS; i++) { 40.633 + test_2vi_off(a1, a2, 123, 103); 40.634 + } 40.635 + end = System.currentTimeMillis(); 40.636 + System.out.println("test_2vi_off: " + (end - start)); 40.637 + 40.638 + start = System.currentTimeMillis(); 40.639 + for (int i=0; i<ITERS; i++) { 40.640 + test_ci_inv(a1, OFFSET, 123); 40.641 + } 40.642 + end = System.currentTimeMillis(); 40.643 + System.out.println("test_ci_inv: " + (end - start)); 40.644 + start = System.currentTimeMillis(); 40.645 + for (int i=0; i<ITERS; i++) { 40.646 + test_vi_inv(a2, 123, OFFSET, 103); 40.647 + } 40.648 + end = System.currentTimeMillis(); 40.649 + System.out.println("test_vi_inv: " + (end - start)); 40.650 + start = System.currentTimeMillis(); 40.651 + for (int i=0; i<ITERS; i++) { 40.652 + test_cp_inv(a1, a2, OFFSET); 40.653 + } 40.654 + end = System.currentTimeMillis(); 40.655 + System.out.println("test_cp_inv: " + (end - start)); 40.656 + start = System.currentTimeMillis(); 40.657 + for (int i=0; i<ITERS; i++) { 40.658 + test_2ci_inv(a1, a2, OFFSET); 40.659 + } 40.660 + end = System.currentTimeMillis(); 40.661 + System.out.println("test_2ci_inv: " + (end - start)); 40.662 + start = System.currentTimeMillis(); 40.663 + for (int i=0; i<ITERS; i++) { 40.664 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 40.665 + } 40.666 + end = System.currentTimeMillis(); 40.667 + System.out.println("test_2vi_inv: " + (end - start)); 40.668 + 40.669 + start = System.currentTimeMillis(); 40.670 + for (int i=0; i<ITERS; i++) { 40.671 + test_ci_scl(a1, 123); 40.672 + } 40.673 + end = System.currentTimeMillis(); 40.674 + System.out.println("test_ci_scl: " + (end - start)); 40.675 + start = System.currentTimeMillis(); 40.676 + for (int i=0; i<ITERS; i++) { 40.677 + test_vi_scl(a2, 123, 103); 40.678 + } 40.679 + end = System.currentTimeMillis(); 40.680 + System.out.println("test_vi_scl: " + (end - start)); 40.681 + start = System.currentTimeMillis(); 40.682 + for (int i=0; i<ITERS; i++) { 40.683 + test_cp_scl(a1, a2); 40.684 + } 40.685 + end = System.currentTimeMillis(); 40.686 + System.out.println("test_cp_scl: " + (end - start)); 40.687 + start = System.currentTimeMillis(); 40.688 + for (int i=0; i<ITERS; i++) { 40.689 + test_2ci_scl(a1, a2); 40.690 + } 40.691 + end = System.currentTimeMillis(); 40.692 + System.out.println("test_2ci_scl: " + (end - start)); 40.693 + start = System.currentTimeMillis(); 40.694 + for (int i=0; i<ITERS; i++) { 40.695 + test_2vi_scl(a1, a2, 123, 103); 40.696 + } 40.697 + end = System.currentTimeMillis(); 40.698 + System.out.println("test_2vi_scl: " + (end - start)); 40.699 + 40.700 + start = System.currentTimeMillis(); 40.701 + for (int i=0; i<ITERS; i++) { 40.702 + test_cp_alndst(a1, a2); 40.703 + } 40.704 + end = System.currentTimeMillis(); 40.705 + System.out.println("test_cp_alndst: " + (end - start)); 40.706 + start = System.currentTimeMillis(); 40.707 + for (int i=0; i<ITERS; i++) { 40.708 + test_cp_alnsrc(a1, a2); 40.709 + } 40.710 + end = System.currentTimeMillis(); 40.711 + System.out.println("test_cp_alnsrc: " + (end - start)); 40.712 + start = System.currentTimeMillis(); 40.713 + for (int i=0; i<ITERS; i++) { 40.714 + test_2ci_aln(a1, a2); 40.715 + } 40.716 + end = System.currentTimeMillis(); 40.717 + System.out.println("test_2ci_aln: " + (end - start)); 40.718 + start = System.currentTimeMillis(); 40.719 + for (int i=0; i<ITERS; i++) { 40.720 + test_2vi_aln(a1, a2, 123, 103); 40.721 + } 40.722 + end = System.currentTimeMillis(); 40.723 + System.out.println("test_2vi_aln: " + (end - start)); 40.724 + 40.725 + start = System.currentTimeMillis(); 40.726 + for (int i=0; i<ITERS; i++) { 40.727 + test_cp_unalndst(a1, a2); 40.728 + } 40.729 + end = System.currentTimeMillis(); 40.730 + System.out.println("test_cp_unalndst: " + (end - start)); 40.731 + start = System.currentTimeMillis(); 40.732 + for (int i=0; i<ITERS; i++) { 40.733 + test_cp_unalnsrc(a1, a2); 40.734 + } 40.735 + end = System.currentTimeMillis(); 40.736 + System.out.println("test_cp_unalnsrc: " + (end - start)); 40.737 + start = System.currentTimeMillis(); 40.738 + for (int i=0; i<ITERS; i++) { 40.739 + test_2ci_unaln(a1, a2); 40.740 + } 40.741 + end = System.currentTimeMillis(); 40.742 + System.out.println("test_2ci_unaln: " + (end - start)); 40.743 + start = System.currentTimeMillis(); 40.744 + for (int i=0; i<ITERS; i++) { 40.745 + test_2vi_unaln(a1, a2, 123, 103); 40.746 + } 40.747 + end = System.currentTimeMillis(); 40.748 + System.out.println("test_2vi_unaln: " + (end - start)); 40.749 + 40.750 + return errn; 40.751 + } 40.752 + 40.753 + static void test_ci(AtomicIntegerArray a) { 40.754 + for (int i = 0; i < ARRLEN; i+=1) { 40.755 + a.lazySet(i, -123); 40.756 + } 40.757 + } 40.758 + static void test_vi(AtomicIntegerArray a, int b, int old) { 40.759 + for (int i = 0; i < ARRLEN; i+=1) { 40.760 + a.lazySet(i, b); 40.761 + } 40.762 + } 40.763 + static void test_cp(AtomicIntegerArray a, AtomicIntegerArray b) { 40.764 + for (int i = 0; i < ARRLEN; i+=1) { 40.765 + a.lazySet(i, b.get(i)); 40.766 + } 40.767 + } 40.768 + static void test_2ci(AtomicIntegerArray a, AtomicIntegerArray b) { 40.769 + for (int i = 0; i < ARRLEN; i+=1) { 40.770 + a.lazySet(i, -123); 40.771 + b.lazySet(i, -103); 40.772 + } 40.773 + } 40.774 + static void test_2vi(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 40.775 + for (int i = 0; i < ARRLEN; i+=1) { 40.776 + a.lazySet(i, c); 40.777 + b.lazySet(i, d); 40.778 + } 40.779 + } 40.780 + static void test_ci_neg(AtomicIntegerArray a, int old) { 40.781 + for (int i = ARRLEN-1; i >= 0; i-=1) { 40.782 + a.lazySet(i,-123); 40.783 + } 40.784 + } 40.785 + static void test_vi_neg(AtomicIntegerArray a, int b, int old) { 40.786 + for (int i = ARRLEN-1; i >= 0; i-=1) { 40.787 + a.lazySet(i, b); 40.788 + } 40.789 + } 40.790 + static void test_cp_neg(AtomicIntegerArray a, AtomicIntegerArray b) { 40.791 + for (int i = ARRLEN-1; i >= 0; i-=1) { 40.792 + a.lazySet(i, b.get(i)); 40.793 + } 40.794 + } 40.795 + static void test_2ci_neg(AtomicIntegerArray a, AtomicIntegerArray b) { 40.796 + for (int i = ARRLEN-1; i >= 0; i-=1) { 40.797 + a.lazySet(i, -123); 40.798 + b.lazySet(i, -103); 40.799 + } 40.800 + } 40.801 + static void test_2vi_neg(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 40.802 + for (int i = ARRLEN-1; i >= 0; i-=1) { 40.803 + a.lazySet(i, c); 40.804 + b.lazySet(i, d); 40.805 + } 40.806 + } 40.807 + static void test_ci_oppos(AtomicIntegerArray a, int old) { 40.808 + int limit = ARRLEN-1; 40.809 + for (int i = 0; i < ARRLEN; i+=1) { 40.810 + a.lazySet((limit-i), -123); 40.811 + } 40.812 + } 40.813 + static void test_vi_oppos(AtomicIntegerArray a, int b, int old) { 40.814 + int limit = ARRLEN-1; 40.815 + for (int i = limit; i >= 0; i-=1) { 40.816 + a.lazySet((limit-i), b); 40.817 + } 40.818 + } 40.819 + static void test_cp_oppos(AtomicIntegerArray a, AtomicIntegerArray b) { 40.820 + int limit = ARRLEN-1; 40.821 + for (int i = 0; i < ARRLEN; i+=1) { 40.822 + a.lazySet(i, b.get(limit-i)); 40.823 + } 40.824 + } 40.825 + static void test_2ci_oppos(AtomicIntegerArray a, AtomicIntegerArray b) { 40.826 + int limit = ARRLEN-1; 40.827 + for (int i = 0; i < ARRLEN; i+=1) { 40.828 + a.lazySet((limit-i), -123); 40.829 + b.lazySet(i, -103); 40.830 + } 40.831 + } 40.832 + static void test_2vi_oppos(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 40.833 + int limit = ARRLEN-1; 40.834 + for (int i = limit; i >= 0; i-=1) { 40.835 + a.lazySet(i, c); 40.836 + b.lazySet((limit-i), d); 40.837 + } 40.838 + } 40.839 + static void test_ci_off(AtomicIntegerArray a, int old) { 40.840 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 40.841 + a.lazySet((i+OFFSET), -123); 40.842 + } 40.843 + } 40.844 + static void test_vi_off(AtomicIntegerArray a, int b, int old) { 40.845 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 40.846 + a.lazySet((i+OFFSET), b); 40.847 + } 40.848 + } 40.849 + static void test_cp_off(AtomicIntegerArray a, AtomicIntegerArray b) { 40.850 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 40.851 + a.lazySet((i+OFFSET), b.get(i+OFFSET)); 40.852 + } 40.853 + } 40.854 + static void test_2ci_off(AtomicIntegerArray a, AtomicIntegerArray b) { 40.855 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 40.856 + a.lazySet((i+OFFSET), -123); 40.857 + b.lazySet((i+OFFSET), -103); 40.858 + } 40.859 + } 40.860 + static void test_2vi_off(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 40.861 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 40.862 + a.lazySet((i+OFFSET), c); 40.863 + b.lazySet((i+OFFSET), d); 40.864 + } 40.865 + } 40.866 + static void test_ci_inv(AtomicIntegerArray a, int k, int old) { 40.867 + for (int i = 0; i < ARRLEN-k; i+=1) { 40.868 + a.lazySet((i+k),-123); 40.869 + } 40.870 + } 40.871 + static void test_vi_inv(AtomicIntegerArray a, int b, int k, int old) { 40.872 + for (int i = 0; i < ARRLEN-k; i+=1) { 40.873 + a.lazySet((i+k), b); 40.874 + } 40.875 + } 40.876 + static void test_cp_inv(AtomicIntegerArray a, AtomicIntegerArray b, int k) { 40.877 + for (int i = 0; i < ARRLEN-k; i+=1) { 40.878 + a.lazySet((i+k), b.get(i+k)); 40.879 + } 40.880 + } 40.881 + static void test_2ci_inv(AtomicIntegerArray a, AtomicIntegerArray b, int k) { 40.882 + for (int i = 0; i < ARRLEN-k; i+=1) { 40.883 + a.lazySet((i+k), -123); 40.884 + b.lazySet((i+k), -103); 40.885 + } 40.886 + } 40.887 + static void test_2vi_inv(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d, int k) { 40.888 + for (int i = 0; i < ARRLEN-k; i+=1) { 40.889 + a.lazySet((i+k), c); 40.890 + b.lazySet((i+k), d); 40.891 + } 40.892 + } 40.893 + static void test_ci_scl(AtomicIntegerArray a, int old) { 40.894 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 40.895 + a.lazySet((i*SCALE), -123); 40.896 + } 40.897 + } 40.898 + static void test_vi_scl(AtomicIntegerArray a, int b, int old) { 40.899 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 40.900 + a.lazySet((i*SCALE), b); 40.901 + } 40.902 + } 40.903 + static void test_cp_scl(AtomicIntegerArray a, AtomicIntegerArray b) { 40.904 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 40.905 + a.lazySet((i*SCALE), b.get(i*SCALE)); 40.906 + } 40.907 + } 40.908 + static void test_2ci_scl(AtomicIntegerArray a, AtomicIntegerArray b) { 40.909 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 40.910 + a.lazySet((i*SCALE), -123); 40.911 + b.lazySet((i*SCALE), -103); 40.912 + } 40.913 + } 40.914 + static void test_2vi_scl(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 40.915 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 40.916 + a.lazySet((i*SCALE), c); 40.917 + b.lazySet((i*SCALE), d); 40.918 + } 40.919 + } 40.920 + static void test_cp_alndst(AtomicIntegerArray a, AtomicIntegerArray b) { 40.921 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 40.922 + a.lazySet((i+ALIGN_OFF), b.get(i)); 40.923 + } 40.924 + } 40.925 + static void test_cp_alnsrc(AtomicIntegerArray a, AtomicIntegerArray b) { 40.926 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 40.927 + a.lazySet(i, b.get(i+ALIGN_OFF)); 40.928 + } 40.929 + } 40.930 + static void test_2ci_aln(AtomicIntegerArray a, AtomicIntegerArray b) { 40.931 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 40.932 + a.lazySet((i+ALIGN_OFF), -123); 40.933 + b.lazySet(i, -103); 40.934 + } 40.935 + } 40.936 + static void test_2vi_aln(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 40.937 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 40.938 + a.lazySet(i, c); 40.939 + b.lazySet((i+ALIGN_OFF), d); 40.940 + } 40.941 + } 40.942 + static void test_cp_unalndst(AtomicIntegerArray a, AtomicIntegerArray b) { 40.943 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 40.944 + a.lazySet((i+UNALIGN_OFF), b.get(i)); 40.945 + } 40.946 + } 40.947 + static void test_cp_unalnsrc(AtomicIntegerArray a, AtomicIntegerArray b) { 40.948 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 40.949 + a.lazySet(i, b.get(i+UNALIGN_OFF)); 40.950 + } 40.951 + } 40.952 + static void test_2ci_unaln(AtomicIntegerArray a, AtomicIntegerArray b) { 40.953 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 40.954 + a.lazySet((i+UNALIGN_OFF), -123); 40.955 + b.lazySet(i, -103); 40.956 + } 40.957 + } 40.958 + static void test_2vi_unaln(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 40.959 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 40.960 + a.lazySet(i, c); 40.961 + b.lazySet((i+UNALIGN_OFF), d); 40.962 + } 40.963 + } 40.964 + 40.965 + static int verify(String text, int i, int elem, int val) { 40.966 + if (elem != val) { 40.967 + System.err.println(text + "[" + i + "] = " + elem + " != " + val); 40.968 + return 1; 40.969 + } 40.970 + return 0; 40.971 + } 40.972 +}
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 41.2 +++ b/test/compiler/8004867/TestIntAtomicVolatile.java Tue Feb 26 11:52:06 2013 +0100 41.3 @@ -0,0 +1,969 @@ 41.4 +/* 41.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 41.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41.7 + * 41.8 + * This code is free software; you can redistribute it and/or modify it 41.9 + * under the terms of the GNU General Public License version 2 only, as 41.10 + * published by the Free Software Foundation. 41.11 + * 41.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 41.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 41.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 41.15 + * version 2 for more details (a copy is included in the LICENSE file that 41.16 + * accompanied this code). 41.17 + * 41.18 + * You should have received a copy of the GNU General Public License version 41.19 + * 2 along with this work; if not, write to the Free Software Foundation, 41.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 41.21 + * 41.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 41.23 + * or visit www.oracle.com if you need additional information or have any 41.24 + * questions. 41.25 + * 41.26 + */ 41.27 + 41.28 +/** 41.29 + * @test 41.30 + * @bug 8004867 41.31 + * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" 41.32 + * 41.33 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntAtomicVolatile 41.34 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntAtomicVolatile 41.35 + */ 41.36 + 41.37 +import java.util.concurrent.atomic.AtomicIntegerArray; 41.38 + 41.39 +public class TestIntAtomicVolatile { 41.40 + private static final int ARRLEN = 97; 41.41 + private static final int ITERS = 11000; 41.42 + private static final int OFFSET = 3; 41.43 + private static final int SCALE = 2; 41.44 + private static final int ALIGN_OFF = 8; 41.45 + private static final int UNALIGN_OFF = 5; 41.46 + 41.47 + public static void main(String args[]) { 41.48 + System.out.println("Testing Integer array atomic volatile operations"); 41.49 + int errn = test(false); 41.50 + if (errn > 0) { 41.51 + System.err.println("FAILED: " + errn + " errors"); 41.52 + System.exit(97); 41.53 + } 41.54 + System.out.println("PASSED"); 41.55 + } 41.56 + 41.57 + static int test(boolean test_only) { 41.58 + AtomicIntegerArray a1 = new AtomicIntegerArray(ARRLEN); 41.59 + AtomicIntegerArray a2 = new AtomicIntegerArray(ARRLEN); 41.60 + // Initialize 41.61 + for (int i=0; i<ARRLEN; i++) { 41.62 + a1.set(i, -1); 41.63 + a2.set(i, -1); 41.64 + } 41.65 + System.out.println("Warmup"); 41.66 + for (int i=0; i<ITERS; i++) { 41.67 + test_ci(a1); 41.68 + test_vi(a2, 123, -1); 41.69 + test_cp(a1, a2); 41.70 + test_2ci(a1, a2); 41.71 + test_2vi(a1, a2, 123, 103); 41.72 + test_ci_neg(a1, 123); 41.73 + test_vi_neg(a2, 123, 103); 41.74 + test_cp_neg(a1, a2); 41.75 + test_2ci_neg(a1, a2); 41.76 + test_2vi_neg(a1, a2, 123, 103); 41.77 + test_ci_oppos(a1, 123); 41.78 + test_vi_oppos(a2, 123, 103); 41.79 + test_cp_oppos(a1, a2); 41.80 + test_2ci_oppos(a1, a2); 41.81 + test_2vi_oppos(a1, a2, 123, 103); 41.82 + test_ci_off(a1, 123); 41.83 + test_vi_off(a2, 123, 103); 41.84 + test_cp_off(a1, a2); 41.85 + test_2ci_off(a1, a2); 41.86 + test_2vi_off(a1, a2, 123, 103); 41.87 + test_ci_inv(a1, OFFSET, 123); 41.88 + test_vi_inv(a2, 123, OFFSET, 103); 41.89 + test_cp_inv(a1, a2, OFFSET); 41.90 + test_2ci_inv(a1, a2, OFFSET); 41.91 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 41.92 + test_ci_scl(a1, 123); 41.93 + test_vi_scl(a2, 123, 103); 41.94 + test_cp_scl(a1, a2); 41.95 + test_2ci_scl(a1, a2); 41.96 + test_2vi_scl(a1, a2, 123, 103); 41.97 + test_cp_alndst(a1, a2); 41.98 + test_cp_alnsrc(a1, a2); 41.99 + test_2ci_aln(a1, a2); 41.100 + test_2vi_aln(a1, a2, 123, 103); 41.101 + test_cp_unalndst(a1, a2); 41.102 + test_cp_unalnsrc(a1, a2); 41.103 + test_2ci_unaln(a1, a2); 41.104 + test_2vi_unaln(a1, a2, 123, 103); 41.105 + } 41.106 + // Initialize 41.107 + for (int i=0; i<ARRLEN; i++) { 41.108 + a1.set(i, -1); 41.109 + a2.set(i, -1); 41.110 + } 41.111 + // Test and verify results 41.112 + System.out.println("Verification"); 41.113 + int errn = 0; 41.114 + { 41.115 + test_ci(a1); 41.116 + for (int i=0; i<ARRLEN; i++) { 41.117 + errn += verify("test_ci: a1", i, a1.get(i), -123); 41.118 + } 41.119 + test_vi(a2, 123, -1); 41.120 + for (int i=0; i<ARRLEN; i++) { 41.121 + errn += verify("test_vi: a2", i, a2.get(i), 123); 41.122 + } 41.123 + test_cp(a1, a2); 41.124 + for (int i=0; i<ARRLEN; i++) { 41.125 + errn += verify("test_cp: a1", i, a1.get(i), 123); 41.126 + } 41.127 + test_2ci(a1, a2); 41.128 + for (int i=0; i<ARRLEN; i++) { 41.129 + errn += verify("test_2ci: a1", i, a1.get(i), -123); 41.130 + errn += verify("test_2ci: a2", i, a2.get(i), -103); 41.131 + } 41.132 + test_2vi(a1, a2, 123, 103); 41.133 + for (int i=0; i<ARRLEN; i++) { 41.134 + errn += verify("test_2vi: a1", i, a1.get(i), 123); 41.135 + errn += verify("test_2vi: a2", i, a2.get(i), 103); 41.136 + } 41.137 + // Reset for negative stride 41.138 + for (int i=0; i<ARRLEN; i++) { 41.139 + a1.set(i, -1); 41.140 + a2.set(i, -1); 41.141 + } 41.142 + test_ci_neg(a1, -1); 41.143 + for (int i=0; i<ARRLEN; i++) { 41.144 + errn += verify("test_ci_neg: a1", i, a1.get(i), -123); 41.145 + } 41.146 + test_vi_neg(a2, 123, -1); 41.147 + for (int i=0; i<ARRLEN; i++) { 41.148 + errn += verify("test_vi_neg: a2", i, a2.get(i), 123); 41.149 + } 41.150 + test_cp_neg(a1, a2); 41.151 + for (int i=0; i<ARRLEN; i++) { 41.152 + errn += verify("test_cp_neg: a1", i, a1.get(i), 123); 41.153 + } 41.154 + test_2ci_neg(a1, a2); 41.155 + for (int i=0; i<ARRLEN; i++) { 41.156 + errn += verify("test_2ci_neg: a1", i, a1.get(i), -123); 41.157 + errn += verify("test_2ci_neg: a2", i, a2.get(i), -103); 41.158 + } 41.159 + test_2vi_neg(a1, a2, 123, 103); 41.160 + for (int i=0; i<ARRLEN; i++) { 41.161 + errn += verify("test_2vi_neg: a1", i, a1.get(i), 123); 41.162 + errn += verify("test_2vi_neg: a2", i, a2.get(i), 103); 41.163 + } 41.164 + // Reset for opposite stride 41.165 + for (int i=0; i<ARRLEN; i++) { 41.166 + a1.set(i, -1); 41.167 + a2.set(i, -1); 41.168 + } 41.169 + test_ci_oppos(a1, -1); 41.170 + for (int i=0; i<ARRLEN; i++) { 41.171 + errn += verify("test_ci_oppos: a1", i, a1.get(i), -123); 41.172 + } 41.173 + test_vi_oppos(a2, 123, -1); 41.174 + for (int i=0; i<ARRLEN; i++) { 41.175 + errn += verify("test_vi_oppos: a2", i, a2.get(i), 123); 41.176 + } 41.177 + test_cp_oppos(a1, a2); 41.178 + for (int i=0; i<ARRLEN; i++) { 41.179 + errn += verify("test_cp_oppos: a1", i, a1.get(i), 123); 41.180 + } 41.181 + test_2ci_oppos(a1, a2); 41.182 + for (int i=0; i<ARRLEN; i++) { 41.183 + errn += verify("test_2ci_oppos: a1", i, a1.get(i), -123); 41.184 + errn += verify("test_2ci_oppos: a2", i, a2.get(i), -103); 41.185 + } 41.186 + test_2vi_oppos(a1, a2, 123, 103); 41.187 + for (int i=0; i<ARRLEN; i++) { 41.188 + errn += verify("test_2vi_oppos: a1", i, a1.get(i), 123); 41.189 + errn += verify("test_2vi_oppos: a2", i, a2.get(i), 103); 41.190 + } 41.191 + // Reset for indexing with offset 41.192 + for (int i=0; i<ARRLEN; i++) { 41.193 + a1.set(i, -1); 41.194 + a2.set(i, -1); 41.195 + } 41.196 + test_ci_off(a1, -1); 41.197 + for (int i=OFFSET; i<ARRLEN; i++) { 41.198 + errn += verify("test_ci_off: a1", i, a1.get(i), -123); 41.199 + } 41.200 + test_vi_off(a2, 123, -1); 41.201 + for (int i=OFFSET; i<ARRLEN; i++) { 41.202 + errn += verify("test_vi_off: a2", i, a2.get(i), 123); 41.203 + } 41.204 + test_cp_off(a1, a2); 41.205 + for (int i=OFFSET; i<ARRLEN; i++) { 41.206 + errn += verify("test_cp_off: a1", i, a1.get(i), 123); 41.207 + } 41.208 + test_2ci_off(a1, a2); 41.209 + for (int i=OFFSET; i<ARRLEN; i++) { 41.210 + errn += verify("test_2ci_off: a1", i, a1.get(i), -123); 41.211 + errn += verify("test_2ci_off: a2", i, a2.get(i), -103); 41.212 + } 41.213 + test_2vi_off(a1, a2, 123, 103); 41.214 + for (int i=OFFSET; i<ARRLEN; i++) { 41.215 + errn += verify("test_2vi_off: a1", i, a1.get(i), 123); 41.216 + errn += verify("test_2vi_off: a2", i, a2.get(i), 103); 41.217 + } 41.218 + for (int i=0; i<OFFSET; i++) { 41.219 + errn += verify("test_2vi_off: a1", i, a1.get(i), -1); 41.220 + errn += verify("test_2vi_off: a2", i, a2.get(i), -1); 41.221 + } 41.222 + // Reset for indexing with invariant offset 41.223 + for (int i=0; i<ARRLEN; i++) { 41.224 + a1.set(i, -1); 41.225 + a2.set(i, -1); 41.226 + } 41.227 + test_ci_inv(a1, OFFSET, -1); 41.228 + for (int i=OFFSET; i<ARRLEN; i++) { 41.229 + errn += verify("test_ci_inv: a1", i, a1.get(i), -123); 41.230 + } 41.231 + test_vi_inv(a2, 123, OFFSET, -1); 41.232 + for (int i=OFFSET; i<ARRLEN; i++) { 41.233 + errn += verify("test_vi_inv: a2", i, a2.get(i), 123); 41.234 + } 41.235 + test_cp_inv(a1, a2, OFFSET); 41.236 + for (int i=OFFSET; i<ARRLEN; i++) { 41.237 + errn += verify("test_cp_inv: a1", i, a1.get(i), 123); 41.238 + } 41.239 + test_2ci_inv(a1, a2, OFFSET); 41.240 + for (int i=OFFSET; i<ARRLEN; i++) { 41.241 + errn += verify("test_2ci_inv: a1", i, a1.get(i), -123); 41.242 + errn += verify("test_2ci_inv: a2", i, a2.get(i), -103); 41.243 + } 41.244 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 41.245 + for (int i=OFFSET; i<ARRLEN; i++) { 41.246 + errn += verify("test_2vi_inv: a1", i, a1.get(i), 123); 41.247 + errn += verify("test_2vi_inv: a2", i, a2.get(i), 103); 41.248 + } 41.249 + for (int i=0; i<OFFSET; i++) { 41.250 + errn += verify("test_2vi_inv: a1", i, a1.get(i), -1); 41.251 + errn += verify("test_2vi_inv: a2", i, a2.get(i), -1); 41.252 + } 41.253 + // Reset for indexing with scale 41.254 + for (int i=0; i<ARRLEN; i++) { 41.255 + a1.set(i, -1); 41.256 + a2.set(i, -1); 41.257 + } 41.258 + test_ci_scl(a1, -1); 41.259 + for (int i=0; i<ARRLEN; i++) { 41.260 + int val = (i%SCALE != 0) ? -1 : -123; 41.261 + errn += verify("test_ci_scl: a1", i, a1.get(i), val); 41.262 + } 41.263 + test_vi_scl(a2, 123, -1); 41.264 + for (int i=0; i<ARRLEN; i++) { 41.265 + int val = (i%SCALE != 0) ? -1 : 123; 41.266 + errn += verify("test_vi_scl: a2", i, a2.get(i), val); 41.267 + } 41.268 + test_cp_scl(a1, a2); 41.269 + for (int i=0; i<ARRLEN; i++) { 41.270 + int val = (i%SCALE != 0) ? -1 : 123; 41.271 + errn += verify("test_cp_scl: a1", i, a1.get(i), val); 41.272 + } 41.273 + test_2ci_scl(a1, a2); 41.274 + for (int i=0; i<ARRLEN; i++) { 41.275 + if (i%SCALE != 0) { 41.276 + errn += verify("test_2ci_scl: a1", i, a1.get(i), -1); 41.277 + } else if (i*SCALE < ARRLEN) { 41.278 + errn += verify("test_2ci_scl: a1", i*SCALE, a1.get(i*SCALE), -123); 41.279 + } 41.280 + if (i%SCALE != 0) { 41.281 + errn += verify("test_2ci_scl: a2", i, a2.get(i), -1); 41.282 + } else if (i*SCALE < ARRLEN) { 41.283 + errn += verify("test_2ci_scl: a2", i*SCALE, a2.get(i*SCALE), -103); 41.284 + } 41.285 + } 41.286 + test_2vi_scl(a1, a2, 123, 103); 41.287 + for (int i=0; i<ARRLEN; i++) { 41.288 + if (i%SCALE != 0) { 41.289 + errn += verify("test_2vi_scl: a1", i, a1.get(i), -1); 41.290 + } else if (i*SCALE < ARRLEN) { 41.291 + errn += verify("test_2vi_scl: a1", i*SCALE, a1.get(i*SCALE), 123); 41.292 + } 41.293 + if (i%SCALE != 0) { 41.294 + errn += verify("test_2vi_scl: a2", i, a2.get(i), -1); 41.295 + } else if (i*SCALE < ARRLEN) { 41.296 + errn += verify("test_2vi_scl: a2", i*SCALE, a2.get(i*SCALE), 103); 41.297 + } 41.298 + } 41.299 + // Reset for 2 arrays with relative aligned offset 41.300 + for (int i=0; i<ARRLEN; i++) { 41.301 + a1.set(i, -1); 41.302 + a2.set(i, -1); 41.303 + } 41.304 + test_vi(a2, 123, -1); 41.305 + test_cp_alndst(a1, a2); 41.306 + for (int i=0; i<ALIGN_OFF; i++) { 41.307 + errn += verify("test_cp_alndst: a1", i, a1.get(i), -1); 41.308 + } 41.309 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 41.310 + errn += verify("test_cp_alndst: a1", i, a1.get(i), 123); 41.311 + } 41.312 + for (int i=0; i<ALIGN_OFF; i++) { 41.313 + a1.set(i, 123); 41.314 + } 41.315 + test_vi(a2, -123, 123); 41.316 + test_cp_alnsrc(a1, a2); 41.317 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 41.318 + errn += verify("test_cp_alnsrc: a1", i, a1.get(i), -123); 41.319 + } 41.320 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 41.321 + errn += verify("test_cp_alnsrc: a1", i, a1.get(i), 123); 41.322 + } 41.323 + for (int i=0; i<ARRLEN; i++) { 41.324 + a1.set(i, -1); 41.325 + a2.set(i, -1); 41.326 + } 41.327 + test_2ci_aln(a1, a2); 41.328 + for (int i=0; i<ALIGN_OFF; i++) { 41.329 + errn += verify("test_2ci_aln: a1", i, a1.get(i), -1); 41.330 + } 41.331 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 41.332 + errn += verify("test_2ci_aln: a1", i, a1.get(i), -123); 41.333 + } 41.334 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 41.335 + errn += verify("test_2ci_aln: a2", i, a2.get(i), -103); 41.336 + } 41.337 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 41.338 + errn += verify("test_2ci_aln: a2", i, a2.get(i), -1); 41.339 + } 41.340 + for (int i=0; i<ARRLEN; i++) { 41.341 + a1.set(i, -1); 41.342 + a2.set(i, -1); 41.343 + } 41.344 + test_2vi_aln(a1, a2, 123, 103); 41.345 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 41.346 + errn += verify("test_2vi_aln: a1", i, a1.get(i), 123); 41.347 + } 41.348 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 41.349 + errn += verify("test_2vi_aln: a1", i, a1.get(i), -1); 41.350 + } 41.351 + for (int i=0; i<ALIGN_OFF; i++) { 41.352 + errn += verify("test_2vi_aln: a2", i, a2.get(i), -1); 41.353 + } 41.354 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 41.355 + errn += verify("test_2vi_aln: a2", i, a2.get(i), 103); 41.356 + } 41.357 + 41.358 + // Reset for 2 arrays with relative unaligned offset 41.359 + for (int i=0; i<ARRLEN; i++) { 41.360 + a1.set(i, -1); 41.361 + a2.set(i, -1); 41.362 + } 41.363 + test_vi(a2, 123, -1); 41.364 + test_cp_unalndst(a1, a2); 41.365 + for (int i=0; i<UNALIGN_OFF; i++) { 41.366 + errn += verify("test_cp_unalndst: a1", i, a1.get(i), -1); 41.367 + } 41.368 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 41.369 + errn += verify("test_cp_unalndst: a1", i, a1.get(i), 123); 41.370 + } 41.371 + test_vi(a2, -123, 123); 41.372 + test_cp_unalnsrc(a1, a2); 41.373 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 41.374 + errn += verify("test_cp_unalnsrc: a1", i, a1.get(i), -123); 41.375 + } 41.376 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 41.377 + errn += verify("test_cp_unalnsrc: a1", i, a1.get(i), 123); 41.378 + } 41.379 + for (int i=0; i<ARRLEN; i++) { 41.380 + a1.set(i, -1); 41.381 + a2.set(i, -1); 41.382 + } 41.383 + test_2ci_unaln(a1, a2); 41.384 + for (int i=0; i<UNALIGN_OFF; i++) { 41.385 + errn += verify("test_2ci_unaln: a1", i, a1.get(i), -1); 41.386 + } 41.387 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 41.388 + errn += verify("test_2ci_unaln: a1", i, a1.get(i), -123); 41.389 + } 41.390 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 41.391 + errn += verify("test_2ci_unaln: a2", i, a2.get(i), -103); 41.392 + } 41.393 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 41.394 + errn += verify("test_2ci_unaln: a2", i, a2.get(i), -1); 41.395 + } 41.396 + for (int i=0; i<ARRLEN; i++) { 41.397 + a1.set(i, -1); 41.398 + a2.set(i, -1); 41.399 + } 41.400 + test_2vi_unaln(a1, a2, 123, 103); 41.401 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 41.402 + errn += verify("test_2vi_unaln: a1", i, a1.get(i), 123); 41.403 + } 41.404 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 41.405 + errn += verify("test_2vi_unaln: a1", i, a1.get(i), -1); 41.406 + } 41.407 + for (int i=0; i<UNALIGN_OFF; i++) { 41.408 + errn += verify("test_2vi_unaln: a2", i, a2.get(i), -1); 41.409 + } 41.410 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 41.411 + errn += verify("test_2vi_unaln: a2", i, a2.get(i), 103); 41.412 + } 41.413 + 41.414 + // Reset for aligned overlap initialization 41.415 + for (int i=0; i<ALIGN_OFF; i++) { 41.416 + a1.set(i, i); 41.417 + } 41.418 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 41.419 + a1.set(i, -1); 41.420 + } 41.421 + test_cp_alndst(a1, a1); 41.422 + for (int i=0; i<ARRLEN; i++) { 41.423 + int v = i%ALIGN_OFF; 41.424 + errn += verify("test_cp_alndst_overlap: a1", i, a1.get(i), v); 41.425 + } 41.426 + for (int i=0; i<ALIGN_OFF; i++) { 41.427 + a1.set((i+ALIGN_OFF), -1); 41.428 + } 41.429 + test_cp_alnsrc(a1, a1); 41.430 + for (int i=0; i<ALIGN_OFF; i++) { 41.431 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1.get(i), -1); 41.432 + } 41.433 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 41.434 + int v = i%ALIGN_OFF; 41.435 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1.get(i), v); 41.436 + } 41.437 + for (int i=0; i<ARRLEN; i++) { 41.438 + a1.set(i, -1); 41.439 + } 41.440 + test_2ci_aln(a1, a1); 41.441 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 41.442 + errn += verify("test_2ci_aln_overlap: a1", i, a1.get(i), -103); 41.443 + } 41.444 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 41.445 + errn += verify("test_2ci_aln_overlap: a1", i, a1.get(i), -123); 41.446 + } 41.447 + for (int i=0; i<ARRLEN; i++) { 41.448 + a1.set(i, -1); 41.449 + } 41.450 + test_2vi_aln(a1, a1, 123, 103); 41.451 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 41.452 + errn += verify("test_2vi_aln_overlap: a1", i, a1.get(i), 123); 41.453 + } 41.454 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 41.455 + errn += verify("test_2vi_aln_overlap: a1", i, a1.get(i), 103); 41.456 + } 41.457 + 41.458 + // Reset for unaligned overlap initialization 41.459 + for (int i=0; i<UNALIGN_OFF; i++) { 41.460 + a1.set(i, i); 41.461 + } 41.462 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 41.463 + a1.set(i, -1); 41.464 + } 41.465 + test_cp_unalndst(a1, a1); 41.466 + for (int i=0; i<ARRLEN; i++) { 41.467 + int v = i%UNALIGN_OFF; 41.468 + errn += verify("test_cp_unalndst_overlap: a1", i, a1.get(i), v); 41.469 + } 41.470 + for (int i=0; i<UNALIGN_OFF; i++) { 41.471 + a1.set((i+UNALIGN_OFF), -1); 41.472 + } 41.473 + test_cp_unalnsrc(a1, a1); 41.474 + for (int i=0; i<UNALIGN_OFF; i++) { 41.475 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1.get(i), -1); 41.476 + } 41.477 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 41.478 + int v = i%UNALIGN_OFF; 41.479 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1.get(i), v); 41.480 + } 41.481 + for (int i=0; i<ARRLEN; i++) { 41.482 + a1.set(i, -1); 41.483 + } 41.484 + test_2ci_unaln(a1, a1); 41.485 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 41.486 + errn += verify("test_2ci_unaln_overlap: a1", i, a1.get(i), -103); 41.487 + } 41.488 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 41.489 + errn += verify("test_2ci_unaln_overlap: a1", i, a1.get(i), -123); 41.490 + } 41.491 + for (int i=0; i<ARRLEN; i++) { 41.492 + a1.set(i, -1); 41.493 + } 41.494 + test_2vi_unaln(a1, a1, 123, 103); 41.495 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 41.496 + errn += verify("test_2vi_unaln_overlap: a1", i, a1.get(i), 123); 41.497 + } 41.498 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 41.499 + errn += verify("test_2vi_unaln_overlap: a1", i, a1.get(i), 103); 41.500 + } 41.501 + 41.502 + } 41.503 + 41.504 + if (errn > 0 || test_only) 41.505 + return errn; 41.506 + 41.507 + // Initialize 41.508 + for (int i=0; i<ARRLEN; i++) { 41.509 + a1.set(i, -1); 41.510 + a2.set(i, -1); 41.511 + } 41.512 + System.out.println("Time"); 41.513 + long start, end; 41.514 + start = System.currentTimeMillis(); 41.515 + for (int i=0; i<ITERS; i++) { 41.516 + test_ci(a1); 41.517 + } 41.518 + end = System.currentTimeMillis(); 41.519 + System.out.println("test_ci: " + (end - start)); 41.520 + start = System.currentTimeMillis(); 41.521 + for (int i=0; i<ITERS; i++) { 41.522 + test_vi(a2, 123, -1); 41.523 + } 41.524 + end = System.currentTimeMillis(); 41.525 + System.out.println("test_vi: " + (end - start)); 41.526 + start = System.currentTimeMillis(); 41.527 + for (int i=0; i<ITERS; i++) { 41.528 + test_cp(a1, a2); 41.529 + } 41.530 + end = System.currentTimeMillis(); 41.531 + System.out.println("test_cp: " + (end - start)); 41.532 + start = System.currentTimeMillis(); 41.533 + for (int i=0; i<ITERS; i++) { 41.534 + test_2ci(a1, a2); 41.535 + } 41.536 + end = System.currentTimeMillis(); 41.537 + System.out.println("test_2ci: " + (end - start)); 41.538 + start = System.currentTimeMillis(); 41.539 + for (int i=0; i<ITERS; i++) { 41.540 + test_2vi(a1, a2, 123, 103); 41.541 + } 41.542 + end = System.currentTimeMillis(); 41.543 + System.out.println("test_2vi: " + (end - start)); 41.544 + 41.545 + start = System.currentTimeMillis(); 41.546 + for (int i=0; i<ITERS; i++) { 41.547 + test_ci_neg(a1, 123); 41.548 + } 41.549 + end = System.currentTimeMillis(); 41.550 + System.out.println("test_ci_neg: " + (end - start)); 41.551 + start = System.currentTimeMillis(); 41.552 + for (int i=0; i<ITERS; i++) { 41.553 + test_vi_neg(a2, 123, 103); 41.554 + } 41.555 + end = System.currentTimeMillis(); 41.556 + System.out.println("test_vi_neg: " + (end - start)); 41.557 + start = System.currentTimeMillis(); 41.558 + for (int i=0; i<ITERS; i++) { 41.559 + test_cp_neg(a1, a2); 41.560 + } 41.561 + end = System.currentTimeMillis(); 41.562 + System.out.println("test_cp_neg: " + (end - start)); 41.563 + start = System.currentTimeMillis(); 41.564 + for (int i=0; i<ITERS; i++) { 41.565 + test_2ci_neg(a1, a2); 41.566 + } 41.567 + end = System.currentTimeMillis(); 41.568 + System.out.println("test_2ci_neg: " + (end - start)); 41.569 + start = System.currentTimeMillis(); 41.570 + for (int i=0; i<ITERS; i++) { 41.571 + test_2vi_neg(a1, a2, 123, 103); 41.572 + } 41.573 + end = System.currentTimeMillis(); 41.574 + System.out.println("test_2vi_neg: " + (end - start)); 41.575 + 41.576 + start = System.currentTimeMillis(); 41.577 + for (int i=0; i<ITERS; i++) { 41.578 + test_ci_oppos(a1, 123); 41.579 + } 41.580 + end = System.currentTimeMillis(); 41.581 + System.out.println("test_ci_oppos: " + (end - start)); 41.582 + start = System.currentTimeMillis(); 41.583 + for (int i=0; i<ITERS; i++) { 41.584 + test_vi_oppos(a2, 123, 103); 41.585 + } 41.586 + end = System.currentTimeMillis(); 41.587 + System.out.println("test_vi_oppos: " + (end - start)); 41.588 + start = System.currentTimeMillis(); 41.589 + for (int i=0; i<ITERS; i++) { 41.590 + test_cp_oppos(a1, a2); 41.591 + } 41.592 + end = System.currentTimeMillis(); 41.593 + System.out.println("test_cp_oppos: " + (end - start)); 41.594 + start = System.currentTimeMillis(); 41.595 + for (int i=0; i<ITERS; i++) { 41.596 + test_2ci_oppos(a1, a2); 41.597 + } 41.598 + end = System.currentTimeMillis(); 41.599 + System.out.println("test_2ci_oppos: " + (end - start)); 41.600 + start = System.currentTimeMillis(); 41.601 + for (int i=0; i<ITERS; i++) { 41.602 + test_2vi_oppos(a1, a2, 123, 103); 41.603 + } 41.604 + end = System.currentTimeMillis(); 41.605 + System.out.println("test_2vi_oppos: " + (end - start)); 41.606 + 41.607 + start = System.currentTimeMillis(); 41.608 + for (int i=0; i<ITERS; i++) { 41.609 + test_ci_off(a1, 123); 41.610 + } 41.611 + end = System.currentTimeMillis(); 41.612 + System.out.println("test_ci_off: " + (end - start)); 41.613 + start = System.currentTimeMillis(); 41.614 + for (int i=0; i<ITERS; i++) { 41.615 + test_vi_off(a2, 123, 103); 41.616 + } 41.617 + end = System.currentTimeMillis(); 41.618 + System.out.println("test_vi_off: " + (end - start)); 41.619 + start = System.currentTimeMillis(); 41.620 + for (int i=0; i<ITERS; i++) { 41.621 + test_cp_off(a1, a2); 41.622 + } 41.623 + end = System.currentTimeMillis(); 41.624 + System.out.println("test_cp_off: " + (end - start)); 41.625 + start = System.currentTimeMillis(); 41.626 + for (int i=0; i<ITERS; i++) { 41.627 + test_2ci_off(a1, a2); 41.628 + } 41.629 + end = System.currentTimeMillis(); 41.630 + System.out.println("test_2ci_off: " + (end - start)); 41.631 + start = System.currentTimeMillis(); 41.632 + for (int i=0; i<ITERS; i++) { 41.633 + test_2vi_off(a1, a2, 123, 103); 41.634 + } 41.635 + end = System.currentTimeMillis(); 41.636 + System.out.println("test_2vi_off: " + (end - start)); 41.637 + 41.638 + start = System.currentTimeMillis(); 41.639 + for (int i=0; i<ITERS; i++) { 41.640 + test_ci_inv(a1, OFFSET, 123); 41.641 + } 41.642 + end = System.currentTimeMillis(); 41.643 + System.out.println("test_ci_inv: " + (end - start)); 41.644 + start = System.currentTimeMillis(); 41.645 + for (int i=0; i<ITERS; i++) { 41.646 + test_vi_inv(a2, 123, OFFSET, 103); 41.647 + } 41.648 + end = System.currentTimeMillis(); 41.649 + System.out.println("test_vi_inv: " + (end - start)); 41.650 + start = System.currentTimeMillis(); 41.651 + for (int i=0; i<ITERS; i++) { 41.652 + test_cp_inv(a1, a2, OFFSET); 41.653 + } 41.654 + end = System.currentTimeMillis(); 41.655 + System.out.println("test_cp_inv: " + (end - start)); 41.656 + start = System.currentTimeMillis(); 41.657 + for (int i=0; i<ITERS; i++) { 41.658 + test_2ci_inv(a1, a2, OFFSET); 41.659 + } 41.660 + end = System.currentTimeMillis(); 41.661 + System.out.println("test_2ci_inv: " + (end - start)); 41.662 + start = System.currentTimeMillis(); 41.663 + for (int i=0; i<ITERS; i++) { 41.664 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 41.665 + } 41.666 + end = System.currentTimeMillis(); 41.667 + System.out.println("test_2vi_inv: " + (end - start)); 41.668 + 41.669 + start = System.currentTimeMillis(); 41.670 + for (int i=0; i<ITERS; i++) { 41.671 + test_ci_scl(a1, 123); 41.672 + } 41.673 + end = System.currentTimeMillis(); 41.674 + System.out.println("test_ci_scl: " + (end - start)); 41.675 + start = System.currentTimeMillis(); 41.676 + for (int i=0; i<ITERS; i++) { 41.677 + test_vi_scl(a2, 123, 103); 41.678 + } 41.679 + end = System.currentTimeMillis(); 41.680 + System.out.println("test_vi_scl: " + (end - start)); 41.681 + start = System.currentTimeMillis(); 41.682 + for (int i=0; i<ITERS; i++) { 41.683 + test_cp_scl(a1, a2); 41.684 + } 41.685 + end = System.currentTimeMillis(); 41.686 + System.out.println("test_cp_scl: " + (end - start)); 41.687 + start = System.currentTimeMillis(); 41.688 + for (int i=0; i<ITERS; i++) { 41.689 + test_2ci_scl(a1, a2); 41.690 + } 41.691 + end = System.currentTimeMillis(); 41.692 + System.out.println("test_2ci_scl: " + (end - start)); 41.693 + start = System.currentTimeMillis(); 41.694 + for (int i=0; i<ITERS; i++) { 41.695 + test_2vi_scl(a1, a2, 123, 103); 41.696 + } 41.697 + end = System.currentTimeMillis(); 41.698 + System.out.println("test_2vi_scl: " + (end - start)); 41.699 + 41.700 + start = System.currentTimeMillis(); 41.701 + for (int i=0; i<ITERS; i++) { 41.702 + test_cp_alndst(a1, a2); 41.703 + } 41.704 + end = System.currentTimeMillis(); 41.705 + System.out.println("test_cp_alndst: " + (end - start)); 41.706 + start = System.currentTimeMillis(); 41.707 + for (int i=0; i<ITERS; i++) { 41.708 + test_cp_alnsrc(a1, a2); 41.709 + } 41.710 + end = System.currentTimeMillis(); 41.711 + System.out.println("test_cp_alnsrc: " + (end - start)); 41.712 + start = System.currentTimeMillis(); 41.713 + for (int i=0; i<ITERS; i++) { 41.714 + test_2ci_aln(a1, a2); 41.715 + } 41.716 + end = System.currentTimeMillis(); 41.717 + System.out.println("test_2ci_aln: " + (end - start)); 41.718 + start = System.currentTimeMillis(); 41.719 + for (int i=0; i<ITERS; i++) { 41.720 + test_2vi_aln(a1, a2, 123, 103); 41.721 + } 41.722 + end = System.currentTimeMillis(); 41.723 + System.out.println("test_2vi_aln: " + (end - start)); 41.724 + 41.725 + start = System.currentTimeMillis(); 41.726 + for (int i=0; i<ITERS; i++) { 41.727 + test_cp_unalndst(a1, a2); 41.728 + } 41.729 + end = System.currentTimeMillis(); 41.730 + System.out.println("test_cp_unalndst: " + (end - start)); 41.731 + start = System.currentTimeMillis(); 41.732 + for (int i=0; i<ITERS; i++) { 41.733 + test_cp_unalnsrc(a1, a2); 41.734 + } 41.735 + end = System.currentTimeMillis(); 41.736 + System.out.println("test_cp_unalnsrc: " + (end - start)); 41.737 + start = System.currentTimeMillis(); 41.738 + for (int i=0; i<ITERS; i++) { 41.739 + test_2ci_unaln(a1, a2); 41.740 + } 41.741 + end = System.currentTimeMillis(); 41.742 + System.out.println("test_2ci_unaln: " + (end - start)); 41.743 + start = System.currentTimeMillis(); 41.744 + for (int i=0; i<ITERS; i++) { 41.745 + test_2vi_unaln(a1, a2, 123, 103); 41.746 + } 41.747 + end = System.currentTimeMillis(); 41.748 + System.out.println("test_2vi_unaln: " + (end - start)); 41.749 + 41.750 + return errn; 41.751 + } 41.752 + 41.753 + static void test_ci(AtomicIntegerArray a) { 41.754 + for (int i = 0; i < ARRLEN; i+=1) { 41.755 + a.set(i, -123); 41.756 + } 41.757 + } 41.758 + static void test_vi(AtomicIntegerArray a, int b, int old) { 41.759 + for (int i = 0; i < ARRLEN; i+=1) { 41.760 + a.set(i, b); 41.761 + } 41.762 + } 41.763 + static void test_cp(AtomicIntegerArray a, AtomicIntegerArray b) { 41.764 + for (int i = 0; i < ARRLEN; i+=1) { 41.765 + a.set(i, b.get(i)); 41.766 + } 41.767 + } 41.768 + static void test_2ci(AtomicIntegerArray a, AtomicIntegerArray b) { 41.769 + for (int i = 0; i < ARRLEN; i+=1) { 41.770 + a.set(i, -123); 41.771 + b.set(i, -103); 41.772 + } 41.773 + } 41.774 + static void test_2vi(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 41.775 + for (int i = 0; i < ARRLEN; i+=1) { 41.776 + a.set(i, c); 41.777 + b.set(i, d); 41.778 + } 41.779 + } 41.780 + static void test_ci_neg(AtomicIntegerArray a, int old) { 41.781 + for (int i = ARRLEN-1; i >= 0; i-=1) { 41.782 + a.set(i,-123); 41.783 + } 41.784 + } 41.785 + static void test_vi_neg(AtomicIntegerArray a, int b, int old) { 41.786 + for (int i = ARRLEN-1; i >= 0; i-=1) { 41.787 + a.set(i, b); 41.788 + } 41.789 + } 41.790 + static void test_cp_neg(AtomicIntegerArray a, AtomicIntegerArray b) { 41.791 + for (int i = ARRLEN-1; i >= 0; i-=1) { 41.792 + a.set(i, b.get(i)); 41.793 + } 41.794 + } 41.795 + static void test_2ci_neg(AtomicIntegerArray a, AtomicIntegerArray b) { 41.796 + for (int i = ARRLEN-1; i >= 0; i-=1) { 41.797 + a.set(i, -123); 41.798 + b.set(i, -103); 41.799 + } 41.800 + } 41.801 + static void test_2vi_neg(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 41.802 + for (int i = ARRLEN-1; i >= 0; i-=1) { 41.803 + a.set(i, c); 41.804 + b.set(i, d); 41.805 + } 41.806 + } 41.807 + static void test_ci_oppos(AtomicIntegerArray a, int old) { 41.808 + int limit = ARRLEN-1; 41.809 + for (int i = 0; i < ARRLEN; i+=1) { 41.810 + a.set((limit-i), -123); 41.811 + } 41.812 + } 41.813 + static void test_vi_oppos(AtomicIntegerArray a, int b, int old) { 41.814 + int limit = ARRLEN-1; 41.815 + for (int i = limit; i >= 0; i-=1) { 41.816 + a.set((limit-i), b); 41.817 + } 41.818 + } 41.819 + static void test_cp_oppos(AtomicIntegerArray a, AtomicIntegerArray b) { 41.820 + int limit = ARRLEN-1; 41.821 + for (int i = 0; i < ARRLEN; i+=1) { 41.822 + a.set(i, b.get(limit-i)); 41.823 + } 41.824 + } 41.825 + static void test_2ci_oppos(AtomicIntegerArray a, AtomicIntegerArray b) { 41.826 + int limit = ARRLEN-1; 41.827 + for (int i = 0; i < ARRLEN; i+=1) { 41.828 + a.set((limit-i), -123); 41.829 + b.set(i, -103); 41.830 + } 41.831 + } 41.832 + static void test_2vi_oppos(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 41.833 + int limit = ARRLEN-1; 41.834 + for (int i = limit; i >= 0; i-=1) { 41.835 + a.set(i, c); 41.836 + b.set((limit-i), d); 41.837 + } 41.838 + } 41.839 + static void test_ci_off(AtomicIntegerArray a, int old) { 41.840 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 41.841 + a.set((i+OFFSET), -123); 41.842 + } 41.843 + } 41.844 + static void test_vi_off(AtomicIntegerArray a, int b, int old) { 41.845 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 41.846 + a.set((i+OFFSET), b); 41.847 + } 41.848 + } 41.849 + static void test_cp_off(AtomicIntegerArray a, AtomicIntegerArray b) { 41.850 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 41.851 + a.set((i+OFFSET), b.get(i+OFFSET)); 41.852 + } 41.853 + } 41.854 + static void test_2ci_off(AtomicIntegerArray a, AtomicIntegerArray b) { 41.855 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 41.856 + a.set((i+OFFSET), -123); 41.857 + b.set((i+OFFSET), -103); 41.858 + } 41.859 + } 41.860 + static void test_2vi_off(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 41.861 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 41.862 + a.set((i+OFFSET), c); 41.863 + b.set((i+OFFSET), d); 41.864 + } 41.865 + } 41.866 + static void test_ci_inv(AtomicIntegerArray a, int k, int old) { 41.867 + for (int i = 0; i < ARRLEN-k; i+=1) { 41.868 + a.set((i+k),-123); 41.869 + } 41.870 + } 41.871 + static void test_vi_inv(AtomicIntegerArray a, int b, int k, int old) { 41.872 + for (int i = 0; i < ARRLEN-k; i+=1) { 41.873 + a.set((i+k), b); 41.874 + } 41.875 + } 41.876 + static void test_cp_inv(AtomicIntegerArray a, AtomicIntegerArray b, int k) { 41.877 + for (int i = 0; i < ARRLEN-k; i+=1) { 41.878 + a.set((i+k), b.get(i+k)); 41.879 + } 41.880 + } 41.881 + static void test_2ci_inv(AtomicIntegerArray a, AtomicIntegerArray b, int k) { 41.882 + for (int i = 0; i < ARRLEN-k; i+=1) { 41.883 + a.set((i+k), -123); 41.884 + b.set((i+k), -103); 41.885 + } 41.886 + } 41.887 + static void test_2vi_inv(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d, int k) { 41.888 + for (int i = 0; i < ARRLEN-k; i+=1) { 41.889 + a.set((i+k), c); 41.890 + b.set((i+k), d); 41.891 + } 41.892 + } 41.893 + static void test_ci_scl(AtomicIntegerArray a, int old) { 41.894 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 41.895 + a.set((i*SCALE), -123); 41.896 + } 41.897 + } 41.898 + static void test_vi_scl(AtomicIntegerArray a, int b, int old) { 41.899 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 41.900 + a.set((i*SCALE), b); 41.901 + } 41.902 + } 41.903 + static void test_cp_scl(AtomicIntegerArray a, AtomicIntegerArray b) { 41.904 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 41.905 + a.set((i*SCALE), b.get(i*SCALE)); 41.906 + } 41.907 + } 41.908 + static void test_2ci_scl(AtomicIntegerArray a, AtomicIntegerArray b) { 41.909 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 41.910 + a.set((i*SCALE), -123); 41.911 + b.set((i*SCALE), -103); 41.912 + } 41.913 + } 41.914 + static void test_2vi_scl(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 41.915 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 41.916 + a.set((i*SCALE), c); 41.917 + b.set((i*SCALE), d); 41.918 + } 41.919 + } 41.920 + static void test_cp_alndst(AtomicIntegerArray a, AtomicIntegerArray b) { 41.921 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 41.922 + a.set((i+ALIGN_OFF), b.get(i)); 41.923 + } 41.924 + } 41.925 + static void test_cp_alnsrc(AtomicIntegerArray a, AtomicIntegerArray b) { 41.926 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 41.927 + a.set(i, b.get(i+ALIGN_OFF)); 41.928 + } 41.929 + } 41.930 + static void test_2ci_aln(AtomicIntegerArray a, AtomicIntegerArray b) { 41.931 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 41.932 + a.set((i+ALIGN_OFF), -123); 41.933 + b.set(i, -103); 41.934 + } 41.935 + } 41.936 + static void test_2vi_aln(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 41.937 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 41.938 + a.set(i, c); 41.939 + b.set((i+ALIGN_OFF), d); 41.940 + } 41.941 + } 41.942 + static void test_cp_unalndst(AtomicIntegerArray a, AtomicIntegerArray b) { 41.943 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 41.944 + a.set((i+UNALIGN_OFF), b.get(i)); 41.945 + } 41.946 + } 41.947 + static void test_cp_unalnsrc(AtomicIntegerArray a, AtomicIntegerArray b) { 41.948 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 41.949 + a.set(i, b.get(i+UNALIGN_OFF)); 41.950 + } 41.951 + } 41.952 + static void test_2ci_unaln(AtomicIntegerArray a, AtomicIntegerArray b) { 41.953 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 41.954 + a.set((i+UNALIGN_OFF), -123); 41.955 + b.set(i, -103); 41.956 + } 41.957 + } 41.958 + static void test_2vi_unaln(AtomicIntegerArray a, AtomicIntegerArray b, int c, int d) { 41.959 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 41.960 + a.set(i, c); 41.961 + b.set((i+UNALIGN_OFF), d); 41.962 + } 41.963 + } 41.964 + 41.965 + static int verify(String text, int i, int elem, int val) { 41.966 + if (elem != val) { 41.967 + System.err.println(text + "[" + i + "] = " + elem + " != " + val); 41.968 + return 1; 41.969 + } 41.970 + return 0; 41.971 + } 41.972 +}
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 42.2 +++ b/test/compiler/8004867/TestIntUnsafeCAS.java Tue Feb 26 11:52:06 2013 +0100 42.3 @@ -0,0 +1,998 @@ 42.4 +/* 42.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 42.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 42.7 + * 42.8 + * This code is free software; you can redistribute it and/or modify it 42.9 + * under the terms of the GNU General Public License version 2 only, as 42.10 + * published by the Free Software Foundation. 42.11 + * 42.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 42.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 42.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 42.15 + * version 2 for more details (a copy is included in the LICENSE file that 42.16 + * accompanied this code). 42.17 + * 42.18 + * You should have received a copy of the GNU General Public License version 42.19 + * 2 along with this work; if not, write to the Free Software Foundation, 42.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 42.21 + * 42.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 42.23 + * or visit www.oracle.com if you need additional information or have any 42.24 + * questions. 42.25 + * 42.26 + */ 42.27 + 42.28 +/** 42.29 + * @test 42.30 + * @bug 8004867 42.31 + * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" 42.32 + * 42.33 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeCAS 42.34 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeCAS 42.35 + */ 42.36 + 42.37 +import sun.misc.Unsafe; 42.38 +import java.lang.reflect.*; 42.39 + 42.40 +public class TestIntUnsafeCAS { 42.41 + private static final int ARRLEN = 97; 42.42 + private static final int ITERS = 11000; 42.43 + private static final int OFFSET = 3; 42.44 + private static final int SCALE = 2; 42.45 + private static final int ALIGN_OFF = 8; 42.46 + private static final int UNALIGN_OFF = 5; 42.47 + 42.48 + private static final Unsafe unsafe; 42.49 + private static final int BASE; 42.50 + static { 42.51 + try { 42.52 + Class c = TestIntUnsafeCAS.class.getClassLoader().loadClass("sun.misc.Unsafe"); 42.53 + Field f = c.getDeclaredField("theUnsafe"); 42.54 + f.setAccessible(true); 42.55 + unsafe = (Unsafe)f.get(c); 42.56 + BASE = unsafe.arrayBaseOffset(int[].class); 42.57 + } catch (Exception e) { 42.58 + InternalError err = new InternalError(); 42.59 + err.initCause(e); 42.60 + throw err; 42.61 + } 42.62 + } 42.63 + 42.64 + public static void main(String args[]) { 42.65 + System.out.println("Testing Integer array unsafe CAS operations"); 42.66 + int errn = test(false); 42.67 + if (errn > 0) { 42.68 + System.err.println("FAILED: " + errn + " errors"); 42.69 + System.exit(97); 42.70 + } 42.71 + System.out.println("PASSED"); 42.72 + } 42.73 + 42.74 + static int test(boolean test_only) { 42.75 + int[] a1 = new int[ARRLEN]; 42.76 + int[] a2 = new int[ARRLEN]; 42.77 + // Initialize 42.78 + for (int i=0; i<ARRLEN; i++) { 42.79 + a1[i] = -1; 42.80 + a2[i] = -1; 42.81 + } 42.82 + System.out.println("Warmup"); 42.83 + for (int i=0; i<ITERS; i++) { 42.84 + test_ci(a1); 42.85 + test_vi(a2, 123, -1); 42.86 + test_cp(a1, a2); 42.87 + test_2ci(a1, a2); 42.88 + test_2vi(a1, a2, 123, 103); 42.89 + test_ci_neg(a1, 123); 42.90 + test_vi_neg(a2, 123, 103); 42.91 + test_cp_neg(a1, a2); 42.92 + test_2ci_neg(a1, a2); 42.93 + test_2vi_neg(a1, a2, 123, 103); 42.94 + test_ci_oppos(a1, 123); 42.95 + test_vi_oppos(a2, 123, 103); 42.96 + test_cp_oppos(a1, a2); 42.97 + test_2ci_oppos(a1, a2); 42.98 + test_2vi_oppos(a1, a2, 123, 103); 42.99 + test_ci_off(a1, 123); 42.100 + test_vi_off(a2, 123, 103); 42.101 + test_cp_off(a1, a2); 42.102 + test_2ci_off(a1, a2); 42.103 + test_2vi_off(a1, a2, 123, 103); 42.104 + test_ci_inv(a1, OFFSET, 123); 42.105 + test_vi_inv(a2, 123, OFFSET, 103); 42.106 + test_cp_inv(a1, a2, OFFSET); 42.107 + test_2ci_inv(a1, a2, OFFSET); 42.108 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 42.109 + test_ci_scl(a1, 123); 42.110 + test_vi_scl(a2, 123, 103); 42.111 + test_cp_scl(a1, a2); 42.112 + test_2ci_scl(a1, a2); 42.113 + test_2vi_scl(a1, a2, 123, 103); 42.114 + test_cp_alndst(a1, a2); 42.115 + test_cp_alnsrc(a1, a2); 42.116 + test_2ci_aln(a1, a2); 42.117 + test_2vi_aln(a1, a2, 123, 103); 42.118 + test_cp_unalndst(a1, a2); 42.119 + test_cp_unalnsrc(a1, a2); 42.120 + test_2ci_unaln(a1, a2); 42.121 + test_2vi_unaln(a1, a2, 123, 103); 42.122 + } 42.123 + // Initialize 42.124 + for (int i=0; i<ARRLEN; i++) { 42.125 + a1[i] = -1; 42.126 + a2[i] = -1; 42.127 + } 42.128 + // Test and verify results 42.129 + System.out.println("Verification"); 42.130 + int errn = 0; 42.131 + { 42.132 + test_ci(a1); 42.133 + for (int i=0; i<ARRLEN; i++) { 42.134 + errn += verify("test_ci: a1", i, a1[i], -123); 42.135 + } 42.136 + test_vi(a2, 123, -1); 42.137 + for (int i=0; i<ARRLEN; i++) { 42.138 + errn += verify("test_vi: a2", i, a2[i], 123); 42.139 + } 42.140 + test_cp(a1, a2); 42.141 + for (int i=0; i<ARRLEN; i++) { 42.142 + errn += verify("test_cp: a1", i, a1[i], 123); 42.143 + } 42.144 + test_2ci(a1, a2); 42.145 + for (int i=0; i<ARRLEN; i++) { 42.146 + errn += verify("test_2ci: a1", i, a1[i], -123); 42.147 + errn += verify("test_2ci: a2", i, a2[i], -103); 42.148 + } 42.149 + test_2vi(a1, a2, 123, 103); 42.150 + for (int i=0; i<ARRLEN; i++) { 42.151 + errn += verify("test_2vi: a1", i, a1[i], 123); 42.152 + errn += verify("test_2vi: a2", i, a2[i], 103); 42.153 + } 42.154 + // Reset for negative stride 42.155 + for (int i=0; i<ARRLEN; i++) { 42.156 + a1[i] = -1; 42.157 + a2[i] = -1; 42.158 + } 42.159 + test_ci_neg(a1, -1); 42.160 + for (int i=0; i<ARRLEN; i++) { 42.161 + errn += verify("test_ci_neg: a1", i, a1[i], -123); 42.162 + } 42.163 + test_vi_neg(a2, 123, -1); 42.164 + for (int i=0; i<ARRLEN; i++) { 42.165 + errn += verify("test_vi_neg: a2", i, a2[i], 123); 42.166 + } 42.167 + test_cp_neg(a1, a2); 42.168 + for (int i=0; i<ARRLEN; i++) { 42.169 + errn += verify("test_cp_neg: a1", i, a1[i], 123); 42.170 + } 42.171 + test_2ci_neg(a1, a2); 42.172 + for (int i=0; i<ARRLEN; i++) { 42.173 + errn += verify("test_2ci_neg: a1", i, a1[i], -123); 42.174 + errn += verify("test_2ci_neg: a2", i, a2[i], -103); 42.175 + } 42.176 + test_2vi_neg(a1, a2, 123, 103); 42.177 + for (int i=0; i<ARRLEN; i++) { 42.178 + errn += verify("test_2vi_neg: a1", i, a1[i], 123); 42.179 + errn += verify("test_2vi_neg: a2", i, a2[i], 103); 42.180 + } 42.181 + // Reset for opposite stride 42.182 + for (int i=0; i<ARRLEN; i++) { 42.183 + a1[i] = -1; 42.184 + a2[i] = -1; 42.185 + } 42.186 + test_ci_oppos(a1, -1); 42.187 + for (int i=0; i<ARRLEN; i++) { 42.188 + errn += verify("test_ci_oppos: a1", i, a1[i], -123); 42.189 + } 42.190 + test_vi_oppos(a2, 123, -1); 42.191 + for (int i=0; i<ARRLEN; i++) { 42.192 + errn += verify("test_vi_oppos: a2", i, a2[i], 123); 42.193 + } 42.194 + test_cp_oppos(a1, a2); 42.195 + for (int i=0; i<ARRLEN; i++) { 42.196 + errn += verify("test_cp_oppos: a1", i, a1[i], 123); 42.197 + } 42.198 + test_2ci_oppos(a1, a2); 42.199 + for (int i=0; i<ARRLEN; i++) { 42.200 + errn += verify("test_2ci_oppos: a1", i, a1[i], -123); 42.201 + errn += verify("test_2ci_oppos: a2", i, a2[i], -103); 42.202 + } 42.203 + test_2vi_oppos(a1, a2, 123, 103); 42.204 + for (int i=0; i<ARRLEN; i++) { 42.205 + errn += verify("test_2vi_oppos: a1", i, a1[i], 123); 42.206 + errn += verify("test_2vi_oppos: a2", i, a2[i], 103); 42.207 + } 42.208 + // Reset for indexing with offset 42.209 + for (int i=0; i<ARRLEN; i++) { 42.210 + a1[i] = -1; 42.211 + a2[i] = -1; 42.212 + } 42.213 + test_ci_off(a1, -1); 42.214 + for (int i=OFFSET; i<ARRLEN; i++) { 42.215 + errn += verify("test_ci_off: a1", i, a1[i], -123); 42.216 + } 42.217 + test_vi_off(a2, 123, -1); 42.218 + for (int i=OFFSET; i<ARRLEN; i++) { 42.219 + errn += verify("test_vi_off: a2", i, a2[i], 123); 42.220 + } 42.221 + test_cp_off(a1, a2); 42.222 + for (int i=OFFSET; i<ARRLEN; i++) { 42.223 + errn += verify("test_cp_off: a1", i, a1[i], 123); 42.224 + } 42.225 + test_2ci_off(a1, a2); 42.226 + for (int i=OFFSET; i<ARRLEN; i++) { 42.227 + errn += verify("test_2ci_off: a1", i, a1[i], -123); 42.228 + errn += verify("test_2ci_off: a2", i, a2[i], -103); 42.229 + } 42.230 + test_2vi_off(a1, a2, 123, 103); 42.231 + for (int i=OFFSET; i<ARRLEN; i++) { 42.232 + errn += verify("test_2vi_off: a1", i, a1[i], 123); 42.233 + errn += verify("test_2vi_off: a2", i, a2[i], 103); 42.234 + } 42.235 + for (int i=0; i<OFFSET; i++) { 42.236 + errn += verify("test_2vi_off: a1", i, a1[i], -1); 42.237 + errn += verify("test_2vi_off: a2", i, a2[i], -1); 42.238 + } 42.239 + // Reset for indexing with invariant offset 42.240 + for (int i=0; i<ARRLEN; i++) { 42.241 + a1[i] = -1; 42.242 + a2[i] = -1; 42.243 + } 42.244 + test_ci_inv(a1, OFFSET, -1); 42.245 + for (int i=OFFSET; i<ARRLEN; i++) { 42.246 + errn += verify("test_ci_inv: a1", i, a1[i], -123); 42.247 + } 42.248 + test_vi_inv(a2, 123, OFFSET, -1); 42.249 + for (int i=OFFSET; i<ARRLEN; i++) { 42.250 + errn += verify("test_vi_inv: a2", i, a2[i], 123); 42.251 + } 42.252 + test_cp_inv(a1, a2, OFFSET); 42.253 + for (int i=OFFSET; i<ARRLEN; i++) { 42.254 + errn += verify("test_cp_inv: a1", i, a1[i], 123); 42.255 + } 42.256 + test_2ci_inv(a1, a2, OFFSET); 42.257 + for (int i=OFFSET; i<ARRLEN; i++) { 42.258 + errn += verify("test_2ci_inv: a1", i, a1[i], -123); 42.259 + errn += verify("test_2ci_inv: a2", i, a2[i], -103); 42.260 + } 42.261 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 42.262 + for (int i=OFFSET; i<ARRLEN; i++) { 42.263 + errn += verify("test_2vi_inv: a1", i, a1[i], 123); 42.264 + errn += verify("test_2vi_inv: a2", i, a2[i], 103); 42.265 + } 42.266 + for (int i=0; i<OFFSET; i++) { 42.267 + errn += verify("test_2vi_inv: a1", i, a1[i], -1); 42.268 + errn += verify("test_2vi_inv: a2", i, a2[i], -1); 42.269 + } 42.270 + // Reset for indexing with scale 42.271 + for (int i=0; i<ARRLEN; i++) { 42.272 + a1[i] = -1; 42.273 + a2[i] = -1; 42.274 + } 42.275 + test_ci_scl(a1, -1); 42.276 + for (int i=0; i<ARRLEN; i++) { 42.277 + int val = (i%SCALE != 0) ? -1 : -123; 42.278 + errn += verify("test_ci_scl: a1", i, a1[i], val); 42.279 + } 42.280 + test_vi_scl(a2, 123, -1); 42.281 + for (int i=0; i<ARRLEN; i++) { 42.282 + int val = (i%SCALE != 0) ? -1 : 123; 42.283 + errn += verify("test_vi_scl: a2", i, a2[i], val); 42.284 + } 42.285 + test_cp_scl(a1, a2); 42.286 + for (int i=0; i<ARRLEN; i++) { 42.287 + int val = (i%SCALE != 0) ? -1 : 123; 42.288 + errn += verify("test_cp_scl: a1", i, a1[i], val); 42.289 + } 42.290 + test_2ci_scl(a1, a2); 42.291 + for (int i=0; i<ARRLEN; i++) { 42.292 + if (i%SCALE != 0) { 42.293 + errn += verify("test_2ci_scl: a1", i, a1[i], -1); 42.294 + } else if (i*SCALE < ARRLEN) { 42.295 + errn += verify("test_2ci_scl: a1", i*SCALE, a1[i*SCALE], -123); 42.296 + } 42.297 + if (i%SCALE != 0) { 42.298 + errn += verify("test_2ci_scl: a2", i, a2[i], -1); 42.299 + } else if (i*SCALE < ARRLEN) { 42.300 + errn += verify("test_2ci_scl: a2", i*SCALE, a2[i*SCALE], -103); 42.301 + } 42.302 + } 42.303 + test_2vi_scl(a1, a2, 123, 103); 42.304 + for (int i=0; i<ARRLEN; i++) { 42.305 + if (i%SCALE != 0) { 42.306 + errn += verify("test_2vi_scl: a1", i, a1[i], -1); 42.307 + } else if (i*SCALE < ARRLEN) { 42.308 + errn += verify("test_2vi_scl: a1", i*SCALE, a1[i*SCALE], 123); 42.309 + } 42.310 + if (i%SCALE != 0) { 42.311 + errn += verify("test_2vi_scl: a2", i, a2[i], -1); 42.312 + } else if (i*SCALE < ARRLEN) { 42.313 + errn += verify("test_2vi_scl: a2", i*SCALE, a2[i*SCALE], 103); 42.314 + } 42.315 + } 42.316 + // Reset for 2 arrays with relative aligned offset 42.317 + for (int i=0; i<ARRLEN; i++) { 42.318 + a1[i] = -1; 42.319 + a2[i] = -1; 42.320 + } 42.321 + test_vi(a2, 123, -1); 42.322 + test_cp_alndst(a1, a2); 42.323 + for (int i=0; i<ALIGN_OFF; i++) { 42.324 + errn += verify("test_cp_alndst: a1", i, a1[i], -1); 42.325 + } 42.326 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 42.327 + errn += verify("test_cp_alndst: a1", i, a1[i], 123); 42.328 + } 42.329 + for (int i=0; i<ALIGN_OFF; i++) { 42.330 + a1[i] = 123; 42.331 + } 42.332 + test_vi(a2, -123, 123); 42.333 + test_cp_alnsrc(a1, a2); 42.334 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 42.335 + errn += verify("test_cp_alnsrc: a1", i, a1[i], -123); 42.336 + } 42.337 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 42.338 + errn += verify("test_cp_alnsrc: a1", i, a1[i], 123); 42.339 + } 42.340 + for (int i=0; i<ARRLEN; i++) { 42.341 + a1[i] = -1; 42.342 + a2[i] = -1; 42.343 + } 42.344 + test_2ci_aln(a1, a2); 42.345 + for (int i=0; i<ALIGN_OFF; i++) { 42.346 + errn += verify("test_2ci_aln: a1", i, a1[i], -1); 42.347 + } 42.348 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 42.349 + errn += verify("test_2ci_aln: a1", i, a1[i], -123); 42.350 + } 42.351 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 42.352 + errn += verify("test_2ci_aln: a2", i, a2[i], -103); 42.353 + } 42.354 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 42.355 + errn += verify("test_2ci_aln: a2", i, a2[i], -1); 42.356 + } 42.357 + for (int i=0; i<ARRLEN; i++) { 42.358 + a1[i] = -1; 42.359 + a2[i] = -1; 42.360 + } 42.361 + test_2vi_aln(a1, a2, 123, 103); 42.362 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 42.363 + errn += verify("test_2vi_aln: a1", i, a1[i], 123); 42.364 + } 42.365 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 42.366 + errn += verify("test_2vi_aln: a1", i, a1[i], -1); 42.367 + } 42.368 + for (int i=0; i<ALIGN_OFF; i++) { 42.369 + errn += verify("test_2vi_aln: a2", i, a2[i], -1); 42.370 + } 42.371 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 42.372 + errn += verify("test_2vi_aln: a2", i, a2[i], 103); 42.373 + } 42.374 + 42.375 + // Reset for 2 arrays with relative unaligned offset 42.376 + for (int i=0; i<ARRLEN; i++) { 42.377 + a1[i] = -1; 42.378 + a2[i] = -1; 42.379 + } 42.380 + test_vi(a2, 123, -1); 42.381 + test_cp_unalndst(a1, a2); 42.382 + for (int i=0; i<UNALIGN_OFF; i++) { 42.383 + errn += verify("test_cp_unalndst: a1", i, a1[i], -1); 42.384 + } 42.385 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 42.386 + errn += verify("test_cp_unalndst: a1", i, a1[i], 123); 42.387 + } 42.388 + test_vi(a2, -123, 123); 42.389 + test_cp_unalnsrc(a1, a2); 42.390 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 42.391 + errn += verify("test_cp_unalnsrc: a1", i, a1[i], -123); 42.392 + } 42.393 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 42.394 + errn += verify("test_cp_unalnsrc: a1", i, a1[i], 123); 42.395 + } 42.396 + for (int i=0; i<ARRLEN; i++) { 42.397 + a1[i] = -1; 42.398 + a2[i] = -1; 42.399 + } 42.400 + test_2ci_unaln(a1, a2); 42.401 + for (int i=0; i<UNALIGN_OFF; i++) { 42.402 + errn += verify("test_2ci_unaln: a1", i, a1[i], -1); 42.403 + } 42.404 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 42.405 + errn += verify("test_2ci_unaln: a1", i, a1[i], -123); 42.406 + } 42.407 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 42.408 + errn += verify("test_2ci_unaln: a2", i, a2[i], -103); 42.409 + } 42.410 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 42.411 + errn += verify("test_2ci_unaln: a2", i, a2[i], -1); 42.412 + } 42.413 + for (int i=0; i<ARRLEN; i++) { 42.414 + a1[i] = -1; 42.415 + a2[i] = -1; 42.416 + } 42.417 + test_2vi_unaln(a1, a2, 123, 103); 42.418 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 42.419 + errn += verify("test_2vi_unaln: a1", i, a1[i], 123); 42.420 + } 42.421 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 42.422 + errn += verify("test_2vi_unaln: a1", i, a1[i], -1); 42.423 + } 42.424 + for (int i=0; i<UNALIGN_OFF; i++) { 42.425 + errn += verify("test_2vi_unaln: a2", i, a2[i], -1); 42.426 + } 42.427 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 42.428 + errn += verify("test_2vi_unaln: a2", i, a2[i], 103); 42.429 + } 42.430 + 42.431 + // Reset for aligned overlap initialization 42.432 + for (int i=0; i<ALIGN_OFF; i++) { 42.433 + a1[i] = i; 42.434 + } 42.435 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 42.436 + a1[i] = -1; 42.437 + } 42.438 + test_cp_alndst(a1, a1); 42.439 + for (int i=0; i<ARRLEN; i++) { 42.440 + int v = i%ALIGN_OFF; 42.441 + errn += verify("test_cp_alndst_overlap: a1", i, a1[i], v); 42.442 + } 42.443 + for (int i=0; i<ALIGN_OFF; i++) { 42.444 + a1[i+ALIGN_OFF] = -1; 42.445 + } 42.446 + test_cp_alnsrc(a1, a1); 42.447 + for (int i=0; i<ALIGN_OFF; i++) { 42.448 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], -1); 42.449 + } 42.450 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 42.451 + int v = i%ALIGN_OFF; 42.452 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], v); 42.453 + } 42.454 + for (int i=0; i<ARRLEN; i++) { 42.455 + a1[i] = -1; 42.456 + } 42.457 + test_2ci_aln(a1, a1); 42.458 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 42.459 + errn += verify("test_2ci_aln_overlap: a1", i, a1[i], -103); 42.460 + } 42.461 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 42.462 + errn += verify("test_2ci_aln_overlap: a1", i, a1[i], -123); 42.463 + } 42.464 + for (int i=0; i<ARRLEN; i++) { 42.465 + a1[i] = -1; 42.466 + } 42.467 + test_2vi_aln(a1, a1, 123, 103); 42.468 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 42.469 + errn += verify("test_2vi_aln_overlap: a1", i, a1[i], 123); 42.470 + } 42.471 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 42.472 + errn += verify("test_2vi_aln_overlap: a1", i, a1[i], 103); 42.473 + } 42.474 + 42.475 + // Reset for unaligned overlap initialization 42.476 + for (int i=0; i<UNALIGN_OFF; i++) { 42.477 + a1[i] = i; 42.478 + } 42.479 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 42.480 + a1[i] = -1; 42.481 + } 42.482 + test_cp_unalndst(a1, a1); 42.483 + for (int i=0; i<ARRLEN; i++) { 42.484 + int v = i%UNALIGN_OFF; 42.485 + errn += verify("test_cp_unalndst_overlap: a1", i, a1[i], v); 42.486 + } 42.487 + for (int i=0; i<UNALIGN_OFF; i++) { 42.488 + a1[i+UNALIGN_OFF] = -1; 42.489 + } 42.490 + test_cp_unalnsrc(a1, a1); 42.491 + for (int i=0; i<UNALIGN_OFF; i++) { 42.492 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], -1); 42.493 + } 42.494 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 42.495 + int v = i%UNALIGN_OFF; 42.496 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], v); 42.497 + } 42.498 + for (int i=0; i<ARRLEN; i++) { 42.499 + a1[i] = -1; 42.500 + } 42.501 + test_2ci_unaln(a1, a1); 42.502 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 42.503 + errn += verify("test_2ci_unaln_overlap: a1", i, a1[i], -103); 42.504 + } 42.505 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 42.506 + errn += verify("test_2ci_unaln_overlap: a1", i, a1[i], -123); 42.507 + } 42.508 + for (int i=0; i<ARRLEN; i++) { 42.509 + a1[i] = -1; 42.510 + } 42.511 + test_2vi_unaln(a1, a1, 123, 103); 42.512 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 42.513 + errn += verify("test_2vi_unaln_overlap: a1", i, a1[i], 123); 42.514 + } 42.515 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 42.516 + errn += verify("test_2vi_unaln_overlap: a1", i, a1[i], 103); 42.517 + } 42.518 + 42.519 + } 42.520 + 42.521 + if (errn > 0 || test_only) 42.522 + return errn; 42.523 + 42.524 + // Initialize 42.525 + for (int i=0; i<ARRLEN; i++) { 42.526 + a1[i] = -1; 42.527 + a2[i] = -1; 42.528 + } 42.529 + System.out.println("Time"); 42.530 + long start, end; 42.531 + start = System.currentTimeMillis(); 42.532 + for (int i=0; i<ITERS; i++) { 42.533 + test_ci(a1); 42.534 + } 42.535 + end = System.currentTimeMillis(); 42.536 + System.out.println("test_ci: " + (end - start)); 42.537 + start = System.currentTimeMillis(); 42.538 + for (int i=0; i<ITERS; i++) { 42.539 + test_vi(a2, 123, -1); 42.540 + } 42.541 + end = System.currentTimeMillis(); 42.542 + System.out.println("test_vi: " + (end - start)); 42.543 + start = System.currentTimeMillis(); 42.544 + for (int i=0; i<ITERS; i++) { 42.545 + test_cp(a1, a2); 42.546 + } 42.547 + end = System.currentTimeMillis(); 42.548 + System.out.println("test_cp: " + (end - start)); 42.549 + start = System.currentTimeMillis(); 42.550 + for (int i=0; i<ITERS; i++) { 42.551 + test_2ci(a1, a2); 42.552 + } 42.553 + end = System.currentTimeMillis(); 42.554 + System.out.println("test_2ci: " + (end - start)); 42.555 + start = System.currentTimeMillis(); 42.556 + for (int i=0; i<ITERS; i++) { 42.557 + test_2vi(a1, a2, 123, 103); 42.558 + } 42.559 + end = System.currentTimeMillis(); 42.560 + System.out.println("test_2vi: " + (end - start)); 42.561 + 42.562 + start = System.currentTimeMillis(); 42.563 + for (int i=0; i<ITERS; i++) { 42.564 + test_ci_neg(a1, 123); 42.565 + } 42.566 + end = System.currentTimeMillis(); 42.567 + System.out.println("test_ci_neg: " + (end - start)); 42.568 + start = System.currentTimeMillis(); 42.569 + for (int i=0; i<ITERS; i++) { 42.570 + test_vi_neg(a2, 123, 103); 42.571 + } 42.572 + end = System.currentTimeMillis(); 42.573 + System.out.println("test_vi_neg: " + (end - start)); 42.574 + start = System.currentTimeMillis(); 42.575 + for (int i=0; i<ITERS; i++) { 42.576 + test_cp_neg(a1, a2); 42.577 + } 42.578 + end = System.currentTimeMillis(); 42.579 + System.out.println("test_cp_neg: " + (end - start)); 42.580 + start = System.currentTimeMillis(); 42.581 + for (int i=0; i<ITERS; i++) { 42.582 + test_2ci_neg(a1, a2); 42.583 + } 42.584 + end = System.currentTimeMillis(); 42.585 + System.out.println("test_2ci_neg: " + (end - start)); 42.586 + start = System.currentTimeMillis(); 42.587 + for (int i=0; i<ITERS; i++) { 42.588 + test_2vi_neg(a1, a2, 123, 103); 42.589 + } 42.590 + end = System.currentTimeMillis(); 42.591 + System.out.println("test_2vi_neg: " + (end - start)); 42.592 + 42.593 + start = System.currentTimeMillis(); 42.594 + for (int i=0; i<ITERS; i++) { 42.595 + test_ci_oppos(a1, 123); 42.596 + } 42.597 + end = System.currentTimeMillis(); 42.598 + System.out.println("test_ci_oppos: " + (end - start)); 42.599 + start = System.currentTimeMillis(); 42.600 + for (int i=0; i<ITERS; i++) { 42.601 + test_vi_oppos(a2, 123, 103); 42.602 + } 42.603 + end = System.currentTimeMillis(); 42.604 + System.out.println("test_vi_oppos: " + (end - start)); 42.605 + start = System.currentTimeMillis(); 42.606 + for (int i=0; i<ITERS; i++) { 42.607 + test_cp_oppos(a1, a2); 42.608 + } 42.609 + end = System.currentTimeMillis(); 42.610 + System.out.println("test_cp_oppos: " + (end - start)); 42.611 + start = System.currentTimeMillis(); 42.612 + for (int i=0; i<ITERS; i++) { 42.613 + test_2ci_oppos(a1, a2); 42.614 + } 42.615 + end = System.currentTimeMillis(); 42.616 + System.out.println("test_2ci_oppos: " + (end - start)); 42.617 + start = System.currentTimeMillis(); 42.618 + for (int i=0; i<ITERS; i++) { 42.619 + test_2vi_oppos(a1, a2, 123, 103); 42.620 + } 42.621 + end = System.currentTimeMillis(); 42.622 + System.out.println("test_2vi_oppos: " + (end - start)); 42.623 + 42.624 + start = System.currentTimeMillis(); 42.625 + for (int i=0; i<ITERS; i++) { 42.626 + test_ci_off(a1, 123); 42.627 + } 42.628 + end = System.currentTimeMillis(); 42.629 + System.out.println("test_ci_off: " + (end - start)); 42.630 + start = System.currentTimeMillis(); 42.631 + for (int i=0; i<ITERS; i++) { 42.632 + test_vi_off(a2, 123, 103); 42.633 + } 42.634 + end = System.currentTimeMillis(); 42.635 + System.out.println("test_vi_off: " + (end - start)); 42.636 + start = System.currentTimeMillis(); 42.637 + for (int i=0; i<ITERS; i++) { 42.638 + test_cp_off(a1, a2); 42.639 + } 42.640 + end = System.currentTimeMillis(); 42.641 + System.out.println("test_cp_off: " + (end - start)); 42.642 + start = System.currentTimeMillis(); 42.643 + for (int i=0; i<ITERS; i++) { 42.644 + test_2ci_off(a1, a2); 42.645 + } 42.646 + end = System.currentTimeMillis(); 42.647 + System.out.println("test_2ci_off: " + (end - start)); 42.648 + start = System.currentTimeMillis(); 42.649 + for (int i=0; i<ITERS; i++) { 42.650 + test_2vi_off(a1, a2, 123, 103); 42.651 + } 42.652 + end = System.currentTimeMillis(); 42.653 + System.out.println("test_2vi_off: " + (end - start)); 42.654 + 42.655 + start = System.currentTimeMillis(); 42.656 + for (int i=0; i<ITERS; i++) { 42.657 + test_ci_inv(a1, OFFSET, 123); 42.658 + } 42.659 + end = System.currentTimeMillis(); 42.660 + System.out.println("test_ci_inv: " + (end - start)); 42.661 + start = System.currentTimeMillis(); 42.662 + for (int i=0; i<ITERS; i++) { 42.663 + test_vi_inv(a2, 123, OFFSET, 103); 42.664 + } 42.665 + end = System.currentTimeMillis(); 42.666 + System.out.println("test_vi_inv: " + (end - start)); 42.667 + start = System.currentTimeMillis(); 42.668 + for (int i=0; i<ITERS; i++) { 42.669 + test_cp_inv(a1, a2, OFFSET); 42.670 + } 42.671 + end = System.currentTimeMillis(); 42.672 + System.out.println("test_cp_inv: " + (end - start)); 42.673 + start = System.currentTimeMillis(); 42.674 + for (int i=0; i<ITERS; i++) { 42.675 + test_2ci_inv(a1, a2, OFFSET); 42.676 + } 42.677 + end = System.currentTimeMillis(); 42.678 + System.out.println("test_2ci_inv: " + (end - start)); 42.679 + start = System.currentTimeMillis(); 42.680 + for (int i=0; i<ITERS; i++) { 42.681 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 42.682 + } 42.683 + end = System.currentTimeMillis(); 42.684 + System.out.println("test_2vi_inv: " + (end - start)); 42.685 + 42.686 + start = System.currentTimeMillis(); 42.687 + for (int i=0; i<ITERS; i++) { 42.688 + test_ci_scl(a1, 123); 42.689 + } 42.690 + end = System.currentTimeMillis(); 42.691 + System.out.println("test_ci_scl: " + (end - start)); 42.692 + start = System.currentTimeMillis(); 42.693 + for (int i=0; i<ITERS; i++) { 42.694 + test_vi_scl(a2, 123, 103); 42.695 + } 42.696 + end = System.currentTimeMillis(); 42.697 + System.out.println("test_vi_scl: " + (end - start)); 42.698 + start = System.currentTimeMillis(); 42.699 + for (int i=0; i<ITERS; i++) { 42.700 + test_cp_scl(a1, a2); 42.701 + } 42.702 + end = System.currentTimeMillis(); 42.703 + System.out.println("test_cp_scl: " + (end - start)); 42.704 + start = System.currentTimeMillis(); 42.705 + for (int i=0; i<ITERS; i++) { 42.706 + test_2ci_scl(a1, a2); 42.707 + } 42.708 + end = System.currentTimeMillis(); 42.709 + System.out.println("test_2ci_scl: " + (end - start)); 42.710 + start = System.currentTimeMillis(); 42.711 + for (int i=0; i<ITERS; i++) { 42.712 + test_2vi_scl(a1, a2, 123, 103); 42.713 + } 42.714 + end = System.currentTimeMillis(); 42.715 + System.out.println("test_2vi_scl: " + (end - start)); 42.716 + 42.717 + start = System.currentTimeMillis(); 42.718 + for (int i=0; i<ITERS; i++) { 42.719 + test_cp_alndst(a1, a2); 42.720 + } 42.721 + end = System.currentTimeMillis(); 42.722 + System.out.println("test_cp_alndst: " + (end - start)); 42.723 + start = System.currentTimeMillis(); 42.724 + for (int i=0; i<ITERS; i++) { 42.725 + test_cp_alnsrc(a1, a2); 42.726 + } 42.727 + end = System.currentTimeMillis(); 42.728 + System.out.println("test_cp_alnsrc: " + (end - start)); 42.729 + start = System.currentTimeMillis(); 42.730 + for (int i=0; i<ITERS; i++) { 42.731 + test_2ci_aln(a1, a2); 42.732 + } 42.733 + end = System.currentTimeMillis(); 42.734 + System.out.println("test_2ci_aln: " + (end - start)); 42.735 + start = System.currentTimeMillis(); 42.736 + for (int i=0; i<ITERS; i++) { 42.737 + test_2vi_aln(a1, a2, 123, 103); 42.738 + } 42.739 + end = System.currentTimeMillis(); 42.740 + System.out.println("test_2vi_aln: " + (end - start)); 42.741 + 42.742 + start = System.currentTimeMillis(); 42.743 + for (int i=0; i<ITERS; i++) { 42.744 + test_cp_unalndst(a1, a2); 42.745 + } 42.746 + end = System.currentTimeMillis(); 42.747 + System.out.println("test_cp_unalndst: " + (end - start)); 42.748 + start = System.currentTimeMillis(); 42.749 + for (int i=0; i<ITERS; i++) { 42.750 + test_cp_unalnsrc(a1, a2); 42.751 + } 42.752 + end = System.currentTimeMillis(); 42.753 + System.out.println("test_cp_unalnsrc: " + (end - start)); 42.754 + start = System.currentTimeMillis(); 42.755 + for (int i=0; i<ITERS; i++) { 42.756 + test_2ci_unaln(a1, a2); 42.757 + } 42.758 + end = System.currentTimeMillis(); 42.759 + System.out.println("test_2ci_unaln: " + (end - start)); 42.760 + start = System.currentTimeMillis(); 42.761 + for (int i=0; i<ITERS; i++) { 42.762 + test_2vi_unaln(a1, a2, 123, 103); 42.763 + } 42.764 + end = System.currentTimeMillis(); 42.765 + System.out.println("test_2vi_unaln: " + (end - start)); 42.766 + 42.767 + return errn; 42.768 + } 42.769 + 42.770 + private final static long byte_offset(int i) { 42.771 + return ((long)i << 2) + BASE; 42.772 + } 42.773 + 42.774 + static void test_ci(int[] a) { 42.775 + for (int i = 0; i < ARRLEN; i+=1) { 42.776 + unsafe.compareAndSwapInt(a, byte_offset(i), -1, -123); 42.777 + } 42.778 + } 42.779 + static void test_vi(int[] a, int b, int old) { 42.780 + for (int i = 0; i < ARRLEN; i+=1) { 42.781 + unsafe.compareAndSwapInt(a, byte_offset(i), old, b); 42.782 + } 42.783 + } 42.784 + static void test_cp(int[] a, int[] b) { 42.785 + for (int i = 0; i < ARRLEN; i+=1) { 42.786 + unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[i]); 42.787 + } 42.788 + } 42.789 + static void test_2ci(int[] a, int[] b) { 42.790 + for (int i = 0; i < ARRLEN; i+=1) { 42.791 + unsafe.compareAndSwapInt(a, byte_offset(i), 123, -123); 42.792 + unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103); 42.793 + } 42.794 + } 42.795 + static void test_2vi(int[] a, int[] b, int c, int d) { 42.796 + for (int i = 0; i < ARRLEN; i+=1) { 42.797 + unsafe.compareAndSwapInt(a, byte_offset(i), -123, c); 42.798 + unsafe.compareAndSwapInt(b, byte_offset(i), -103, d); 42.799 + } 42.800 + } 42.801 + static void test_ci_neg(int[] a, int old) { 42.802 + for (int i = ARRLEN-1; i >= 0; i-=1) { 42.803 + unsafe.compareAndSwapInt(a, byte_offset(i), old, -123); 42.804 + } 42.805 + } 42.806 + static void test_vi_neg(int[] a, int b, int old) { 42.807 + for (int i = ARRLEN-1; i >= 0; i-=1) { 42.808 + unsafe.compareAndSwapInt(a, byte_offset(i), old, b); 42.809 + } 42.810 + } 42.811 + static void test_cp_neg(int[] a, int[] b) { 42.812 + for (int i = ARRLEN-1; i >= 0; i-=1) { 42.813 + unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[i]); 42.814 + } 42.815 + } 42.816 + static void test_2ci_neg(int[] a, int[] b) { 42.817 + for (int i = ARRLEN-1; i >= 0; i-=1) { 42.818 + unsafe.compareAndSwapInt(a, byte_offset(i), 123, -123); 42.819 + unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103); 42.820 + } 42.821 + } 42.822 + static void test_2vi_neg(int[] a, int[] b, int c, int d) { 42.823 + for (int i = ARRLEN-1; i >= 0; i-=1) { 42.824 + unsafe.compareAndSwapInt(a, byte_offset(i), -123, c); 42.825 + unsafe.compareAndSwapInt(b, byte_offset(i), -103, d); 42.826 + } 42.827 + } 42.828 + static void test_ci_oppos(int[] a, int old) { 42.829 + int limit = ARRLEN-1; 42.830 + for (int i = 0; i < ARRLEN; i+=1) { 42.831 + unsafe.compareAndSwapInt(a, byte_offset(limit-i), old, -123); 42.832 + } 42.833 + } 42.834 + static void test_vi_oppos(int[] a, int b, int old) { 42.835 + int limit = ARRLEN-1; 42.836 + for (int i = limit; i >= 0; i-=1) { 42.837 + unsafe.compareAndSwapInt(a, byte_offset(limit-i), old, b); 42.838 + } 42.839 + } 42.840 + static void test_cp_oppos(int[] a, int[] b) { 42.841 + int limit = ARRLEN-1; 42.842 + for (int i = 0; i < ARRLEN; i+=1) { 42.843 + unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[limit-i]); 42.844 + } 42.845 + } 42.846 + static void test_2ci_oppos(int[] a, int[] b) { 42.847 + int limit = ARRLEN-1; 42.848 + for (int i = 0; i < ARRLEN; i+=1) { 42.849 + unsafe.compareAndSwapInt(a, byte_offset(limit-i), 123, -123); 42.850 + unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103); 42.851 + } 42.852 + } 42.853 + static void test_2vi_oppos(int[] a, int[] b, int c, int d) { 42.854 + int limit = ARRLEN-1; 42.855 + for (int i = limit; i >= 0; i-=1) { 42.856 + unsafe.compareAndSwapInt(a, byte_offset(i), -123, c); 42.857 + unsafe.compareAndSwapInt(b, byte_offset(limit-i), -103, d); 42.858 + } 42.859 + } 42.860 + static void test_ci_off(int[] a, int old) { 42.861 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 42.862 + unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), old, -123); 42.863 + } 42.864 + } 42.865 + static void test_vi_off(int[] a, int b, int old) { 42.866 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 42.867 + unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), old, b); 42.868 + } 42.869 + } 42.870 + static void test_cp_off(int[] a, int[] b) { 42.871 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 42.872 + unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), -123, b[i+OFFSET]); 42.873 + } 42.874 + } 42.875 + static void test_2ci_off(int[] a, int[] b) { 42.876 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 42.877 + unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), 123, -123); 42.878 + unsafe.compareAndSwapInt(b, byte_offset(i+OFFSET), 123, -103); 42.879 + } 42.880 + } 42.881 + static void test_2vi_off(int[] a, int[] b, int c, int d) { 42.882 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 42.883 + unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), -123, c); 42.884 + unsafe.compareAndSwapInt(b, byte_offset(i+OFFSET), -103, d); 42.885 + } 42.886 + } 42.887 + static void test_ci_inv(int[] a, int k, int old) { 42.888 + for (int i = 0; i < ARRLEN-k; i+=1) { 42.889 + unsafe.compareAndSwapInt(a, byte_offset(i+k), old, -123); 42.890 + } 42.891 + } 42.892 + static void test_vi_inv(int[] a, int b, int k, int old) { 42.893 + for (int i = 0; i < ARRLEN-k; i+=1) { 42.894 + unsafe.compareAndSwapInt(a, byte_offset(i+k), old, b); 42.895 + } 42.896 + } 42.897 + static void test_cp_inv(int[] a, int[] b, int k) { 42.898 + for (int i = 0; i < ARRLEN-k; i+=1) { 42.899 + unsafe.compareAndSwapInt(a, byte_offset(i+k), -123, b[i+k]); 42.900 + } 42.901 + } 42.902 + static void test_2ci_inv(int[] a, int[] b, int k) { 42.903 + for (int i = 0; i < ARRLEN-k; i+=1) { 42.904 + unsafe.compareAndSwapInt(a, byte_offset(i+k), 123, -123); 42.905 + unsafe.compareAndSwapInt(b, byte_offset(i+k), 123, -103); 42.906 + } 42.907 + } 42.908 + static void test_2vi_inv(int[] a, int[] b, int c, int d, int k) { 42.909 + for (int i = 0; i < ARRLEN-k; i+=1) { 42.910 + unsafe.compareAndSwapInt(a, byte_offset(i+k), -123, c); 42.911 + unsafe.compareAndSwapInt(b, byte_offset(i+k), -103, d); 42.912 + } 42.913 + } 42.914 + static void test_ci_scl(int[] a, int old) { 42.915 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 42.916 + unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), old, -123); 42.917 + } 42.918 + } 42.919 + static void test_vi_scl(int[] a, int b, int old) { 42.920 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 42.921 + unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), old, b); 42.922 + } 42.923 + } 42.924 + static void test_cp_scl(int[] a, int[] b) { 42.925 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 42.926 + unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), -123, b[i*SCALE]); 42.927 + } 42.928 + } 42.929 + static void test_2ci_scl(int[] a, int[] b) { 42.930 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 42.931 + unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), 123, -123); 42.932 + unsafe.compareAndSwapInt(b, byte_offset(i*SCALE), 123, -103); 42.933 + } 42.934 + } 42.935 + static void test_2vi_scl(int[] a, int[] b, int c, int d) { 42.936 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 42.937 + unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), -123, c); 42.938 + unsafe.compareAndSwapInt(b, byte_offset(i*SCALE), -103, d); 42.939 + } 42.940 + } 42.941 + static void test_cp_alndst(int[] a, int[] b) { 42.942 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 42.943 + unsafe.compareAndSwapInt(a, byte_offset(i+ALIGN_OFF), -1, b[i]); 42.944 + } 42.945 + } 42.946 + static void test_cp_alnsrc(int[] a, int[] b) { 42.947 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 42.948 + int old = unsafe.getIntVolatile(a, byte_offset(i)); 42.949 + unsafe.compareAndSwapInt(a, byte_offset(i), old, b[i+ALIGN_OFF]); 42.950 + } 42.951 + } 42.952 + static void test_2ci_aln(int[] a, int[] b) { 42.953 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 42.954 + unsafe.compareAndSwapInt(a, byte_offset(i+ALIGN_OFF), -1, -123); 42.955 + int old = unsafe.getIntVolatile(b, byte_offset(i)); 42.956 + unsafe.compareAndSwapInt(b, byte_offset(i), old, -103); 42.957 + } 42.958 + } 42.959 + static void test_2vi_aln(int[] a, int[] b, int c, int d) { 42.960 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 42.961 + int old = unsafe.getIntVolatile(a, byte_offset(i)); 42.962 + unsafe.compareAndSwapInt(a, byte_offset(i), old, c); 42.963 + old = unsafe.getIntVolatile(b, byte_offset(i+ALIGN_OFF)); 42.964 + unsafe.compareAndSwapInt(b, byte_offset(i+ALIGN_OFF), old, d); 42.965 + } 42.966 + } 42.967 + static void test_cp_unalndst(int[] a, int[] b) { 42.968 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 42.969 + unsafe.compareAndSwapInt(a, byte_offset(i+UNALIGN_OFF), -1, b[i]); 42.970 + } 42.971 + } 42.972 + static void test_cp_unalnsrc(int[] a, int[] b) { 42.973 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 42.974 + int old = unsafe.getIntVolatile(a, byte_offset(i)); 42.975 + unsafe.compareAndSwapInt(a, byte_offset(i), old, b[i+UNALIGN_OFF]); 42.976 + } 42.977 + } 42.978 + static void test_2ci_unaln(int[] a, int[] b) { 42.979 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 42.980 + unsafe.compareAndSwapInt(a, byte_offset(i+UNALIGN_OFF), -1, -123); 42.981 + int old = unsafe.getIntVolatile(b, byte_offset(i)); 42.982 + unsafe.compareAndSwapInt(b, byte_offset(i), old, -103); 42.983 + } 42.984 + } 42.985 + static void test_2vi_unaln(int[] a, int[] b, int c, int d) { 42.986 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 42.987 + int old = unsafe.getIntVolatile(a, byte_offset(i)); 42.988 + unsafe.compareAndSwapInt(a, byte_offset(i), old, c); 42.989 + old = unsafe.getIntVolatile(b, byte_offset(i+UNALIGN_OFF)); 42.990 + unsafe.compareAndSwapInt(b, byte_offset(i+UNALIGN_OFF), old, d); 42.991 + } 42.992 + } 42.993 + 42.994 + static int verify(String text, int i, int elem, int val) { 42.995 + if (elem != val) { 42.996 + System.err.println(text + "[" + i + "] = " + elem + " != " + val); 42.997 + return 1; 42.998 + } 42.999 + return 0; 42.1000 + } 42.1001 +}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 43.2 +++ b/test/compiler/8004867/TestIntUnsafeOrdered.java Tue Feb 26 11:52:06 2013 +0100 43.3 @@ -0,0 +1,990 @@ 43.4 +/* 43.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 43.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 43.7 + * 43.8 + * This code is free software; you can redistribute it and/or modify it 43.9 + * under the terms of the GNU General Public License version 2 only, as 43.10 + * published by the Free Software Foundation. 43.11 + * 43.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 43.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 43.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 43.15 + * version 2 for more details (a copy is included in the LICENSE file that 43.16 + * accompanied this code). 43.17 + * 43.18 + * You should have received a copy of the GNU General Public License version 43.19 + * 2 along with this work; if not, write to the Free Software Foundation, 43.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 43.21 + * 43.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 43.23 + * or visit www.oracle.com if you need additional information or have any 43.24 + * questions. 43.25 + * 43.26 + */ 43.27 + 43.28 +/** 43.29 + * @test 43.30 + * @bug 8004867 43.31 + * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" 43.32 + * 43.33 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeOrdered 43.34 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeOrdered 43.35 + */ 43.36 + 43.37 +import sun.misc.Unsafe; 43.38 +import java.lang.reflect.*; 43.39 + 43.40 +public class TestIntUnsafeOrdered { 43.41 + private static final int ARRLEN = 97; 43.42 + private static final int ITERS = 11000; 43.43 + private static final int OFFSET = 3; 43.44 + private static final int SCALE = 2; 43.45 + private static final int ALIGN_OFF = 8; 43.46 + private static final int UNALIGN_OFF = 5; 43.47 + 43.48 + private static final Unsafe unsafe; 43.49 + private static final int BASE; 43.50 + static { 43.51 + try { 43.52 + Class c = TestIntUnsafeOrdered.class.getClassLoader().loadClass("sun.misc.Unsafe"); 43.53 + Field f = c.getDeclaredField("theUnsafe"); 43.54 + f.setAccessible(true); 43.55 + unsafe = (Unsafe)f.get(c); 43.56 + BASE = unsafe.arrayBaseOffset(int[].class); 43.57 + } catch (Exception e) { 43.58 + InternalError err = new InternalError(); 43.59 + err.initCause(e); 43.60 + throw err; 43.61 + } 43.62 + } 43.63 + 43.64 + public static void main(String args[]) { 43.65 + System.out.println("Testing Integer array unsafe ordered operations"); 43.66 + int errn = test(false); 43.67 + if (errn > 0) { 43.68 + System.err.println("FAILED: " + errn + " errors"); 43.69 + System.exit(97); 43.70 + } 43.71 + System.out.println("PASSED"); 43.72 + } 43.73 + 43.74 + static int test(boolean test_only) { 43.75 + int[] a1 = new int[ARRLEN]; 43.76 + int[] a2 = new int[ARRLEN]; 43.77 + // Initialize 43.78 + for (int i=0; i<ARRLEN; i++) { 43.79 + a1[i] = -1; 43.80 + a2[i] = -1; 43.81 + } 43.82 + System.out.println("Warmup"); 43.83 + for (int i=0; i<ITERS; i++) { 43.84 + test_ci(a1); 43.85 + test_vi(a2, 123, -1); 43.86 + test_cp(a1, a2); 43.87 + test_2ci(a1, a2); 43.88 + test_2vi(a1, a2, 123, 103); 43.89 + test_ci_neg(a1, 123); 43.90 + test_vi_neg(a2, 123, 103); 43.91 + test_cp_neg(a1, a2); 43.92 + test_2ci_neg(a1, a2); 43.93 + test_2vi_neg(a1, a2, 123, 103); 43.94 + test_ci_oppos(a1, 123); 43.95 + test_vi_oppos(a2, 123, 103); 43.96 + test_cp_oppos(a1, a2); 43.97 + test_2ci_oppos(a1, a2); 43.98 + test_2vi_oppos(a1, a2, 123, 103); 43.99 + test_ci_off(a1, 123); 43.100 + test_vi_off(a2, 123, 103); 43.101 + test_cp_off(a1, a2); 43.102 + test_2ci_off(a1, a2); 43.103 + test_2vi_off(a1, a2, 123, 103); 43.104 + test_ci_inv(a1, OFFSET, 123); 43.105 + test_vi_inv(a2, 123, OFFSET, 103); 43.106 + test_cp_inv(a1, a2, OFFSET); 43.107 + test_2ci_inv(a1, a2, OFFSET); 43.108 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 43.109 + test_ci_scl(a1, 123); 43.110 + test_vi_scl(a2, 123, 103); 43.111 + test_cp_scl(a1, a2); 43.112 + test_2ci_scl(a1, a2); 43.113 + test_2vi_scl(a1, a2, 123, 103); 43.114 + test_cp_alndst(a1, a2); 43.115 + test_cp_alnsrc(a1, a2); 43.116 + test_2ci_aln(a1, a2); 43.117 + test_2vi_aln(a1, a2, 123, 103); 43.118 + test_cp_unalndst(a1, a2); 43.119 + test_cp_unalnsrc(a1, a2); 43.120 + test_2ci_unaln(a1, a2); 43.121 + test_2vi_unaln(a1, a2, 123, 103); 43.122 + } 43.123 + // Initialize 43.124 + for (int i=0; i<ARRLEN; i++) { 43.125 + a1[i] = -1; 43.126 + a2[i] = -1; 43.127 + } 43.128 + // Test and verify results 43.129 + System.out.println("Verification"); 43.130 + int errn = 0; 43.131 + { 43.132 + test_ci(a1); 43.133 + for (int i=0; i<ARRLEN; i++) { 43.134 + errn += verify("test_ci: a1", i, a1[i], -123); 43.135 + } 43.136 + test_vi(a2, 123, -1); 43.137 + for (int i=0; i<ARRLEN; i++) { 43.138 + errn += verify("test_vi: a2", i, a2[i], 123); 43.139 + } 43.140 + test_cp(a1, a2); 43.141 + for (int i=0; i<ARRLEN; i++) { 43.142 + errn += verify("test_cp: a1", i, a1[i], 123); 43.143 + } 43.144 + test_2ci(a1, a2); 43.145 + for (int i=0; i<ARRLEN; i++) { 43.146 + errn += verify("test_2ci: a1", i, a1[i], -123); 43.147 + errn += verify("test_2ci: a2", i, a2[i], -103); 43.148 + } 43.149 + test_2vi(a1, a2, 123, 103); 43.150 + for (int i=0; i<ARRLEN; i++) { 43.151 + errn += verify("test_2vi: a1", i, a1[i], 123); 43.152 + errn += verify("test_2vi: a2", i, a2[i], 103); 43.153 + } 43.154 + // Reset for negative stride 43.155 + for (int i=0; i<ARRLEN; i++) { 43.156 + a1[i] = -1; 43.157 + a2[i] = -1; 43.158 + } 43.159 + test_ci_neg(a1, -1); 43.160 + for (int i=0; i<ARRLEN; i++) { 43.161 + errn += verify("test_ci_neg: a1", i, a1[i], -123); 43.162 + } 43.163 + test_vi_neg(a2, 123, -1); 43.164 + for (int i=0; i<ARRLEN; i++) { 43.165 + errn += verify("test_vi_neg: a2", i, a2[i], 123); 43.166 + } 43.167 + test_cp_neg(a1, a2); 43.168 + for (int i=0; i<ARRLEN; i++) { 43.169 + errn += verify("test_cp_neg: a1", i, a1[i], 123); 43.170 + } 43.171 + test_2ci_neg(a1, a2); 43.172 + for (int i=0; i<ARRLEN; i++) { 43.173 + errn += verify("test_2ci_neg: a1", i, a1[i], -123); 43.174 + errn += verify("test_2ci_neg: a2", i, a2[i], -103); 43.175 + } 43.176 + test_2vi_neg(a1, a2, 123, 103); 43.177 + for (int i=0; i<ARRLEN; i++) { 43.178 + errn += verify("test_2vi_neg: a1", i, a1[i], 123); 43.179 + errn += verify("test_2vi_neg: a2", i, a2[i], 103); 43.180 + } 43.181 + // Reset for opposite stride 43.182 + for (int i=0; i<ARRLEN; i++) { 43.183 + a1[i] = -1; 43.184 + a2[i] = -1; 43.185 + } 43.186 + test_ci_oppos(a1, -1); 43.187 + for (int i=0; i<ARRLEN; i++) { 43.188 + errn += verify("test_ci_oppos: a1", i, a1[i], -123); 43.189 + } 43.190 + test_vi_oppos(a2, 123, -1); 43.191 + for (int i=0; i<ARRLEN; i++) { 43.192 + errn += verify("test_vi_oppos: a2", i, a2[i], 123); 43.193 + } 43.194 + test_cp_oppos(a1, a2); 43.195 + for (int i=0; i<ARRLEN; i++) { 43.196 + errn += verify("test_cp_oppos: a1", i, a1[i], 123); 43.197 + } 43.198 + test_2ci_oppos(a1, a2); 43.199 + for (int i=0; i<ARRLEN; i++) { 43.200 + errn += verify("test_2ci_oppos: a1", i, a1[i], -123); 43.201 + errn += verify("test_2ci_oppos: a2", i, a2[i], -103); 43.202 + } 43.203 + test_2vi_oppos(a1, a2, 123, 103); 43.204 + for (int i=0; i<ARRLEN; i++) { 43.205 + errn += verify("test_2vi_oppos: a1", i, a1[i], 123); 43.206 + errn += verify("test_2vi_oppos: a2", i, a2[i], 103); 43.207 + } 43.208 + // Reset for indexing with offset 43.209 + for (int i=0; i<ARRLEN; i++) { 43.210 + a1[i] = -1; 43.211 + a2[i] = -1; 43.212 + } 43.213 + test_ci_off(a1, -1); 43.214 + for (int i=OFFSET; i<ARRLEN; i++) { 43.215 + errn += verify("test_ci_off: a1", i, a1[i], -123); 43.216 + } 43.217 + test_vi_off(a2, 123, -1); 43.218 + for (int i=OFFSET; i<ARRLEN; i++) { 43.219 + errn += verify("test_vi_off: a2", i, a2[i], 123); 43.220 + } 43.221 + test_cp_off(a1, a2); 43.222 + for (int i=OFFSET; i<ARRLEN; i++) { 43.223 + errn += verify("test_cp_off: a1", i, a1[i], 123); 43.224 + } 43.225 + test_2ci_off(a1, a2); 43.226 + for (int i=OFFSET; i<ARRLEN; i++) { 43.227 + errn += verify("test_2ci_off: a1", i, a1[i], -123); 43.228 + errn += verify("test_2ci_off: a2", i, a2[i], -103); 43.229 + } 43.230 + test_2vi_off(a1, a2, 123, 103); 43.231 + for (int i=OFFSET; i<ARRLEN; i++) { 43.232 + errn += verify("test_2vi_off: a1", i, a1[i], 123); 43.233 + errn += verify("test_2vi_off: a2", i, a2[i], 103); 43.234 + } 43.235 + for (int i=0; i<OFFSET; i++) { 43.236 + errn += verify("test_2vi_off: a1", i, a1[i], -1); 43.237 + errn += verify("test_2vi_off: a2", i, a2[i], -1); 43.238 + } 43.239 + // Reset for indexing with invariant offset 43.240 + for (int i=0; i<ARRLEN; i++) { 43.241 + a1[i] = -1; 43.242 + a2[i] = -1; 43.243 + } 43.244 + test_ci_inv(a1, OFFSET, -1); 43.245 + for (int i=OFFSET; i<ARRLEN; i++) { 43.246 + errn += verify("test_ci_inv: a1", i, a1[i], -123); 43.247 + } 43.248 + test_vi_inv(a2, 123, OFFSET, -1); 43.249 + for (int i=OFFSET; i<ARRLEN; i++) { 43.250 + errn += verify("test_vi_inv: a2", i, a2[i], 123); 43.251 + } 43.252 + test_cp_inv(a1, a2, OFFSET); 43.253 + for (int i=OFFSET; i<ARRLEN; i++) { 43.254 + errn += verify("test_cp_inv: a1", i, a1[i], 123); 43.255 + } 43.256 + test_2ci_inv(a1, a2, OFFSET); 43.257 + for (int i=OFFSET; i<ARRLEN; i++) { 43.258 + errn += verify("test_2ci_inv: a1", i, a1[i], -123); 43.259 + errn += verify("test_2ci_inv: a2", i, a2[i], -103); 43.260 + } 43.261 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 43.262 + for (int i=OFFSET; i<ARRLEN; i++) { 43.263 + errn += verify("test_2vi_inv: a1", i, a1[i], 123); 43.264 + errn += verify("test_2vi_inv: a2", i, a2[i], 103); 43.265 + } 43.266 + for (int i=0; i<OFFSET; i++) { 43.267 + errn += verify("test_2vi_inv: a1", i, a1[i], -1); 43.268 + errn += verify("test_2vi_inv: a2", i, a2[i], -1); 43.269 + } 43.270 + // Reset for indexing with scale 43.271 + for (int i=0; i<ARRLEN; i++) { 43.272 + a1[i] = -1; 43.273 + a2[i] = -1; 43.274 + } 43.275 + test_ci_scl(a1, -1); 43.276 + for (int i=0; i<ARRLEN; i++) { 43.277 + int val = (i%SCALE != 0) ? -1 : -123; 43.278 + errn += verify("test_ci_scl: a1", i, a1[i], val); 43.279 + } 43.280 + test_vi_scl(a2, 123, -1); 43.281 + for (int i=0; i<ARRLEN; i++) { 43.282 + int val = (i%SCALE != 0) ? -1 : 123; 43.283 + errn += verify("test_vi_scl: a2", i, a2[i], val); 43.284 + } 43.285 + test_cp_scl(a1, a2); 43.286 + for (int i=0; i<ARRLEN; i++) { 43.287 + int val = (i%SCALE != 0) ? -1 : 123; 43.288 + errn += verify("test_cp_scl: a1", i, a1[i], val); 43.289 + } 43.290 + test_2ci_scl(a1, a2); 43.291 + for (int i=0; i<ARRLEN; i++) { 43.292 + if (i%SCALE != 0) { 43.293 + errn += verify("test_2ci_scl: a1", i, a1[i], -1); 43.294 + } else if (i*SCALE < ARRLEN) { 43.295 + errn += verify("test_2ci_scl: a1", i*SCALE, a1[i*SCALE], -123); 43.296 + } 43.297 + if (i%SCALE != 0) { 43.298 + errn += verify("test_2ci_scl: a2", i, a2[i], -1); 43.299 + } else if (i*SCALE < ARRLEN) { 43.300 + errn += verify("test_2ci_scl: a2", i*SCALE, a2[i*SCALE], -103); 43.301 + } 43.302 + } 43.303 + test_2vi_scl(a1, a2, 123, 103); 43.304 + for (int i=0; i<ARRLEN; i++) { 43.305 + if (i%SCALE != 0) { 43.306 + errn += verify("test_2vi_scl: a1", i, a1[i], -1); 43.307 + } else if (i*SCALE < ARRLEN) { 43.308 + errn += verify("test_2vi_scl: a1", i*SCALE, a1[i*SCALE], 123); 43.309 + } 43.310 + if (i%SCALE != 0) { 43.311 + errn += verify("test_2vi_scl: a2", i, a2[i], -1); 43.312 + } else if (i*SCALE < ARRLEN) { 43.313 + errn += verify("test_2vi_scl: a2", i*SCALE, a2[i*SCALE], 103); 43.314 + } 43.315 + } 43.316 + // Reset for 2 arrays with relative aligned offset 43.317 + for (int i=0; i<ARRLEN; i++) { 43.318 + a1[i] = -1; 43.319 + a2[i] = -1; 43.320 + } 43.321 + test_vi(a2, 123, -1); 43.322 + test_cp_alndst(a1, a2); 43.323 + for (int i=0; i<ALIGN_OFF; i++) { 43.324 + errn += verify("test_cp_alndst: a1", i, a1[i], -1); 43.325 + } 43.326 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 43.327 + errn += verify("test_cp_alndst: a1", i, a1[i], 123); 43.328 + } 43.329 + for (int i=0; i<ALIGN_OFF; i++) { 43.330 + a1[i] = 123; 43.331 + } 43.332 + test_vi(a2, -123, 123); 43.333 + test_cp_alnsrc(a1, a2); 43.334 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 43.335 + errn += verify("test_cp_alnsrc: a1", i, a1[i], -123); 43.336 + } 43.337 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 43.338 + errn += verify("test_cp_alnsrc: a1", i, a1[i], 123); 43.339 + } 43.340 + for (int i=0; i<ARRLEN; i++) { 43.341 + a1[i] = -1; 43.342 + a2[i] = -1; 43.343 + } 43.344 + test_2ci_aln(a1, a2); 43.345 + for (int i=0; i<ALIGN_OFF; i++) { 43.346 + errn += verify("test_2ci_aln: a1", i, a1[i], -1); 43.347 + } 43.348 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 43.349 + errn += verify("test_2ci_aln: a1", i, a1[i], -123); 43.350 + } 43.351 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 43.352 + errn += verify("test_2ci_aln: a2", i, a2[i], -103); 43.353 + } 43.354 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 43.355 + errn += verify("test_2ci_aln: a2", i, a2[i], -1); 43.356 + } 43.357 + for (int i=0; i<ARRLEN; i++) { 43.358 + a1[i] = -1; 43.359 + a2[i] = -1; 43.360 + } 43.361 + test_2vi_aln(a1, a2, 123, 103); 43.362 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 43.363 + errn += verify("test_2vi_aln: a1", i, a1[i], 123); 43.364 + } 43.365 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 43.366 + errn += verify("test_2vi_aln: a1", i, a1[i], -1); 43.367 + } 43.368 + for (int i=0; i<ALIGN_OFF; i++) { 43.369 + errn += verify("test_2vi_aln: a2", i, a2[i], -1); 43.370 + } 43.371 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 43.372 + errn += verify("test_2vi_aln: a2", i, a2[i], 103); 43.373 + } 43.374 + 43.375 + // Reset for 2 arrays with relative unaligned offset 43.376 + for (int i=0; i<ARRLEN; i++) { 43.377 + a1[i] = -1; 43.378 + a2[i] = -1; 43.379 + } 43.380 + test_vi(a2, 123, -1); 43.381 + test_cp_unalndst(a1, a2); 43.382 + for (int i=0; i<UNALIGN_OFF; i++) { 43.383 + errn += verify("test_cp_unalndst: a1", i, a1[i], -1); 43.384 + } 43.385 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 43.386 + errn += verify("test_cp_unalndst: a1", i, a1[i], 123); 43.387 + } 43.388 + test_vi(a2, -123, 123); 43.389 + test_cp_unalnsrc(a1, a2); 43.390 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 43.391 + errn += verify("test_cp_unalnsrc: a1", i, a1[i], -123); 43.392 + } 43.393 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 43.394 + errn += verify("test_cp_unalnsrc: a1", i, a1[i], 123); 43.395 + } 43.396 + for (int i=0; i<ARRLEN; i++) { 43.397 + a1[i] = -1; 43.398 + a2[i] = -1; 43.399 + } 43.400 + test_2ci_unaln(a1, a2); 43.401 + for (int i=0; i<UNALIGN_OFF; i++) { 43.402 + errn += verify("test_2ci_unaln: a1", i, a1[i], -1); 43.403 + } 43.404 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 43.405 + errn += verify("test_2ci_unaln: a1", i, a1[i], -123); 43.406 + } 43.407 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 43.408 + errn += verify("test_2ci_unaln: a2", i, a2[i], -103); 43.409 + } 43.410 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 43.411 + errn += verify("test_2ci_unaln: a2", i, a2[i], -1); 43.412 + } 43.413 + for (int i=0; i<ARRLEN; i++) { 43.414 + a1[i] = -1; 43.415 + a2[i] = -1; 43.416 + } 43.417 + test_2vi_unaln(a1, a2, 123, 103); 43.418 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 43.419 + errn += verify("test_2vi_unaln: a1", i, a1[i], 123); 43.420 + } 43.421 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 43.422 + errn += verify("test_2vi_unaln: a1", i, a1[i], -1); 43.423 + } 43.424 + for (int i=0; i<UNALIGN_OFF; i++) { 43.425 + errn += verify("test_2vi_unaln: a2", i, a2[i], -1); 43.426 + } 43.427 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 43.428 + errn += verify("test_2vi_unaln: a2", i, a2[i], 103); 43.429 + } 43.430 + 43.431 + // Reset for aligned overlap initialization 43.432 + for (int i=0; i<ALIGN_OFF; i++) { 43.433 + a1[i] = i; 43.434 + } 43.435 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 43.436 + a1[i] = -1; 43.437 + } 43.438 + test_cp_alndst(a1, a1); 43.439 + for (int i=0; i<ARRLEN; i++) { 43.440 + int v = i%ALIGN_OFF; 43.441 + errn += verify("test_cp_alndst_overlap: a1", i, a1[i], v); 43.442 + } 43.443 + for (int i=0; i<ALIGN_OFF; i++) { 43.444 + a1[i+ALIGN_OFF] = -1; 43.445 + } 43.446 + test_cp_alnsrc(a1, a1); 43.447 + for (int i=0; i<ALIGN_OFF; i++) { 43.448 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], -1); 43.449 + } 43.450 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 43.451 + int v = i%ALIGN_OFF; 43.452 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], v); 43.453 + } 43.454 + for (int i=0; i<ARRLEN; i++) { 43.455 + a1[i] = -1; 43.456 + } 43.457 + test_2ci_aln(a1, a1); 43.458 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 43.459 + errn += verify("test_2ci_aln_overlap: a1", i, a1[i], -103); 43.460 + } 43.461 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 43.462 + errn += verify("test_2ci_aln_overlap: a1", i, a1[i], -123); 43.463 + } 43.464 + for (int i=0; i<ARRLEN; i++) { 43.465 + a1[i] = -1; 43.466 + } 43.467 + test_2vi_aln(a1, a1, 123, 103); 43.468 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 43.469 + errn += verify("test_2vi_aln_overlap: a1", i, a1[i], 123); 43.470 + } 43.471 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 43.472 + errn += verify("test_2vi_aln_overlap: a1", i, a1[i], 103); 43.473 + } 43.474 + 43.475 + // Reset for unaligned overlap initialization 43.476 + for (int i=0; i<UNALIGN_OFF; i++) { 43.477 + a1[i] = i; 43.478 + } 43.479 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 43.480 + a1[i] = -1; 43.481 + } 43.482 + test_cp_unalndst(a1, a1); 43.483 + for (int i=0; i<ARRLEN; i++) { 43.484 + int v = i%UNALIGN_OFF; 43.485 + errn += verify("test_cp_unalndst_overlap: a1", i, a1[i], v); 43.486 + } 43.487 + for (int i=0; i<UNALIGN_OFF; i++) { 43.488 + a1[i+UNALIGN_OFF] = -1; 43.489 + } 43.490 + test_cp_unalnsrc(a1, a1); 43.491 + for (int i=0; i<UNALIGN_OFF; i++) { 43.492 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], -1); 43.493 + } 43.494 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 43.495 + int v = i%UNALIGN_OFF; 43.496 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], v); 43.497 + } 43.498 + for (int i=0; i<ARRLEN; i++) { 43.499 + a1[i] = -1; 43.500 + } 43.501 + test_2ci_unaln(a1, a1); 43.502 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 43.503 + errn += verify("test_2ci_unaln_overlap: a1", i, a1[i], -103); 43.504 + } 43.505 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 43.506 + errn += verify("test_2ci_unaln_overlap: a1", i, a1[i], -123); 43.507 + } 43.508 + for (int i=0; i<ARRLEN; i++) { 43.509 + a1[i] = -1; 43.510 + } 43.511 + test_2vi_unaln(a1, a1, 123, 103); 43.512 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 43.513 + errn += verify("test_2vi_unaln_overlap: a1", i, a1[i], 123); 43.514 + } 43.515 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 43.516 + errn += verify("test_2vi_unaln_overlap: a1", i, a1[i], 103); 43.517 + } 43.518 + 43.519 + } 43.520 + 43.521 + if (errn > 0 || test_only) 43.522 + return errn; 43.523 + 43.524 + // Initialize 43.525 + for (int i=0; i<ARRLEN; i++) { 43.526 + a1[i] = -1; 43.527 + a2[i] = -1; 43.528 + } 43.529 + System.out.println("Time"); 43.530 + long start, end; 43.531 + start = System.currentTimeMillis(); 43.532 + for (int i=0; i<ITERS; i++) { 43.533 + test_ci(a1); 43.534 + } 43.535 + end = System.currentTimeMillis(); 43.536 + System.out.println("test_ci: " + (end - start)); 43.537 + start = System.currentTimeMillis(); 43.538 + for (int i=0; i<ITERS; i++) { 43.539 + test_vi(a2, 123, -1); 43.540 + } 43.541 + end = System.currentTimeMillis(); 43.542 + System.out.println("test_vi: " + (end - start)); 43.543 + start = System.currentTimeMillis(); 43.544 + for (int i=0; i<ITERS; i++) { 43.545 + test_cp(a1, a2); 43.546 + } 43.547 + end = System.currentTimeMillis(); 43.548 + System.out.println("test_cp: " + (end - start)); 43.549 + start = System.currentTimeMillis(); 43.550 + for (int i=0; i<ITERS; i++) { 43.551 + test_2ci(a1, a2); 43.552 + } 43.553 + end = System.currentTimeMillis(); 43.554 + System.out.println("test_2ci: " + (end - start)); 43.555 + start = System.currentTimeMillis(); 43.556 + for (int i=0; i<ITERS; i++) { 43.557 + test_2vi(a1, a2, 123, 103); 43.558 + } 43.559 + end = System.currentTimeMillis(); 43.560 + System.out.println("test_2vi: " + (end - start)); 43.561 + 43.562 + start = System.currentTimeMillis(); 43.563 + for (int i=0; i<ITERS; i++) { 43.564 + test_ci_neg(a1, 123); 43.565 + } 43.566 + end = System.currentTimeMillis(); 43.567 + System.out.println("test_ci_neg: " + (end - start)); 43.568 + start = System.currentTimeMillis(); 43.569 + for (int i=0; i<ITERS; i++) { 43.570 + test_vi_neg(a2, 123, 103); 43.571 + } 43.572 + end = System.currentTimeMillis(); 43.573 + System.out.println("test_vi_neg: " + (end - start)); 43.574 + start = System.currentTimeMillis(); 43.575 + for (int i=0; i<ITERS; i++) { 43.576 + test_cp_neg(a1, a2); 43.577 + } 43.578 + end = System.currentTimeMillis(); 43.579 + System.out.println("test_cp_neg: " + (end - start)); 43.580 + start = System.currentTimeMillis(); 43.581 + for (int i=0; i<ITERS; i++) { 43.582 + test_2ci_neg(a1, a2); 43.583 + } 43.584 + end = System.currentTimeMillis(); 43.585 + System.out.println("test_2ci_neg: " + (end - start)); 43.586 + start = System.currentTimeMillis(); 43.587 + for (int i=0; i<ITERS; i++) { 43.588 + test_2vi_neg(a1, a2, 123, 103); 43.589 + } 43.590 + end = System.currentTimeMillis(); 43.591 + System.out.println("test_2vi_neg: " + (end - start)); 43.592 + 43.593 + start = System.currentTimeMillis(); 43.594 + for (int i=0; i<ITERS; i++) { 43.595 + test_ci_oppos(a1, 123); 43.596 + } 43.597 + end = System.currentTimeMillis(); 43.598 + System.out.println("test_ci_oppos: " + (end - start)); 43.599 + start = System.currentTimeMillis(); 43.600 + for (int i=0; i<ITERS; i++) { 43.601 + test_vi_oppos(a2, 123, 103); 43.602 + } 43.603 + end = System.currentTimeMillis(); 43.604 + System.out.println("test_vi_oppos: " + (end - start)); 43.605 + start = System.currentTimeMillis(); 43.606 + for (int i=0; i<ITERS; i++) { 43.607 + test_cp_oppos(a1, a2); 43.608 + } 43.609 + end = System.currentTimeMillis(); 43.610 + System.out.println("test_cp_oppos: " + (end - start)); 43.611 + start = System.currentTimeMillis(); 43.612 + for (int i=0; i<ITERS; i++) { 43.613 + test_2ci_oppos(a1, a2); 43.614 + } 43.615 + end = System.currentTimeMillis(); 43.616 + System.out.println("test_2ci_oppos: " + (end - start)); 43.617 + start = System.currentTimeMillis(); 43.618 + for (int i=0; i<ITERS; i++) { 43.619 + test_2vi_oppos(a1, a2, 123, 103); 43.620 + } 43.621 + end = System.currentTimeMillis(); 43.622 + System.out.println("test_2vi_oppos: " + (end - start)); 43.623 + 43.624 + start = System.currentTimeMillis(); 43.625 + for (int i=0; i<ITERS; i++) { 43.626 + test_ci_off(a1, 123); 43.627 + } 43.628 + end = System.currentTimeMillis(); 43.629 + System.out.println("test_ci_off: " + (end - start)); 43.630 + start = System.currentTimeMillis(); 43.631 + for (int i=0; i<ITERS; i++) { 43.632 + test_vi_off(a2, 123, 103); 43.633 + } 43.634 + end = System.currentTimeMillis(); 43.635 + System.out.println("test_vi_off: " + (end - start)); 43.636 + start = System.currentTimeMillis(); 43.637 + for (int i=0; i<ITERS; i++) { 43.638 + test_cp_off(a1, a2); 43.639 + } 43.640 + end = System.currentTimeMillis(); 43.641 + System.out.println("test_cp_off: " + (end - start)); 43.642 + start = System.currentTimeMillis(); 43.643 + for (int i=0; i<ITERS; i++) { 43.644 + test_2ci_off(a1, a2); 43.645 + } 43.646 + end = System.currentTimeMillis(); 43.647 + System.out.println("test_2ci_off: " + (end - start)); 43.648 + start = System.currentTimeMillis(); 43.649 + for (int i=0; i<ITERS; i++) { 43.650 + test_2vi_off(a1, a2, 123, 103); 43.651 + } 43.652 + end = System.currentTimeMillis(); 43.653 + System.out.println("test_2vi_off: " + (end - start)); 43.654 + 43.655 + start = System.currentTimeMillis(); 43.656 + for (int i=0; i<ITERS; i++) { 43.657 + test_ci_inv(a1, OFFSET, 123); 43.658 + } 43.659 + end = System.currentTimeMillis(); 43.660 + System.out.println("test_ci_inv: " + (end - start)); 43.661 + start = System.currentTimeMillis(); 43.662 + for (int i=0; i<ITERS; i++) { 43.663 + test_vi_inv(a2, 123, OFFSET, 103); 43.664 + } 43.665 + end = System.currentTimeMillis(); 43.666 + System.out.println("test_vi_inv: " + (end - start)); 43.667 + start = System.currentTimeMillis(); 43.668 + for (int i=0; i<ITERS; i++) { 43.669 + test_cp_inv(a1, a2, OFFSET); 43.670 + } 43.671 + end = System.currentTimeMillis(); 43.672 + System.out.println("test_cp_inv: " + (end - start)); 43.673 + start = System.currentTimeMillis(); 43.674 + for (int i=0; i<ITERS; i++) { 43.675 + test_2ci_inv(a1, a2, OFFSET); 43.676 + } 43.677 + end = System.currentTimeMillis(); 43.678 + System.out.println("test_2ci_inv: " + (end - start)); 43.679 + start = System.currentTimeMillis(); 43.680 + for (int i=0; i<ITERS; i++) { 43.681 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 43.682 + } 43.683 + end = System.currentTimeMillis(); 43.684 + System.out.println("test_2vi_inv: " + (end - start)); 43.685 + 43.686 + start = System.currentTimeMillis(); 43.687 + for (int i=0; i<ITERS; i++) { 43.688 + test_ci_scl(a1, 123); 43.689 + } 43.690 + end = System.currentTimeMillis(); 43.691 + System.out.println("test_ci_scl: " + (end - start)); 43.692 + start = System.currentTimeMillis(); 43.693 + for (int i=0; i<ITERS; i++) { 43.694 + test_vi_scl(a2, 123, 103); 43.695 + } 43.696 + end = System.currentTimeMillis(); 43.697 + System.out.println("test_vi_scl: " + (end - start)); 43.698 + start = System.currentTimeMillis(); 43.699 + for (int i=0; i<ITERS; i++) { 43.700 + test_cp_scl(a1, a2); 43.701 + } 43.702 + end = System.currentTimeMillis(); 43.703 + System.out.println("test_cp_scl: " + (end - start)); 43.704 + start = System.currentTimeMillis(); 43.705 + for (int i=0; i<ITERS; i++) { 43.706 + test_2ci_scl(a1, a2); 43.707 + } 43.708 + end = System.currentTimeMillis(); 43.709 + System.out.println("test_2ci_scl: " + (end - start)); 43.710 + start = System.currentTimeMillis(); 43.711 + for (int i=0; i<ITERS; i++) { 43.712 + test_2vi_scl(a1, a2, 123, 103); 43.713 + } 43.714 + end = System.currentTimeMillis(); 43.715 + System.out.println("test_2vi_scl: " + (end - start)); 43.716 + 43.717 + start = System.currentTimeMillis(); 43.718 + for (int i=0; i<ITERS; i++) { 43.719 + test_cp_alndst(a1, a2); 43.720 + } 43.721 + end = System.currentTimeMillis(); 43.722 + System.out.println("test_cp_alndst: " + (end - start)); 43.723 + start = System.currentTimeMillis(); 43.724 + for (int i=0; i<ITERS; i++) { 43.725 + test_cp_alnsrc(a1, a2); 43.726 + } 43.727 + end = System.currentTimeMillis(); 43.728 + System.out.println("test_cp_alnsrc: " + (end - start)); 43.729 + start = System.currentTimeMillis(); 43.730 + for (int i=0; i<ITERS; i++) { 43.731 + test_2ci_aln(a1, a2); 43.732 + } 43.733 + end = System.currentTimeMillis(); 43.734 + System.out.println("test_2ci_aln: " + (end - start)); 43.735 + start = System.currentTimeMillis(); 43.736 + for (int i=0; i<ITERS; i++) { 43.737 + test_2vi_aln(a1, a2, 123, 103); 43.738 + } 43.739 + end = System.currentTimeMillis(); 43.740 + System.out.println("test_2vi_aln: " + (end - start)); 43.741 + 43.742 + start = System.currentTimeMillis(); 43.743 + for (int i=0; i<ITERS; i++) { 43.744 + test_cp_unalndst(a1, a2); 43.745 + } 43.746 + end = System.currentTimeMillis(); 43.747 + System.out.println("test_cp_unalndst: " + (end - start)); 43.748 + start = System.currentTimeMillis(); 43.749 + for (int i=0; i<ITERS; i++) { 43.750 + test_cp_unalnsrc(a1, a2); 43.751 + } 43.752 + end = System.currentTimeMillis(); 43.753 + System.out.println("test_cp_unalnsrc: " + (end - start)); 43.754 + start = System.currentTimeMillis(); 43.755 + for (int i=0; i<ITERS; i++) { 43.756 + test_2ci_unaln(a1, a2); 43.757 + } 43.758 + end = System.currentTimeMillis(); 43.759 + System.out.println("test_2ci_unaln: " + (end - start)); 43.760 + start = System.currentTimeMillis(); 43.761 + for (int i=0; i<ITERS; i++) { 43.762 + test_2vi_unaln(a1, a2, 123, 103); 43.763 + } 43.764 + end = System.currentTimeMillis(); 43.765 + System.out.println("test_2vi_unaln: " + (end - start)); 43.766 + 43.767 + return errn; 43.768 + } 43.769 + 43.770 + private final static long byte_offset(int i) { 43.771 + return ((long)i << 2) + BASE; 43.772 + } 43.773 + 43.774 + static void test_ci(int[] a) { 43.775 + for (int i = 0; i < ARRLEN; i+=1) { 43.776 + unsafe.putOrderedInt(a, byte_offset(i), -123); 43.777 + } 43.778 + } 43.779 + static void test_vi(int[] a, int b, int old) { 43.780 + for (int i = 0; i < ARRLEN; i+=1) { 43.781 + unsafe.putOrderedInt(a, byte_offset(i), b); 43.782 + } 43.783 + } 43.784 + static void test_cp(int[] a, int[] b) { 43.785 + for (int i = 0; i < ARRLEN; i+=1) { 43.786 + unsafe.putOrderedInt(a, byte_offset(i), b[i]); 43.787 + } 43.788 + } 43.789 + static void test_2ci(int[] a, int[] b) { 43.790 + for (int i = 0; i < ARRLEN; i+=1) { 43.791 + unsafe.putOrderedInt(a, byte_offset(i), -123); 43.792 + unsafe.putOrderedInt(b, byte_offset(i), -103); 43.793 + } 43.794 + } 43.795 + static void test_2vi(int[] a, int[] b, int c, int d) { 43.796 + for (int i = 0; i < ARRLEN; i+=1) { 43.797 + unsafe.putOrderedInt(a, byte_offset(i), c); 43.798 + unsafe.putOrderedInt(b, byte_offset(i), d); 43.799 + } 43.800 + } 43.801 + static void test_ci_neg(int[] a, int old) { 43.802 + for (int i = ARRLEN-1; i >= 0; i-=1) { 43.803 + unsafe.putOrderedInt(a, byte_offset(i), -123); 43.804 + } 43.805 + } 43.806 + static void test_vi_neg(int[] a, int b, int old) { 43.807 + for (int i = ARRLEN-1; i >= 0; i-=1) { 43.808 + unsafe.putOrderedInt(a, byte_offset(i), b); 43.809 + } 43.810 + } 43.811 + static void test_cp_neg(int[] a, int[] b) { 43.812 + for (int i = ARRLEN-1; i >= 0; i-=1) { 43.813 + unsafe.putOrderedInt(a, byte_offset(i), b[i]); 43.814 + } 43.815 + } 43.816 + static void test_2ci_neg(int[] a, int[] b) { 43.817 + for (int i = ARRLEN-1; i >= 0; i-=1) { 43.818 + unsafe.putOrderedInt(a, byte_offset(i), -123); 43.819 + unsafe.putOrderedInt(b, byte_offset(i), -103); 43.820 + } 43.821 + } 43.822 + static void test_2vi_neg(int[] a, int[] b, int c, int d) { 43.823 + for (int i = ARRLEN-1; i >= 0; i-=1) { 43.824 + unsafe.putOrderedInt(a, byte_offset(i), c); 43.825 + unsafe.putOrderedInt(b, byte_offset(i), d); 43.826 + } 43.827 + } 43.828 + static void test_ci_oppos(int[] a, int old) { 43.829 + int limit = ARRLEN-1; 43.830 + for (int i = 0; i < ARRLEN; i+=1) { 43.831 + unsafe.putOrderedInt(a, byte_offset(limit-i), -123); 43.832 + } 43.833 + } 43.834 + static void test_vi_oppos(int[] a, int b, int old) { 43.835 + int limit = ARRLEN-1; 43.836 + for (int i = limit; i >= 0; i-=1) { 43.837 + unsafe.putOrderedInt(a, byte_offset(limit-i), b); 43.838 + } 43.839 + } 43.840 + static void test_cp_oppos(int[] a, int[] b) { 43.841 + int limit = ARRLEN-1; 43.842 + for (int i = 0; i < ARRLEN; i+=1) { 43.843 + unsafe.putOrderedInt(a, byte_offset(i), b[limit-i]); 43.844 + } 43.845 + } 43.846 + static void test_2ci_oppos(int[] a, int[] b) { 43.847 + int limit = ARRLEN-1; 43.848 + for (int i = 0; i < ARRLEN; i+=1) { 43.849 + unsafe.putOrderedInt(a, byte_offset(limit-i), -123); 43.850 + unsafe.putOrderedInt(b, byte_offset(i), -103); 43.851 + } 43.852 + } 43.853 + static void test_2vi_oppos(int[] a, int[] b, int c, int d) { 43.854 + int limit = ARRLEN-1; 43.855 + for (int i = limit; i >= 0; i-=1) { 43.856 + unsafe.putOrderedInt(a, byte_offset(i), c); 43.857 + unsafe.putOrderedInt(b, byte_offset(limit-i), d); 43.858 + } 43.859 + } 43.860 + static void test_ci_off(int[] a, int old) { 43.861 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 43.862 + unsafe.putOrderedInt(a, byte_offset(i+OFFSET), -123); 43.863 + } 43.864 + } 43.865 + static void test_vi_off(int[] a, int b, int old) { 43.866 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 43.867 + unsafe.putOrderedInt(a, byte_offset(i+OFFSET), b); 43.868 + } 43.869 + } 43.870 + static void test_cp_off(int[] a, int[] b) { 43.871 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 43.872 + unsafe.putOrderedInt(a, byte_offset(i+OFFSET), b[i+OFFSET]); 43.873 + } 43.874 + } 43.875 + static void test_2ci_off(int[] a, int[] b) { 43.876 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 43.877 + unsafe.putOrderedInt(a, byte_offset(i+OFFSET), -123); 43.878 + unsafe.putOrderedInt(b, byte_offset(i+OFFSET), -103); 43.879 + } 43.880 + } 43.881 + static void test_2vi_off(int[] a, int[] b, int c, int d) { 43.882 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 43.883 + unsafe.putOrderedInt(a, byte_offset(i+OFFSET), c); 43.884 + unsafe.putOrderedInt(b, byte_offset(i+OFFSET), d); 43.885 + } 43.886 + } 43.887 + static void test_ci_inv(int[] a, int k, int old) { 43.888 + for (int i = 0; i < ARRLEN-k; i+=1) { 43.889 + unsafe.putOrderedInt(a, byte_offset(i+k), -123); 43.890 + } 43.891 + } 43.892 + static void test_vi_inv(int[] a, int b, int k, int old) { 43.893 + for (int i = 0; i < ARRLEN-k; i+=1) { 43.894 + unsafe.putOrderedInt(a, byte_offset(i+k), b); 43.895 + } 43.896 + } 43.897 + static void test_cp_inv(int[] a, int[] b, int k) { 43.898 + for (int i = 0; i < ARRLEN-k; i+=1) { 43.899 + unsafe.putOrderedInt(a, byte_offset(i+k), b[i+k]); 43.900 + } 43.901 + } 43.902 + static void test_2ci_inv(int[] a, int[] b, int k) { 43.903 + for (int i = 0; i < ARRLEN-k; i+=1) { 43.904 + unsafe.putOrderedInt(a, byte_offset(i+k), -123); 43.905 + unsafe.putOrderedInt(b, byte_offset(i+k), -103); 43.906 + } 43.907 + } 43.908 + static void test_2vi_inv(int[] a, int[] b, int c, int d, int k) { 43.909 + for (int i = 0; i < ARRLEN-k; i+=1) { 43.910 + unsafe.putOrderedInt(a, byte_offset(i+k), c); 43.911 + unsafe.putOrderedInt(b, byte_offset(i+k), d); 43.912 + } 43.913 + } 43.914 + static void test_ci_scl(int[] a, int old) { 43.915 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 43.916 + unsafe.putOrderedInt(a, byte_offset(i*SCALE), -123); 43.917 + } 43.918 + } 43.919 + static void test_vi_scl(int[] a, int b, int old) { 43.920 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 43.921 + unsafe.putOrderedInt(a, byte_offset(i*SCALE), b); 43.922 + } 43.923 + } 43.924 + static void test_cp_scl(int[] a, int[] b) { 43.925 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 43.926 + unsafe.putOrderedInt(a, byte_offset(i*SCALE), b[i*SCALE]); 43.927 + } 43.928 + } 43.929 + static void test_2ci_scl(int[] a, int[] b) { 43.930 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 43.931 + unsafe.putOrderedInt(a, byte_offset(i*SCALE), -123); 43.932 + unsafe.putOrderedInt(b, byte_offset(i*SCALE), -103); 43.933 + } 43.934 + } 43.935 + static void test_2vi_scl(int[] a, int[] b, int c, int d) { 43.936 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 43.937 + unsafe.putOrderedInt(a, byte_offset(i*SCALE), c); 43.938 + unsafe.putOrderedInt(b, byte_offset(i*SCALE), d); 43.939 + } 43.940 + } 43.941 + static void test_cp_alndst(int[] a, int[] b) { 43.942 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 43.943 + unsafe.putOrderedInt(a, byte_offset(i+ALIGN_OFF), b[i]); 43.944 + } 43.945 + } 43.946 + static void test_cp_alnsrc(int[] a, int[] b) { 43.947 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 43.948 + unsafe.putOrderedInt(a, byte_offset(i), b[i+ALIGN_OFF]); 43.949 + } 43.950 + } 43.951 + static void test_2ci_aln(int[] a, int[] b) { 43.952 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 43.953 + unsafe.putOrderedInt(a, byte_offset(i+ALIGN_OFF), -123); 43.954 + unsafe.putOrderedInt(b, byte_offset(i), -103); 43.955 + } 43.956 + } 43.957 + static void test_2vi_aln(int[] a, int[] b, int c, int d) { 43.958 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 43.959 + unsafe.putOrderedInt(a, byte_offset(i), c); 43.960 + unsafe.putOrderedInt(b, byte_offset(i+ALIGN_OFF), d); 43.961 + } 43.962 + } 43.963 + static void test_cp_unalndst(int[] a, int[] b) { 43.964 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 43.965 + unsafe.putOrderedInt(a, byte_offset(i+UNALIGN_OFF), b[i]); 43.966 + } 43.967 + } 43.968 + static void test_cp_unalnsrc(int[] a, int[] b) { 43.969 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 43.970 + unsafe.putOrderedInt(a, byte_offset(i), b[i+UNALIGN_OFF]); 43.971 + } 43.972 + } 43.973 + static void test_2ci_unaln(int[] a, int[] b) { 43.974 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 43.975 + unsafe.putOrderedInt(a, byte_offset(i+UNALIGN_OFF), -123); 43.976 + unsafe.putOrderedInt(b, byte_offset(i), -103); 43.977 + } 43.978 + } 43.979 + static void test_2vi_unaln(int[] a, int[] b, int c, int d) { 43.980 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 43.981 + unsafe.putOrderedInt(a, byte_offset(i), c); 43.982 + unsafe.putOrderedInt(b, byte_offset(i+UNALIGN_OFF), d); 43.983 + } 43.984 + } 43.985 + 43.986 + static int verify(String text, int i, int elem, int val) { 43.987 + if (elem != val) { 43.988 + System.err.println(text + "[" + i + "] = " + elem + " != " + val); 43.989 + return 1; 43.990 + } 43.991 + return 0; 43.992 + } 43.993 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 44.2 +++ b/test/compiler/8004867/TestIntUnsafeVolatile.java Tue Feb 26 11:52:06 2013 +0100 44.3 @@ -0,0 +1,990 @@ 44.4 +/* 44.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 44.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 44.7 + * 44.8 + * This code is free software; you can redistribute it and/or modify it 44.9 + * under the terms of the GNU General Public License version 2 only, as 44.10 + * published by the Free Software Foundation. 44.11 + * 44.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 44.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 44.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 44.15 + * version 2 for more details (a copy is included in the LICENSE file that 44.16 + * accompanied this code). 44.17 + * 44.18 + * You should have received a copy of the GNU General Public License version 44.19 + * 2 along with this work; if not, write to the Free Software Foundation, 44.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 44.21 + * 44.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 44.23 + * or visit www.oracle.com if you need additional information or have any 44.24 + * questions. 44.25 + * 44.26 + */ 44.27 + 44.28 +/** 44.29 + * @test 44.30 + * @bug 8004867 44.31 + * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" 44.32 + * 44.33 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeVolatile 44.34 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeVolatile 44.35 + */ 44.36 + 44.37 +import sun.misc.Unsafe; 44.38 +import java.lang.reflect.*; 44.39 + 44.40 +public class TestIntUnsafeVolatile { 44.41 + private static final int ARRLEN = 97; 44.42 + private static final int ITERS = 11000; 44.43 + private static final int OFFSET = 3; 44.44 + private static final int SCALE = 2; 44.45 + private static final int ALIGN_OFF = 8; 44.46 + private static final int UNALIGN_OFF = 5; 44.47 + 44.48 + private static final Unsafe unsafe; 44.49 + private static final int BASE; 44.50 + static { 44.51 + try { 44.52 + Class c = TestIntUnsafeVolatile.class.getClassLoader().loadClass("sun.misc.Unsafe"); 44.53 + Field f = c.getDeclaredField("theUnsafe"); 44.54 + f.setAccessible(true); 44.55 + unsafe = (Unsafe)f.get(c); 44.56 + BASE = unsafe.arrayBaseOffset(int[].class); 44.57 + } catch (Exception e) { 44.58 + InternalError err = new InternalError(); 44.59 + err.initCause(e); 44.60 + throw err; 44.61 + } 44.62 + } 44.63 + 44.64 + public static void main(String args[]) { 44.65 + System.out.println("Testing Integer array unsafe volatile operations"); 44.66 + int errn = test(false); 44.67 + if (errn > 0) { 44.68 + System.err.println("FAILED: " + errn + " errors"); 44.69 + System.exit(97); 44.70 + } 44.71 + System.out.println("PASSED"); 44.72 + } 44.73 + 44.74 + static int test(boolean test_only) { 44.75 + int[] a1 = new int[ARRLEN]; 44.76 + int[] a2 = new int[ARRLEN]; 44.77 + // Initialize 44.78 + for (int i=0; i<ARRLEN; i++) { 44.79 + a1[i] = -1; 44.80 + a2[i] = -1; 44.81 + } 44.82 + System.out.println("Warmup"); 44.83 + for (int i=0; i<ITERS; i++) { 44.84 + test_ci(a1); 44.85 + test_vi(a2, 123, -1); 44.86 + test_cp(a1, a2); 44.87 + test_2ci(a1, a2); 44.88 + test_2vi(a1, a2, 123, 103); 44.89 + test_ci_neg(a1, 123); 44.90 + test_vi_neg(a2, 123, 103); 44.91 + test_cp_neg(a1, a2); 44.92 + test_2ci_neg(a1, a2); 44.93 + test_2vi_neg(a1, a2, 123, 103); 44.94 + test_ci_oppos(a1, 123); 44.95 + test_vi_oppos(a2, 123, 103); 44.96 + test_cp_oppos(a1, a2); 44.97 + test_2ci_oppos(a1, a2); 44.98 + test_2vi_oppos(a1, a2, 123, 103); 44.99 + test_ci_off(a1, 123); 44.100 + test_vi_off(a2, 123, 103); 44.101 + test_cp_off(a1, a2); 44.102 + test_2ci_off(a1, a2); 44.103 + test_2vi_off(a1, a2, 123, 103); 44.104 + test_ci_inv(a1, OFFSET, 123); 44.105 + test_vi_inv(a2, 123, OFFSET, 103); 44.106 + test_cp_inv(a1, a2, OFFSET); 44.107 + test_2ci_inv(a1, a2, OFFSET); 44.108 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 44.109 + test_ci_scl(a1, 123); 44.110 + test_vi_scl(a2, 123, 103); 44.111 + test_cp_scl(a1, a2); 44.112 + test_2ci_scl(a1, a2); 44.113 + test_2vi_scl(a1, a2, 123, 103); 44.114 + test_cp_alndst(a1, a2); 44.115 + test_cp_alnsrc(a1, a2); 44.116 + test_2ci_aln(a1, a2); 44.117 + test_2vi_aln(a1, a2, 123, 103); 44.118 + test_cp_unalndst(a1, a2); 44.119 + test_cp_unalnsrc(a1, a2); 44.120 + test_2ci_unaln(a1, a2); 44.121 + test_2vi_unaln(a1, a2, 123, 103); 44.122 + } 44.123 + // Initialize 44.124 + for (int i=0; i<ARRLEN; i++) { 44.125 + a1[i] = -1; 44.126 + a2[i] = -1; 44.127 + } 44.128 + // Test and verify results 44.129 + System.out.println("Verification"); 44.130 + int errn = 0; 44.131 + { 44.132 + test_ci(a1); 44.133 + for (int i=0; i<ARRLEN; i++) { 44.134 + errn += verify("test_ci: a1", i, a1[i], -123); 44.135 + } 44.136 + test_vi(a2, 123, -1); 44.137 + for (int i=0; i<ARRLEN; i++) { 44.138 + errn += verify("test_vi: a2", i, a2[i], 123); 44.139 + } 44.140 + test_cp(a1, a2); 44.141 + for (int i=0; i<ARRLEN; i++) { 44.142 + errn += verify("test_cp: a1", i, a1[i], 123); 44.143 + } 44.144 + test_2ci(a1, a2); 44.145 + for (int i=0; i<ARRLEN; i++) { 44.146 + errn += verify("test_2ci: a1", i, a1[i], -123); 44.147 + errn += verify("test_2ci: a2", i, a2[i], -103); 44.148 + } 44.149 + test_2vi(a1, a2, 123, 103); 44.150 + for (int i=0; i<ARRLEN; i++) { 44.151 + errn += verify("test_2vi: a1", i, a1[i], 123); 44.152 + errn += verify("test_2vi: a2", i, a2[i], 103); 44.153 + } 44.154 + // Reset for negative stride 44.155 + for (int i=0; i<ARRLEN; i++) { 44.156 + a1[i] = -1; 44.157 + a2[i] = -1; 44.158 + } 44.159 + test_ci_neg(a1, -1); 44.160 + for (int i=0; i<ARRLEN; i++) { 44.161 + errn += verify("test_ci_neg: a1", i, a1[i], -123); 44.162 + } 44.163 + test_vi_neg(a2, 123, -1); 44.164 + for (int i=0; i<ARRLEN; i++) { 44.165 + errn += verify("test_vi_neg: a2", i, a2[i], 123); 44.166 + } 44.167 + test_cp_neg(a1, a2); 44.168 + for (int i=0; i<ARRLEN; i++) { 44.169 + errn += verify("test_cp_neg: a1", i, a1[i], 123); 44.170 + } 44.171 + test_2ci_neg(a1, a2); 44.172 + for (int i=0; i<ARRLEN; i++) { 44.173 + errn += verify("test_2ci_neg: a1", i, a1[i], -123); 44.174 + errn += verify("test_2ci_neg: a2", i, a2[i], -103); 44.175 + } 44.176 + test_2vi_neg(a1, a2, 123, 103); 44.177 + for (int i=0; i<ARRLEN; i++) { 44.178 + errn += verify("test_2vi_neg: a1", i, a1[i], 123); 44.179 + errn += verify("test_2vi_neg: a2", i, a2[i], 103); 44.180 + } 44.181 + // Reset for opposite stride 44.182 + for (int i=0; i<ARRLEN; i++) { 44.183 + a1[i] = -1; 44.184 + a2[i] = -1; 44.185 + } 44.186 + test_ci_oppos(a1, -1); 44.187 + for (int i=0; i<ARRLEN; i++) { 44.188 + errn += verify("test_ci_oppos: a1", i, a1[i], -123); 44.189 + } 44.190 + test_vi_oppos(a2, 123, -1); 44.191 + for (int i=0; i<ARRLEN; i++) { 44.192 + errn += verify("test_vi_oppos: a2", i, a2[i], 123); 44.193 + } 44.194 + test_cp_oppos(a1, a2); 44.195 + for (int i=0; i<ARRLEN; i++) { 44.196 + errn += verify("test_cp_oppos: a1", i, a1[i], 123); 44.197 + } 44.198 + test_2ci_oppos(a1, a2); 44.199 + for (int i=0; i<ARRLEN; i++) { 44.200 + errn += verify("test_2ci_oppos: a1", i, a1[i], -123); 44.201 + errn += verify("test_2ci_oppos: a2", i, a2[i], -103); 44.202 + } 44.203 + test_2vi_oppos(a1, a2, 123, 103); 44.204 + for (int i=0; i<ARRLEN; i++) { 44.205 + errn += verify("test_2vi_oppos: a1", i, a1[i], 123); 44.206 + errn += verify("test_2vi_oppos: a2", i, a2[i], 103); 44.207 + } 44.208 + // Reset for indexing with offset 44.209 + for (int i=0; i<ARRLEN; i++) { 44.210 + a1[i] = -1; 44.211 + a2[i] = -1; 44.212 + } 44.213 + test_ci_off(a1, -1); 44.214 + for (int i=OFFSET; i<ARRLEN; i++) { 44.215 + errn += verify("test_ci_off: a1", i, a1[i], -123); 44.216 + } 44.217 + test_vi_off(a2, 123, -1); 44.218 + for (int i=OFFSET; i<ARRLEN; i++) { 44.219 + errn += verify("test_vi_off: a2", i, a2[i], 123); 44.220 + } 44.221 + test_cp_off(a1, a2); 44.222 + for (int i=OFFSET; i<ARRLEN; i++) { 44.223 + errn += verify("test_cp_off: a1", i, a1[i], 123); 44.224 + } 44.225 + test_2ci_off(a1, a2); 44.226 + for (int i=OFFSET; i<ARRLEN; i++) { 44.227 + errn += verify("test_2ci_off: a1", i, a1[i], -123); 44.228 + errn += verify("test_2ci_off: a2", i, a2[i], -103); 44.229 + } 44.230 + test_2vi_off(a1, a2, 123, 103); 44.231 + for (int i=OFFSET; i<ARRLEN; i++) { 44.232 + errn += verify("test_2vi_off: a1", i, a1[i], 123); 44.233 + errn += verify("test_2vi_off: a2", i, a2[i], 103); 44.234 + } 44.235 + for (int i=0; i<OFFSET; i++) { 44.236 + errn += verify("test_2vi_off: a1", i, a1[i], -1); 44.237 + errn += verify("test_2vi_off: a2", i, a2[i], -1); 44.238 + } 44.239 + // Reset for indexing with invariant offset 44.240 + for (int i=0; i<ARRLEN; i++) { 44.241 + a1[i] = -1; 44.242 + a2[i] = -1; 44.243 + } 44.244 + test_ci_inv(a1, OFFSET, -1); 44.245 + for (int i=OFFSET; i<ARRLEN; i++) { 44.246 + errn += verify("test_ci_inv: a1", i, a1[i], -123); 44.247 + } 44.248 + test_vi_inv(a2, 123, OFFSET, -1); 44.249 + for (int i=OFFSET; i<ARRLEN; i++) { 44.250 + errn += verify("test_vi_inv: a2", i, a2[i], 123); 44.251 + } 44.252 + test_cp_inv(a1, a2, OFFSET); 44.253 + for (int i=OFFSET; i<ARRLEN; i++) { 44.254 + errn += verify("test_cp_inv: a1", i, a1[i], 123); 44.255 + } 44.256 + test_2ci_inv(a1, a2, OFFSET); 44.257 + for (int i=OFFSET; i<ARRLEN; i++) { 44.258 + errn += verify("test_2ci_inv: a1", i, a1[i], -123); 44.259 + errn += verify("test_2ci_inv: a2", i, a2[i], -103); 44.260 + } 44.261 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 44.262 + for (int i=OFFSET; i<ARRLEN; i++) { 44.263 + errn += verify("test_2vi_inv: a1", i, a1[i], 123); 44.264 + errn += verify("test_2vi_inv: a2", i, a2[i], 103); 44.265 + } 44.266 + for (int i=0; i<OFFSET; i++) { 44.267 + errn += verify("test_2vi_inv: a1", i, a1[i], -1); 44.268 + errn += verify("test_2vi_inv: a2", i, a2[i], -1); 44.269 + } 44.270 + // Reset for indexing with scale 44.271 + for (int i=0; i<ARRLEN; i++) { 44.272 + a1[i] = -1; 44.273 + a2[i] = -1; 44.274 + } 44.275 + test_ci_scl(a1, -1); 44.276 + for (int i=0; i<ARRLEN; i++) { 44.277 + int val = (i%SCALE != 0) ? -1 : -123; 44.278 + errn += verify("test_ci_scl: a1", i, a1[i], val); 44.279 + } 44.280 + test_vi_scl(a2, 123, -1); 44.281 + for (int i=0; i<ARRLEN; i++) { 44.282 + int val = (i%SCALE != 0) ? -1 : 123; 44.283 + errn += verify("test_vi_scl: a2", i, a2[i], val); 44.284 + } 44.285 + test_cp_scl(a1, a2); 44.286 + for (int i=0; i<ARRLEN; i++) { 44.287 + int val = (i%SCALE != 0) ? -1 : 123; 44.288 + errn += verify("test_cp_scl: a1", i, a1[i], val); 44.289 + } 44.290 + test_2ci_scl(a1, a2); 44.291 + for (int i=0; i<ARRLEN; i++) { 44.292 + if (i%SCALE != 0) { 44.293 + errn += verify("test_2ci_scl: a1", i, a1[i], -1); 44.294 + } else if (i*SCALE < ARRLEN) { 44.295 + errn += verify("test_2ci_scl: a1", i*SCALE, a1[i*SCALE], -123); 44.296 + } 44.297 + if (i%SCALE != 0) { 44.298 + errn += verify("test_2ci_scl: a2", i, a2[i], -1); 44.299 + } else if (i*SCALE < ARRLEN) { 44.300 + errn += verify("test_2ci_scl: a2", i*SCALE, a2[i*SCALE], -103); 44.301 + } 44.302 + } 44.303 + test_2vi_scl(a1, a2, 123, 103); 44.304 + for (int i=0; i<ARRLEN; i++) { 44.305 + if (i%SCALE != 0) { 44.306 + errn += verify("test_2vi_scl: a1", i, a1[i], -1); 44.307 + } else if (i*SCALE < ARRLEN) { 44.308 + errn += verify("test_2vi_scl: a1", i*SCALE, a1[i*SCALE], 123); 44.309 + } 44.310 + if (i%SCALE != 0) { 44.311 + errn += verify("test_2vi_scl: a2", i, a2[i], -1); 44.312 + } else if (i*SCALE < ARRLEN) { 44.313 + errn += verify("test_2vi_scl: a2", i*SCALE, a2[i*SCALE], 103); 44.314 + } 44.315 + } 44.316 + // Reset for 2 arrays with relative aligned offset 44.317 + for (int i=0; i<ARRLEN; i++) { 44.318 + a1[i] = -1; 44.319 + a2[i] = -1; 44.320 + } 44.321 + test_vi(a2, 123, -1); 44.322 + test_cp_alndst(a1, a2); 44.323 + for (int i=0; i<ALIGN_OFF; i++) { 44.324 + errn += verify("test_cp_alndst: a1", i, a1[i], -1); 44.325 + } 44.326 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 44.327 + errn += verify("test_cp_alndst: a1", i, a1[i], 123); 44.328 + } 44.329 + for (int i=0; i<ALIGN_OFF; i++) { 44.330 + a1[i] = 123; 44.331 + } 44.332 + test_vi(a2, -123, 123); 44.333 + test_cp_alnsrc(a1, a2); 44.334 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 44.335 + errn += verify("test_cp_alnsrc: a1", i, a1[i], -123); 44.336 + } 44.337 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 44.338 + errn += verify("test_cp_alnsrc: a1", i, a1[i], 123); 44.339 + } 44.340 + for (int i=0; i<ARRLEN; i++) { 44.341 + a1[i] = -1; 44.342 + a2[i] = -1; 44.343 + } 44.344 + test_2ci_aln(a1, a2); 44.345 + for (int i=0; i<ALIGN_OFF; i++) { 44.346 + errn += verify("test_2ci_aln: a1", i, a1[i], -1); 44.347 + } 44.348 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 44.349 + errn += verify("test_2ci_aln: a1", i, a1[i], -123); 44.350 + } 44.351 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 44.352 + errn += verify("test_2ci_aln: a2", i, a2[i], -103); 44.353 + } 44.354 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 44.355 + errn += verify("test_2ci_aln: a2", i, a2[i], -1); 44.356 + } 44.357 + for (int i=0; i<ARRLEN; i++) { 44.358 + a1[i] = -1; 44.359 + a2[i] = -1; 44.360 + } 44.361 + test_2vi_aln(a1, a2, 123, 103); 44.362 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 44.363 + errn += verify("test_2vi_aln: a1", i, a1[i], 123); 44.364 + } 44.365 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 44.366 + errn += verify("test_2vi_aln: a1", i, a1[i], -1); 44.367 + } 44.368 + for (int i=0; i<ALIGN_OFF; i++) { 44.369 + errn += verify("test_2vi_aln: a2", i, a2[i], -1); 44.370 + } 44.371 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 44.372 + errn += verify("test_2vi_aln: a2", i, a2[i], 103); 44.373 + } 44.374 + 44.375 + // Reset for 2 arrays with relative unaligned offset 44.376 + for (int i=0; i<ARRLEN; i++) { 44.377 + a1[i] = -1; 44.378 + a2[i] = -1; 44.379 + } 44.380 + test_vi(a2, 123, -1); 44.381 + test_cp_unalndst(a1, a2); 44.382 + for (int i=0; i<UNALIGN_OFF; i++) { 44.383 + errn += verify("test_cp_unalndst: a1", i, a1[i], -1); 44.384 + } 44.385 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 44.386 + errn += verify("test_cp_unalndst: a1", i, a1[i], 123); 44.387 + } 44.388 + test_vi(a2, -123, 123); 44.389 + test_cp_unalnsrc(a1, a2); 44.390 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 44.391 + errn += verify("test_cp_unalnsrc: a1", i, a1[i], -123); 44.392 + } 44.393 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 44.394 + errn += verify("test_cp_unalnsrc: a1", i, a1[i], 123); 44.395 + } 44.396 + for (int i=0; i<ARRLEN; i++) { 44.397 + a1[i] = -1; 44.398 + a2[i] = -1; 44.399 + } 44.400 + test_2ci_unaln(a1, a2); 44.401 + for (int i=0; i<UNALIGN_OFF; i++) { 44.402 + errn += verify("test_2ci_unaln: a1", i, a1[i], -1); 44.403 + } 44.404 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 44.405 + errn += verify("test_2ci_unaln: a1", i, a1[i], -123); 44.406 + } 44.407 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 44.408 + errn += verify("test_2ci_unaln: a2", i, a2[i], -103); 44.409 + } 44.410 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 44.411 + errn += verify("test_2ci_unaln: a2", i, a2[i], -1); 44.412 + } 44.413 + for (int i=0; i<ARRLEN; i++) { 44.414 + a1[i] = -1; 44.415 + a2[i] = -1; 44.416 + } 44.417 + test_2vi_unaln(a1, a2, 123, 103); 44.418 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 44.419 + errn += verify("test_2vi_unaln: a1", i, a1[i], 123); 44.420 + } 44.421 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 44.422 + errn += verify("test_2vi_unaln: a1", i, a1[i], -1); 44.423 + } 44.424 + for (int i=0; i<UNALIGN_OFF; i++) { 44.425 + errn += verify("test_2vi_unaln: a2", i, a2[i], -1); 44.426 + } 44.427 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 44.428 + errn += verify("test_2vi_unaln: a2", i, a2[i], 103); 44.429 + } 44.430 + 44.431 + // Reset for aligned overlap initialization 44.432 + for (int i=0; i<ALIGN_OFF; i++) { 44.433 + a1[i] = i; 44.434 + } 44.435 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 44.436 + a1[i] = -1; 44.437 + } 44.438 + test_cp_alndst(a1, a1); 44.439 + for (int i=0; i<ARRLEN; i++) { 44.440 + int v = i%ALIGN_OFF; 44.441 + errn += verify("test_cp_alndst_overlap: a1", i, a1[i], v); 44.442 + } 44.443 + for (int i=0; i<ALIGN_OFF; i++) { 44.444 + a1[i+ALIGN_OFF] = -1; 44.445 + } 44.446 + test_cp_alnsrc(a1, a1); 44.447 + for (int i=0; i<ALIGN_OFF; i++) { 44.448 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], -1); 44.449 + } 44.450 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 44.451 + int v = i%ALIGN_OFF; 44.452 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], v); 44.453 + } 44.454 + for (int i=0; i<ARRLEN; i++) { 44.455 + a1[i] = -1; 44.456 + } 44.457 + test_2ci_aln(a1, a1); 44.458 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 44.459 + errn += verify("test_2ci_aln_overlap: a1", i, a1[i], -103); 44.460 + } 44.461 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 44.462 + errn += verify("test_2ci_aln_overlap: a1", i, a1[i], -123); 44.463 + } 44.464 + for (int i=0; i<ARRLEN; i++) { 44.465 + a1[i] = -1; 44.466 + } 44.467 + test_2vi_aln(a1, a1, 123, 103); 44.468 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 44.469 + errn += verify("test_2vi_aln_overlap: a1", i, a1[i], 123); 44.470 + } 44.471 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 44.472 + errn += verify("test_2vi_aln_overlap: a1", i, a1[i], 103); 44.473 + } 44.474 + 44.475 + // Reset for unaligned overlap initialization 44.476 + for (int i=0; i<UNALIGN_OFF; i++) { 44.477 + a1[i] = i; 44.478 + } 44.479 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 44.480 + a1[i] = -1; 44.481 + } 44.482 + test_cp_unalndst(a1, a1); 44.483 + for (int i=0; i<ARRLEN; i++) { 44.484 + int v = i%UNALIGN_OFF; 44.485 + errn += verify("test_cp_unalndst_overlap: a1", i, a1[i], v); 44.486 + } 44.487 + for (int i=0; i<UNALIGN_OFF; i++) { 44.488 + a1[i+UNALIGN_OFF] = -1; 44.489 + } 44.490 + test_cp_unalnsrc(a1, a1); 44.491 + for (int i=0; i<UNALIGN_OFF; i++) { 44.492 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], -1); 44.493 + } 44.494 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 44.495 + int v = i%UNALIGN_OFF; 44.496 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], v); 44.497 + } 44.498 + for (int i=0; i<ARRLEN; i++) { 44.499 + a1[i] = -1; 44.500 + } 44.501 + test_2ci_unaln(a1, a1); 44.502 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 44.503 + errn += verify("test_2ci_unaln_overlap: a1", i, a1[i], -103); 44.504 + } 44.505 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 44.506 + errn += verify("test_2ci_unaln_overlap: a1", i, a1[i], -123); 44.507 + } 44.508 + for (int i=0; i<ARRLEN; i++) { 44.509 + a1[i] = -1; 44.510 + } 44.511 + test_2vi_unaln(a1, a1, 123, 103); 44.512 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 44.513 + errn += verify("test_2vi_unaln_overlap: a1", i, a1[i], 123); 44.514 + } 44.515 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 44.516 + errn += verify("test_2vi_unaln_overlap: a1", i, a1[i], 103); 44.517 + } 44.518 + 44.519 + } 44.520 + 44.521 + if (errn > 0 || test_only) 44.522 + return errn; 44.523 + 44.524 + // Initialize 44.525 + for (int i=0; i<ARRLEN; i++) { 44.526 + a1[i] = -1; 44.527 + a2[i] = -1; 44.528 + } 44.529 + System.out.println("Time"); 44.530 + long start, end; 44.531 + start = System.currentTimeMillis(); 44.532 + for (int i=0; i<ITERS; i++) { 44.533 + test_ci(a1); 44.534 + } 44.535 + end = System.currentTimeMillis(); 44.536 + System.out.println("test_ci: " + (end - start)); 44.537 + start = System.currentTimeMillis(); 44.538 + for (int i=0; i<ITERS; i++) { 44.539 + test_vi(a2, 123, -1); 44.540 + } 44.541 + end = System.currentTimeMillis(); 44.542 + System.out.println("test_vi: " + (end - start)); 44.543 + start = System.currentTimeMillis(); 44.544 + for (int i=0; i<ITERS; i++) { 44.545 + test_cp(a1, a2); 44.546 + } 44.547 + end = System.currentTimeMillis(); 44.548 + System.out.println("test_cp: " + (end - start)); 44.549 + start = System.currentTimeMillis(); 44.550 + for (int i=0; i<ITERS; i++) { 44.551 + test_2ci(a1, a2); 44.552 + } 44.553 + end = System.currentTimeMillis(); 44.554 + System.out.println("test_2ci: " + (end - start)); 44.555 + start = System.currentTimeMillis(); 44.556 + for (int i=0; i<ITERS; i++) { 44.557 + test_2vi(a1, a2, 123, 103); 44.558 + } 44.559 + end = System.currentTimeMillis(); 44.560 + System.out.println("test_2vi: " + (end - start)); 44.561 + 44.562 + start = System.currentTimeMillis(); 44.563 + for (int i=0; i<ITERS; i++) { 44.564 + test_ci_neg(a1, 123); 44.565 + } 44.566 + end = System.currentTimeMillis(); 44.567 + System.out.println("test_ci_neg: " + (end - start)); 44.568 + start = System.currentTimeMillis(); 44.569 + for (int i=0; i<ITERS; i++) { 44.570 + test_vi_neg(a2, 123, 103); 44.571 + } 44.572 + end = System.currentTimeMillis(); 44.573 + System.out.println("test_vi_neg: " + (end - start)); 44.574 + start = System.currentTimeMillis(); 44.575 + for (int i=0; i<ITERS; i++) { 44.576 + test_cp_neg(a1, a2); 44.577 + } 44.578 + end = System.currentTimeMillis(); 44.579 + System.out.println("test_cp_neg: " + (end - start)); 44.580 + start = System.currentTimeMillis(); 44.581 + for (int i=0; i<ITERS; i++) { 44.582 + test_2ci_neg(a1, a2); 44.583 + } 44.584 + end = System.currentTimeMillis(); 44.585 + System.out.println("test_2ci_neg: " + (end - start)); 44.586 + start = System.currentTimeMillis(); 44.587 + for (int i=0; i<ITERS; i++) { 44.588 + test_2vi_neg(a1, a2, 123, 103); 44.589 + } 44.590 + end = System.currentTimeMillis(); 44.591 + System.out.println("test_2vi_neg: " + (end - start)); 44.592 + 44.593 + start = System.currentTimeMillis(); 44.594 + for (int i=0; i<ITERS; i++) { 44.595 + test_ci_oppos(a1, 123); 44.596 + } 44.597 + end = System.currentTimeMillis(); 44.598 + System.out.println("test_ci_oppos: " + (end - start)); 44.599 + start = System.currentTimeMillis(); 44.600 + for (int i=0; i<ITERS; i++) { 44.601 + test_vi_oppos(a2, 123, 103); 44.602 + } 44.603 + end = System.currentTimeMillis(); 44.604 + System.out.println("test_vi_oppos: " + (end - start)); 44.605 + start = System.currentTimeMillis(); 44.606 + for (int i=0; i<ITERS; i++) { 44.607 + test_cp_oppos(a1, a2); 44.608 + } 44.609 + end = System.currentTimeMillis(); 44.610 + System.out.println("test_cp_oppos: " + (end - start)); 44.611 + start = System.currentTimeMillis(); 44.612 + for (int i=0; i<ITERS; i++) { 44.613 + test_2ci_oppos(a1, a2); 44.614 + } 44.615 + end = System.currentTimeMillis(); 44.616 + System.out.println("test_2ci_oppos: " + (end - start)); 44.617 + start = System.currentTimeMillis(); 44.618 + for (int i=0; i<ITERS; i++) { 44.619 + test_2vi_oppos(a1, a2, 123, 103); 44.620 + } 44.621 + end = System.currentTimeMillis(); 44.622 + System.out.println("test_2vi_oppos: " + (end - start)); 44.623 + 44.624 + start = System.currentTimeMillis(); 44.625 + for (int i=0; i<ITERS; i++) { 44.626 + test_ci_off(a1, 123); 44.627 + } 44.628 + end = System.currentTimeMillis(); 44.629 + System.out.println("test_ci_off: " + (end - start)); 44.630 + start = System.currentTimeMillis(); 44.631 + for (int i=0; i<ITERS; i++) { 44.632 + test_vi_off(a2, 123, 103); 44.633 + } 44.634 + end = System.currentTimeMillis(); 44.635 + System.out.println("test_vi_off: " + (end - start)); 44.636 + start = System.currentTimeMillis(); 44.637 + for (int i=0; i<ITERS; i++) { 44.638 + test_cp_off(a1, a2); 44.639 + } 44.640 + end = System.currentTimeMillis(); 44.641 + System.out.println("test_cp_off: " + (end - start)); 44.642 + start = System.currentTimeMillis(); 44.643 + for (int i=0; i<ITERS; i++) { 44.644 + test_2ci_off(a1, a2); 44.645 + } 44.646 + end = System.currentTimeMillis(); 44.647 + System.out.println("test_2ci_off: " + (end - start)); 44.648 + start = System.currentTimeMillis(); 44.649 + for (int i=0; i<ITERS; i++) { 44.650 + test_2vi_off(a1, a2, 123, 103); 44.651 + } 44.652 + end = System.currentTimeMillis(); 44.653 + System.out.println("test_2vi_off: " + (end - start)); 44.654 + 44.655 + start = System.currentTimeMillis(); 44.656 + for (int i=0; i<ITERS; i++) { 44.657 + test_ci_inv(a1, OFFSET, 123); 44.658 + } 44.659 + end = System.currentTimeMillis(); 44.660 + System.out.println("test_ci_inv: " + (end - start)); 44.661 + start = System.currentTimeMillis(); 44.662 + for (int i=0; i<ITERS; i++) { 44.663 + test_vi_inv(a2, 123, OFFSET, 103); 44.664 + } 44.665 + end = System.currentTimeMillis(); 44.666 + System.out.println("test_vi_inv: " + (end - start)); 44.667 + start = System.currentTimeMillis(); 44.668 + for (int i=0; i<ITERS; i++) { 44.669 + test_cp_inv(a1, a2, OFFSET); 44.670 + } 44.671 + end = System.currentTimeMillis(); 44.672 + System.out.println("test_cp_inv: " + (end - start)); 44.673 + start = System.currentTimeMillis(); 44.674 + for (int i=0; i<ITERS; i++) { 44.675 + test_2ci_inv(a1, a2, OFFSET); 44.676 + } 44.677 + end = System.currentTimeMillis(); 44.678 + System.out.println("test_2ci_inv: " + (end - start)); 44.679 + start = System.currentTimeMillis(); 44.680 + for (int i=0; i<ITERS; i++) { 44.681 + test_2vi_inv(a1, a2, 123, 103, OFFSET); 44.682 + } 44.683 + end = System.currentTimeMillis(); 44.684 + System.out.println("test_2vi_inv: " + (end - start)); 44.685 + 44.686 + start = System.currentTimeMillis(); 44.687 + for (int i=0; i<ITERS; i++) { 44.688 + test_ci_scl(a1, 123); 44.689 + } 44.690 + end = System.currentTimeMillis(); 44.691 + System.out.println("test_ci_scl: " + (end - start)); 44.692 + start = System.currentTimeMillis(); 44.693 + for (int i=0; i<ITERS; i++) { 44.694 + test_vi_scl(a2, 123, 103); 44.695 + } 44.696 + end = System.currentTimeMillis(); 44.697 + System.out.println("test_vi_scl: " + (end - start)); 44.698 + start = System.currentTimeMillis(); 44.699 + for (int i=0; i<ITERS; i++) { 44.700 + test_cp_scl(a1, a2); 44.701 + } 44.702 + end = System.currentTimeMillis(); 44.703 + System.out.println("test_cp_scl: " + (end - start)); 44.704 + start = System.currentTimeMillis(); 44.705 + for (int i=0; i<ITERS; i++) { 44.706 + test_2ci_scl(a1, a2); 44.707 + } 44.708 + end = System.currentTimeMillis(); 44.709 + System.out.println("test_2ci_scl: " + (end - start)); 44.710 + start = System.currentTimeMillis(); 44.711 + for (int i=0; i<ITERS; i++) { 44.712 + test_2vi_scl(a1, a2, 123, 103); 44.713 + } 44.714 + end = System.currentTimeMillis(); 44.715 + System.out.println("test_2vi_scl: " + (end - start)); 44.716 + 44.717 + start = System.currentTimeMillis(); 44.718 + for (int i=0; i<ITERS; i++) { 44.719 + test_cp_alndst(a1, a2); 44.720 + } 44.721 + end = System.currentTimeMillis(); 44.722 + System.out.println("test_cp_alndst: " + (end - start)); 44.723 + start = System.currentTimeMillis(); 44.724 + for (int i=0; i<ITERS; i++) { 44.725 + test_cp_alnsrc(a1, a2); 44.726 + } 44.727 + end = System.currentTimeMillis(); 44.728 + System.out.println("test_cp_alnsrc: " + (end - start)); 44.729 + start = System.currentTimeMillis(); 44.730 + for (int i=0; i<ITERS; i++) { 44.731 + test_2ci_aln(a1, a2); 44.732 + } 44.733 + end = System.currentTimeMillis(); 44.734 + System.out.println("test_2ci_aln: " + (end - start)); 44.735 + start = System.currentTimeMillis(); 44.736 + for (int i=0; i<ITERS; i++) { 44.737 + test_2vi_aln(a1, a2, 123, 103); 44.738 + } 44.739 + end = System.currentTimeMillis(); 44.740 + System.out.println("test_2vi_aln: " + (end - start)); 44.741 + 44.742 + start = System.currentTimeMillis(); 44.743 + for (int i=0; i<ITERS; i++) { 44.744 + test_cp_unalndst(a1, a2); 44.745 + } 44.746 + end = System.currentTimeMillis(); 44.747 + System.out.println("test_cp_unalndst: " + (end - start)); 44.748 + start = System.currentTimeMillis(); 44.749 + for (int i=0; i<ITERS; i++) { 44.750 + test_cp_unalnsrc(a1, a2); 44.751 + } 44.752 + end = System.currentTimeMillis(); 44.753 + System.out.println("test_cp_unalnsrc: " + (end - start)); 44.754 + start = System.currentTimeMillis(); 44.755 + for (int i=0; i<ITERS; i++) { 44.756 + test_2ci_unaln(a1, a2); 44.757 + } 44.758 + end = System.currentTimeMillis(); 44.759 + System.out.println("test_2ci_unaln: " + (end - start)); 44.760 + start = System.currentTimeMillis(); 44.761 + for (int i=0; i<ITERS; i++) { 44.762 + test_2vi_unaln(a1, a2, 123, 103); 44.763 + } 44.764 + end = System.currentTimeMillis(); 44.765 + System.out.println("test_2vi_unaln: " + (end - start)); 44.766 + 44.767 + return errn; 44.768 + } 44.769 + 44.770 + private final static long byte_offset(int i) { 44.771 + return ((long)i << 2) + BASE; 44.772 + } 44.773 + 44.774 + static void test_ci(int[] a) { 44.775 + for (int i = 0; i < ARRLEN; i+=1) { 44.776 + unsafe.putIntVolatile(a, byte_offset(i), -123); 44.777 + } 44.778 + } 44.779 + static void test_vi(int[] a, int b, int old) { 44.780 + for (int i = 0; i < ARRLEN; i+=1) { 44.781 + unsafe.putIntVolatile(a, byte_offset(i), b); 44.782 + } 44.783 + } 44.784 + static void test_cp(int[] a, int[] b) { 44.785 + for (int i = 0; i < ARRLEN; i+=1) { 44.786 + unsafe.putIntVolatile(a, byte_offset(i), b[i]); 44.787 + } 44.788 + } 44.789 + static void test_2ci(int[] a, int[] b) { 44.790 + for (int i = 0; i < ARRLEN; i+=1) { 44.791 + unsafe.putIntVolatile(a, byte_offset(i), -123); 44.792 + unsafe.putIntVolatile(b, byte_offset(i), -103); 44.793 + } 44.794 + } 44.795 + static void test_2vi(int[] a, int[] b, int c, int d) { 44.796 + for (int i = 0; i < ARRLEN; i+=1) { 44.797 + unsafe.putIntVolatile(a, byte_offset(i), c); 44.798 + unsafe.putIntVolatile(b, byte_offset(i), d); 44.799 + } 44.800 + } 44.801 + static void test_ci_neg(int[] a, int old) { 44.802 + for (int i = ARRLEN-1; i >= 0; i-=1) { 44.803 + unsafe.putIntVolatile(a, byte_offset(i), -123); 44.804 + } 44.805 + } 44.806 + static void test_vi_neg(int[] a, int b, int old) { 44.807 + for (int i = ARRLEN-1; i >= 0; i-=1) { 44.808 + unsafe.putIntVolatile(a, byte_offset(i), b); 44.809 + } 44.810 + } 44.811 + static void test_cp_neg(int[] a, int[] b) { 44.812 + for (int i = ARRLEN-1; i >= 0; i-=1) { 44.813 + unsafe.putIntVolatile(a, byte_offset(i), b[i]); 44.814 + } 44.815 + } 44.816 + static void test_2ci_neg(int[] a, int[] b) { 44.817 + for (int i = ARRLEN-1; i >= 0; i-=1) { 44.818 + unsafe.putIntVolatile(a, byte_offset(i), -123); 44.819 + unsafe.putIntVolatile(b, byte_offset(i), -103); 44.820 + } 44.821 + } 44.822 + static void test_2vi_neg(int[] a, int[] b, int c, int d) { 44.823 + for (int i = ARRLEN-1; i >= 0; i-=1) { 44.824 + unsafe.putIntVolatile(a, byte_offset(i), c); 44.825 + unsafe.putIntVolatile(b, byte_offset(i), d); 44.826 + } 44.827 + } 44.828 + static void test_ci_oppos(int[] a, int old) { 44.829 + int limit = ARRLEN-1; 44.830 + for (int i = 0; i < ARRLEN; i+=1) { 44.831 + unsafe.putIntVolatile(a, byte_offset(limit-i), -123); 44.832 + } 44.833 + } 44.834 + static void test_vi_oppos(int[] a, int b, int old) { 44.835 + int limit = ARRLEN-1; 44.836 + for (int i = limit; i >= 0; i-=1) { 44.837 + unsafe.putIntVolatile(a, byte_offset(limit-i), b); 44.838 + } 44.839 + } 44.840 + static void test_cp_oppos(int[] a, int[] b) { 44.841 + int limit = ARRLEN-1; 44.842 + for (int i = 0; i < ARRLEN; i+=1) { 44.843 + unsafe.putIntVolatile(a, byte_offset(i), b[limit-i]); 44.844 + } 44.845 + } 44.846 + static void test_2ci_oppos(int[] a, int[] b) { 44.847 + int limit = ARRLEN-1; 44.848 + for (int i = 0; i < ARRLEN; i+=1) { 44.849 + unsafe.putIntVolatile(a, byte_offset(limit-i), -123); 44.850 + unsafe.putIntVolatile(b, byte_offset(i), -103); 44.851 + } 44.852 + } 44.853 + static void test_2vi_oppos(int[] a, int[] b, int c, int d) { 44.854 + int limit = ARRLEN-1; 44.855 + for (int i = limit; i >= 0; i-=1) { 44.856 + unsafe.putIntVolatile(a, byte_offset(i), c); 44.857 + unsafe.putIntVolatile(b, byte_offset(limit-i), d); 44.858 + } 44.859 + } 44.860 + static void test_ci_off(int[] a, int old) { 44.861 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 44.862 + unsafe.putIntVolatile(a, byte_offset(i+OFFSET), -123); 44.863 + } 44.864 + } 44.865 + static void test_vi_off(int[] a, int b, int old) { 44.866 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 44.867 + unsafe.putIntVolatile(a, byte_offset(i+OFFSET), b); 44.868 + } 44.869 + } 44.870 + static void test_cp_off(int[] a, int[] b) { 44.871 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 44.872 + unsafe.putIntVolatile(a, byte_offset(i+OFFSET), b[i+OFFSET]); 44.873 + } 44.874 + } 44.875 + static void test_2ci_off(int[] a, int[] b) { 44.876 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 44.877 + unsafe.putIntVolatile(a, byte_offset(i+OFFSET), -123); 44.878 + unsafe.putIntVolatile(b, byte_offset(i+OFFSET), -103); 44.879 + } 44.880 + } 44.881 + static void test_2vi_off(int[] a, int[] b, int c, int d) { 44.882 + for (int i = 0; i < ARRLEN-OFFSET; i+=1) { 44.883 + unsafe.putIntVolatile(a, byte_offset(i+OFFSET), c); 44.884 + unsafe.putIntVolatile(b, byte_offset(i+OFFSET), d); 44.885 + } 44.886 + } 44.887 + static void test_ci_inv(int[] a, int k, int old) { 44.888 + for (int i = 0; i < ARRLEN-k; i+=1) { 44.889 + unsafe.putIntVolatile(a, byte_offset(i+k), -123); 44.890 + } 44.891 + } 44.892 + static void test_vi_inv(int[] a, int b, int k, int old) { 44.893 + for (int i = 0; i < ARRLEN-k; i+=1) { 44.894 + unsafe.putIntVolatile(a, byte_offset(i+k), b); 44.895 + } 44.896 + } 44.897 + static void test_cp_inv(int[] a, int[] b, int k) { 44.898 + for (int i = 0; i < ARRLEN-k; i+=1) { 44.899 + unsafe.putIntVolatile(a, byte_offset(i+k), b[i+k]); 44.900 + } 44.901 + } 44.902 + static void test_2ci_inv(int[] a, int[] b, int k) { 44.903 + for (int i = 0; i < ARRLEN-k; i+=1) { 44.904 + unsafe.putIntVolatile(a, byte_offset(i+k), -123); 44.905 + unsafe.putIntVolatile(b, byte_offset(i+k), -103); 44.906 + } 44.907 + } 44.908 + static void test_2vi_inv(int[] a, int[] b, int c, int d, int k) { 44.909 + for (int i = 0; i < ARRLEN-k; i+=1) { 44.910 + unsafe.putIntVolatile(a, byte_offset(i+k), c); 44.911 + unsafe.putIntVolatile(b, byte_offset(i+k), d); 44.912 + } 44.913 + } 44.914 + static void test_ci_scl(int[] a, int old) { 44.915 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 44.916 + unsafe.putIntVolatile(a, byte_offset(i*SCALE), -123); 44.917 + } 44.918 + } 44.919 + static void test_vi_scl(int[] a, int b, int old) { 44.920 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 44.921 + unsafe.putIntVolatile(a, byte_offset(i*SCALE), b); 44.922 + } 44.923 + } 44.924 + static void test_cp_scl(int[] a, int[] b) { 44.925 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 44.926 + unsafe.putIntVolatile(a, byte_offset(i*SCALE), b[i*SCALE]); 44.927 + } 44.928 + } 44.929 + static void test_2ci_scl(int[] a, int[] b) { 44.930 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 44.931 + unsafe.putIntVolatile(a, byte_offset(i*SCALE), -123); 44.932 + unsafe.putIntVolatile(b, byte_offset(i*SCALE), -103); 44.933 + } 44.934 + } 44.935 + static void test_2vi_scl(int[] a, int[] b, int c, int d) { 44.936 + for (int i = 0; i*SCALE < ARRLEN; i+=1) { 44.937 + unsafe.putIntVolatile(a, byte_offset(i*SCALE), c); 44.938 + unsafe.putIntVolatile(b, byte_offset(i*SCALE), d); 44.939 + } 44.940 + } 44.941 + static void test_cp_alndst(int[] a, int[] b) { 44.942 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 44.943 + unsafe.putIntVolatile(a, byte_offset(i+ALIGN_OFF), b[i]); 44.944 + } 44.945 + } 44.946 + static void test_cp_alnsrc(int[] a, int[] b) { 44.947 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 44.948 + unsafe.putIntVolatile(a, byte_offset(i), b[i+ALIGN_OFF]); 44.949 + } 44.950 + } 44.951 + static void test_2ci_aln(int[] a, int[] b) { 44.952 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 44.953 + unsafe.putIntVolatile(a, byte_offset(i+ALIGN_OFF), -123); 44.954 + unsafe.putIntVolatile(b, byte_offset(i), -103); 44.955 + } 44.956 + } 44.957 + static void test_2vi_aln(int[] a, int[] b, int c, int d) { 44.958 + for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { 44.959 + unsafe.putIntVolatile(a, byte_offset(i), c); 44.960 + unsafe.putIntVolatile(b, byte_offset(i+ALIGN_OFF), d); 44.961 + } 44.962 + } 44.963 + static void test_cp_unalndst(int[] a, int[] b) { 44.964 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 44.965 + unsafe.putIntVolatile(a, byte_offset(i+UNALIGN_OFF), b[i]); 44.966 + } 44.967 + } 44.968 + static void test_cp_unalnsrc(int[] a, int[] b) { 44.969 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 44.970 + unsafe.putIntVolatile(a, byte_offset(i), b[i+UNALIGN_OFF]); 44.971 + } 44.972 + } 44.973 + static void test_2ci_unaln(int[] a, int[] b) { 44.974 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 44.975 + unsafe.putIntVolatile(a, byte_offset(i+UNALIGN_OFF), -123); 44.976 + unsafe.putIntVolatile(b, byte_offset(i), -103); 44.977 + } 44.978 + } 44.979 + static void test_2vi_unaln(int[] a, int[] b, int c, int d) { 44.980 + for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { 44.981 + unsafe.putIntVolatile(a, byte_offset(i), c); 44.982 + unsafe.putIntVolatile(b, byte_offset(i+UNALIGN_OFF), d); 44.983 + } 44.984 + } 44.985 + 44.986 + static int verify(String text, int i, int elem, int val) { 44.987 + if (elem != val) { 44.988 + System.err.println(text + "[" + i + "] = " + elem + " != " + val); 44.989 + return 1; 44.990 + } 44.991 + return 0; 44.992 + } 44.993 +}
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 45.2 +++ b/test/runtime/8007736/TestStaticIF.java Tue Feb 26 11:52:06 2013 +0100 45.3 @@ -0,0 +1,44 @@ 45.4 +/* 45.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 45.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 45.7 + * 45.8 + * This code is free software; you can redistribute it and/or modify it 45.9 + * under the terms of the GNU General Public License version 2 only, as 45.10 + * published by the Free Software Foundation. 45.11 + * 45.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 45.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 45.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 45.15 + * version 2 for more details (a copy is included in the LICENSE file that 45.16 + * accompanied this code). 45.17 + * 45.18 + * You should have received a copy of the GNU General Public License version 45.19 + * 2 along with this work; if not, write to the Free Software Foundation, 45.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 45.21 + * 45.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 45.23 + * or visit www.oracle.com if you need additional information or have any 45.24 + * questions. 45.25 + * 45.26 + */ 45.27 + 45.28 +/* 45.29 + * @test 45.30 + * @bug 8007736 45.31 + * @summary Test static interface method. 45.32 + * @run main/othervm -Xverify:all TestStaticIF 45.33 + */ 45.34 + 45.35 +public class TestStaticIF implements StaticMethodInInterface { 45.36 + 45.37 + public static void main(String[] args) { 45.38 + System.out.printf("main: %s%n", StaticMethodInInterface.get()); 45.39 + } 45.40 +} 45.41 + 45.42 +interface StaticMethodInInterface { 45.43 + 45.44 + public static String get() { 45.45 + return "Hello from StaticMethodInInterface.get()"; 45.46 + } 45.47 +}