Merge
This commit is contained in:
commit
3d85a9c2c4
@ -112,7 +112,12 @@ final class ImageNativeSubstrate implements ImageSubstrate {
|
||||
|
||||
@Override
|
||||
public byte[] getStringBytes(int offset) {
|
||||
return getStringBytes(id, offset);
|
||||
byte[] ret = getStringBytes(id, offset);
|
||||
if (ret == null) {
|
||||
throw new OutOfMemoryError("Error accessing array at offset "
|
||||
+ offset);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,6 +104,9 @@ Java_jdk_internal_jimage_ImageNativeSubstrate_getStringBytes(JNIEnv *env,
|
||||
size = strlen(data);
|
||||
// Allocate byte array.
|
||||
byteArray = (*env)->NewByteArray(env, (jsize) size);
|
||||
if (byteArray == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
// Get array base address.
|
||||
rawBytes = (*env)->GetByteArrayElements(env, byteArray, NULL);
|
||||
// Copy bytes from image string table.
|
||||
@ -122,6 +125,9 @@ Java_jdk_internal_jimage_ImageNativeSubstrate_getAttributes(JNIEnv *env,
|
||||
jlong* ret;
|
||||
|
||||
attributes = (*env)->NewLongArray(env, JVM_ImageGetAttributesCount(env));
|
||||
if (attributes == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
// Get base address for jlong array.
|
||||
rawAttributes = (*env)->GetLongArrayElements(env, attributes, NULL);
|
||||
ret = JVM_ImageGetAttributes(env, rawAttributes, id, offset);
|
||||
@ -143,6 +149,9 @@ Java_jdk_internal_jimage_ImageNativeSubstrate_findAttributes(JNIEnv *env,
|
||||
|
||||
count = JVM_ImageGetAttributesCount(env);
|
||||
attributes = (*env)->NewLongArray(env, JVM_ImageGetAttributesCount(env));
|
||||
if (attributes == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
// Get base address for jlong array.
|
||||
rawAttributes = (*env)->GetLongArrayElements(env, attributes, NULL);
|
||||
size = (*env)->GetArrayLength(env, utf8);
|
||||
@ -165,6 +174,9 @@ Java_jdk_internal_jimage_ImageNativeSubstrate_attributeOffsets(JNIEnv *env,
|
||||
|
||||
length = JVM_ImageAttributeOffsetsLength(env, id);
|
||||
offsets = (*env)->NewIntArray(env, length);
|
||||
if (offsets == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
// Get base address of result.
|
||||
rawOffsets = (*env)->GetIntArrayElements(env, offsets, NULL);
|
||||
ret = JVM_ImageAttributeOffsets(env, rawOffsets, length, id);
|
||||
|
@ -154,17 +154,6 @@ javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java generi
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_math
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_other
|
||||
|
||||
# 6988950
|
||||
demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java generic-all
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_net
|
||||
|
||||
# 7148829
|
||||
@ -390,10 +379,4 @@ sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java generic-all
|
||||
# 8064572 8060736 8062938
|
||||
sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
|
||||
|
||||
# 8079273
|
||||
demo/jvmti/hprof/CpuOldTest.java generic-all
|
||||
demo/jvmti/hprof/CpuTimesTest.java generic-all
|
||||
demo/jvmti/hprof/OptionsTest.java generic-all
|
||||
demo/jvmti/hprof/StackMapTableTest.java generic-all
|
||||
|
||||
############################################################################
|
||||
|
@ -122,7 +122,6 @@ public class DemoRun {
|
||||
String libprefix = os_name.contains("Windows")?"":"lib";
|
||||
String libsuffix = os_name.contains("Windows")?".dll":
|
||||
os_name.contains("OS X")?".dylib":".so";
|
||||
boolean hprof = demo_name.equals("hprof");
|
||||
String java = sdk_home
|
||||
+ File.separator + "bin"
|
||||
+ File.separator + "java";
|
||||
@ -155,22 +154,15 @@ public class DemoRun {
|
||||
cmdLine += (cmd[i++] = "-Xcheck:jni");
|
||||
cmdLine += " ";
|
||||
cmdLine += (cmd[i++] = "-Xverify:all");
|
||||
if ( hprof ) {
|
||||
/* Load hprof with -agentlib since it's part of jre */
|
||||
cmdLine += " ";
|
||||
cmdLine += (cmd[i++] = "-agentlib:" + demo_name
|
||||
+ (demo_options.equals("")?"":("="+demo_options)));
|
||||
} else {
|
||||
String libname = sdk_home
|
||||
+ File.separator + "demo"
|
||||
+ File.separator + "jvmti"
|
||||
+ File.separator + demo_name
|
||||
+ File.separator + "lib"
|
||||
+ File.separator + libprefix + demo_name + libsuffix;
|
||||
cmdLine += " ";
|
||||
cmdLine += (cmd[i++] = "-agentpath:" + libname
|
||||
+ (demo_options.equals("")?"":("="+demo_options)));
|
||||
}
|
||||
String libname = sdk_home
|
||||
+ File.separator + "demo"
|
||||
+ File.separator + "jvmti"
|
||||
+ File.separator + demo_name
|
||||
+ File.separator + "lib"
|
||||
+ File.separator + libprefix + demo_name + libsuffix;
|
||||
cmdLine += " ";
|
||||
cmdLine += (cmd[i++] = "-agentpath:" + libname
|
||||
+ (demo_options.equals("") ? "" : ("=" + demo_options)));
|
||||
/* Add any special VM options */
|
||||
for ( j = 0; j < nvm_options; j++ ) {
|
||||
cmdLine += " ";
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 5012882 6299047
|
||||
* @summary Test jvmti hprof
|
||||
*
|
||||
* @compile -g HelloWorld.java ../DemoRun.java
|
||||
* @build CpuOldTest
|
||||
* @run main CpuOldTest HelloWorld
|
||||
*/
|
||||
|
||||
public class CpuOldTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
|
||||
/* Run JVMTI hprof agent with cpu=old */
|
||||
hprof = new DemoRun("hprof", "cpu=old,file=cpuold.txt");
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 5012882
|
||||
* @summary Test jvmti hprof
|
||||
*
|
||||
* @compile -g:lines HelloWorld.java ../DemoRun.java
|
||||
* @build CpuSamplesTest
|
||||
* @run main CpuSamplesTest HelloWorld
|
||||
*/
|
||||
|
||||
public class CpuSamplesTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
|
||||
/* Run JVMTI hprof agent with cpu=samples */
|
||||
hprof = new DemoRun("hprof", "cpu=samples,file=cpusamples.txt");
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 5097131 6299047
|
||||
* @summary Test jvmti hprof
|
||||
*
|
||||
* @compile -g HelloWorld.java DefineClass.java ../DemoRun.java
|
||||
* @build CpuTimesDefineClassTest
|
||||
* @run main CpuTimesDefineClassTest DefineClass
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public class CpuTimesDefineClassTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
|
||||
/* Run JVMTI hprof agent with cpu=times */
|
||||
hprof = new DemoRun("hprof", "cpu=times,file=cputimedefineclass.txt");
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 5012882 6299047
|
||||
* @summary Test jvmti hprof
|
||||
*
|
||||
* @compile -g HelloWorld.java ../DemoRun.java
|
||||
* @build CpuTimesTest
|
||||
* @run main CpuTimesTest HelloWorld
|
||||
*/
|
||||
|
||||
public class CpuTimesTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
|
||||
/* Run JVMTI hprof agent with cpu=times */
|
||||
hprof = new DemoRun("hprof", "cpu=times,file=cputimes.txt");
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* Testcase that does a defineClass with a NULL name on HelloWorld.class */
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class DefineClass extends ClassLoader {
|
||||
public static void main(String args[]) {
|
||||
DefineClass t = new DefineClass();
|
||||
t.run(args);
|
||||
}
|
||||
public void run(String args[]) {
|
||||
Class n;
|
||||
byte b[] = new byte[10000];
|
||||
int len = 0;
|
||||
String cdir;
|
||||
String cfile;
|
||||
|
||||
/* Class is found here: */
|
||||
cdir = System.getProperty("test.classes", ".");
|
||||
cfile = cdir + java.io.File.separator + "HelloWorld.class";
|
||||
|
||||
try {
|
||||
/* Construct byte array with complete class image in it. */
|
||||
FileInputStream fis = new FileInputStream(cfile);
|
||||
int nbytes;
|
||||
do {
|
||||
nbytes = fis.read(b, len, b.length-len);
|
||||
if ( nbytes > 0 ) {
|
||||
len += nbytes;
|
||||
}
|
||||
} while ( nbytes > 0 );
|
||||
} catch ( Throwable x ) {
|
||||
System.err.println("Cannot find " + cfile);
|
||||
x.printStackTrace();
|
||||
}
|
||||
|
||||
/* Define the class with null for the name */
|
||||
n = defineClass(null, b, 0, len);
|
||||
|
||||
/* Try to create an instance of it */
|
||||
try {
|
||||
n.newInstance();
|
||||
} catch ( Throwable x ) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 5012882 6299047
|
||||
* @summary Test jvmti hprof
|
||||
*
|
||||
* @compile -g HelloWorld.java ../DemoRun.java
|
||||
* @build HeapAllTest
|
||||
* @run main HeapAllTest HelloWorld
|
||||
*/
|
||||
|
||||
public class HeapAllTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
|
||||
/* Run JVMTI hprof agent with heap=all */
|
||||
hprof = new DemoRun("hprof", "heap=all,file=heapall.txt");
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 4965057 6313381
|
||||
* @summary Test jvmti hprof format=b
|
||||
*
|
||||
* @compile -g:source HelloWorld.java ../DemoRun.java
|
||||
* @build HeapBinaryFormatTest
|
||||
* @run main HeapBinaryFormatTest HelloWorld
|
||||
*/
|
||||
|
||||
public class HeapBinaryFormatTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
|
||||
/* Run JVMTI hprof agent to get binary format dump */
|
||||
hprof = new DemoRun("hprof", "heap=dump,format=b,logflags=4,file=heapbinaryformat.txt");
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Try a variation */
|
||||
String vm_opts[] = new String[1];
|
||||
vm_opts[0] = "-Xmx2100m";
|
||||
/* Crashes on small Linux machines: (like fyi)
|
||||
How can I tell how much real memory is on a machine?
|
||||
hprof.runit(args[0], vm_opts);
|
||||
*/
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 5012882 6299047
|
||||
* @summary Test jvmti hprof
|
||||
*
|
||||
* @compile -g:source HelloWorld.java ../DemoRun.java
|
||||
* @build HeapDumpTest
|
||||
* @run main HeapDumpTest HelloWorld
|
||||
*/
|
||||
|
||||
public class HeapDumpTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
|
||||
/* Run JVMTI hprof agent with heap=dump */
|
||||
hprof = new DemoRun("hprof", "heap=dump,file=heapdump.txt");
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 5012882 6299047
|
||||
* @summary Test jvmti hprof
|
||||
*
|
||||
* @compile -g:vars HelloWorld.java ../DemoRun.java
|
||||
* @build HeapSitesTest
|
||||
* @run main HeapSitesTest HelloWorld
|
||||
*/
|
||||
|
||||
public class HeapSitesTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
|
||||
/* Run JVMTI hprof agent with heap=sites */
|
||||
hprof = new DemoRun("hprof", "heap=sites,file=heapsites.txt");
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* HelloWorld:
|
||||
*
|
||||
* Sample target application for HPROF tests
|
||||
*
|
||||
*/
|
||||
|
||||
/* Just some classes that create a variety of references */
|
||||
|
||||
class AAAA {
|
||||
public int AAAA_i;
|
||||
public static int AAAA_si;
|
||||
public Object AAAA_j;
|
||||
public static Object AAAA_sj;
|
||||
public long AAAA_k;
|
||||
public static long AAAA_sk;
|
||||
}
|
||||
|
||||
interface IIII {
|
||||
Object o = new Object();
|
||||
}
|
||||
|
||||
class BBBB extends AAAA implements IIII {
|
||||
public byte BBBB_ii;
|
||||
public static byte BBBB_sii;
|
||||
public Object BBBB_jj;
|
||||
public static Object BBBB_sjj;
|
||||
public short BBBB_kk;
|
||||
public static short BBBB_skk;
|
||||
}
|
||||
|
||||
class REFS {
|
||||
private static String s1 = new String("REFS_string1");
|
||||
private String is2 = new String("REFS_string2");
|
||||
private static String s3 = new String("REFS_string3");
|
||||
private static String s4 = new String("REFS_string4");
|
||||
private String is5 = new String("REFS_string5");
|
||||
|
||||
private AAAA aaaa;
|
||||
private BBBB bbbb;
|
||||
|
||||
public void test() {
|
||||
aaaa = new AAAA();
|
||||
bbbb = new BBBB();
|
||||
|
||||
aaaa.AAAA_i = 1;
|
||||
AAAA.AAAA_si = 2;
|
||||
aaaa.AAAA_j = s1;
|
||||
AAAA.AAAA_sj = is2;
|
||||
aaaa.AAAA_k = 5;
|
||||
AAAA.AAAA_sk = 6;
|
||||
|
||||
bbbb.BBBB_ii = 11;
|
||||
BBBB.BBBB_sii = 22;
|
||||
bbbb.BBBB_jj = s3;
|
||||
BBBB.BBBB_sjj = s4;
|
||||
bbbb.BBBB_kk = 55;
|
||||
BBBB.BBBB_skk = 66;
|
||||
|
||||
bbbb.AAAA_i = 111;
|
||||
bbbb.AAAA_j = is5;
|
||||
bbbb.AAAA_k = 555;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fairly simple hello world program that does some exercises first. */
|
||||
|
||||
public class HelloWorld {
|
||||
public static void main(String args[]) {
|
||||
|
||||
/* References exercise. */
|
||||
REFS r = new REFS();
|
||||
r.test();
|
||||
|
||||
/* Use a generic type exercise. */
|
||||
java.util.List<String> l = new java.util.ArrayList<String>();
|
||||
String.format("%s", "");
|
||||
|
||||
/* Create a class that has lots of different bytecodes exercise. */
|
||||
/* (Don't run it!) */
|
||||
UseAllBytecodes x = new UseAllBytecodes(1,2);
|
||||
|
||||
/* Just some code with branches exercise. */
|
||||
try {
|
||||
if ( args.length == 0 ) {
|
||||
System.out.println("No arguments passed in (doesn't matter)");
|
||||
} else {
|
||||
System.out.println("Arguments passed in (doesn't matter)");
|
||||
}
|
||||
} catch ( Throwable e ) {
|
||||
System.out.println("ERROR: System.out.println() did a throw");
|
||||
} finally {
|
||||
System.out.println("Hello, world!");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 5012882
|
||||
* @summary Test jvmti hprof
|
||||
*
|
||||
* @compile -g ../Context.java ../DemoRun.java
|
||||
* @build MonitorTest
|
||||
* @run main MonitorTest Context 25 200 1000
|
||||
*/
|
||||
|
||||
/* To create monitor contention, increase the default configuration.
|
||||
* Hprof seems to have historically not output anything unless certain
|
||||
* limits have been reached on the total contention time.
|
||||
*/
|
||||
|
||||
public class MonitorTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
|
||||
/* Run JVMTI hprof agent with monitor=y */
|
||||
hprof = new DemoRun("hprof", "monitor=y,file=monitor.txt");
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed - ERROR seen in output");
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 5083441 6299047
|
||||
* @summary Test jvmti hprof
|
||||
*
|
||||
* @compile -g:lines HelloWorld.java ../DemoRun.java
|
||||
* @build OptionsTest
|
||||
* @run main OptionsTest HelloWorld
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class OptionsTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
List<String> options = new LinkedList<String>();
|
||||
|
||||
options.add("cpu=samples,depth=0,file=options0.txt");
|
||||
options.add("cpu=times,depth=0,file=options1.txt");
|
||||
options.add("cpu=old,depth=0,file=options2.txt");
|
||||
options.add("depth=0,file=options3.txt");
|
||||
|
||||
for(String option: options) {
|
||||
/* Run JVMTI hprof agent with various options */
|
||||
hprof = new DemoRun("hprof", option);
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed with " + option
|
||||
+ " - ERROR seen in output");
|
||||
}
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
/* @test
|
||||
* @bug 6266289 6299047 6855180 6855551
|
||||
* @summary Test jvmti hprof and java_crw_demo with StackMapTable attributes
|
||||
*
|
||||
* @compile ../DemoRun.java
|
||||
* @compile -g:lines HelloWorld.java
|
||||
* @build StackMapTableTest
|
||||
* @run main StackMapTableTest HelloWorld
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class StackMapTableTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
DemoRun hprof;
|
||||
List<String> options = new LinkedList<String>();
|
||||
|
||||
options.add("cpu=samples,file=stackmaptable0.txt");
|
||||
options.add("cpu=times,file=stackmaptable1.txt");
|
||||
options.add("heap=sites,file=stackmaptable2.txt");
|
||||
options.add("file=stackmaptable3.txt");
|
||||
|
||||
for(String option: options) {
|
||||
/* Run JVMTI hprof agent with various options */
|
||||
hprof = new DemoRun("hprof", option);
|
||||
hprof.runit(args[0]);
|
||||
|
||||
/* Make sure patterns in output look ok */
|
||||
if (hprof.output_contains("ERROR")) {
|
||||
throw new RuntimeException("Test failed with " + option
|
||||
+ " - ERROR seen in output");
|
||||
}
|
||||
}
|
||||
|
||||
/* Must be a pass. */
|
||||
System.out.println("Test passed - cleanly terminated");
|
||||
}
|
||||
}
|
@ -1,309 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
A simple Java class definition that helps self-test the runtime
|
||||
interpreter. Used for getfield/putfield, invoke* opcodes and
|
||||
their _quick variants.
|
||||
|
||||
See src/share/java/runtime/selftest.c for details of the test
|
||||
environment.
|
||||
*/
|
||||
|
||||
/* Used to be sun/misc/SelfTest.java */
|
||||
|
||||
interface UseAllBytecodesInterface
|
||||
{
|
||||
public void test_an_interface(int p1);
|
||||
}
|
||||
|
||||
public class UseAllBytecodes implements UseAllBytecodesInterface
|
||||
{
|
||||
public int i1, i2;
|
||||
public float f1, f2;
|
||||
public double d1, d2;
|
||||
public long l1, l2;
|
||||
|
||||
public static int si1, si2;
|
||||
public static float sf1, sf2;
|
||||
public static double sd1, sd2;
|
||||
public static long sl1, sl2;
|
||||
|
||||
public UseAllBytecodesInterface interfaceObject;
|
||||
|
||||
public int multi[][][];
|
||||
|
||||
public UseAllBytecodes()
|
||||
{
|
||||
/* This constructor is not intended to ever be run. It is here
|
||||
to force CONSTANT_Methodref constants into the CP */
|
||||
set_i1(11);
|
||||
set_i2(22);
|
||||
set_f1(1.1f);
|
||||
set_f2(2.2f);
|
||||
set_d1(1.0);
|
||||
set_d2(2.0);
|
||||
set_l1(3);
|
||||
set_l2(4);
|
||||
|
||||
set_si1(33);
|
||||
set_si2(44);
|
||||
set_sf1(3.3f);
|
||||
set_sf2(4.4f);
|
||||
set_sd1(3.0);
|
||||
set_sd2(4.0);
|
||||
set_sl1(5);
|
||||
set_sl2(6);
|
||||
|
||||
test_areturn();
|
||||
test_athrow1();
|
||||
test_athrow2();
|
||||
test_athrow3();
|
||||
test_athrow4();
|
||||
|
||||
/* This puts a CONSTANT_InterfaceMethodref into the CP */
|
||||
interfaceObject.test_an_interface(1234);
|
||||
|
||||
/* This creates an array and puts it into the CP */
|
||||
multi = new int[2][3][4];
|
||||
}
|
||||
|
||||
public UseAllBytecodes(int p1)
|
||||
{
|
||||
i1 = p1;
|
||||
i2 = 12345678; /* This puts a CONSTANT_Integer into the CP */
|
||||
d1 = (double) p1;
|
||||
d2 = 1.2e234; /* This puts a CONSTANT_Double into the CP */
|
||||
}
|
||||
|
||||
public UseAllBytecodes(int p1, int p2)
|
||||
{
|
||||
i1 = p1;
|
||||
i2 = p2;
|
||||
}
|
||||
|
||||
/* These methods should return something other than their
|
||||
arguments, so the self test can easily determine that
|
||||
the correct value was returned. */
|
||||
public int set_i1(int p1)
|
||||
{
|
||||
i1 = p1;
|
||||
return i1 + 1;
|
||||
}
|
||||
|
||||
public int set_i2(int p2)
|
||||
{
|
||||
i2 = p2;
|
||||
return i2 + 1;
|
||||
}
|
||||
|
||||
public float set_f1(float p1)
|
||||
{
|
||||
f1 = p1;
|
||||
return f1 + 1.0e34f;
|
||||
}
|
||||
|
||||
public float set_f2(float p2)
|
||||
{
|
||||
f2 = p2;
|
||||
return f2 + 1.0e34f;
|
||||
}
|
||||
|
||||
public double set_d1(double p1)
|
||||
{
|
||||
d1 = p1;
|
||||
return d1 + 1.0e234;
|
||||
}
|
||||
|
||||
public double set_d2(double p2)
|
||||
{
|
||||
d2 = p2;
|
||||
return d2 + 1.0e234;
|
||||
}
|
||||
|
||||
public long set_l1(long p1)
|
||||
{
|
||||
l1 = p1;
|
||||
return l1 + 1;
|
||||
}
|
||||
|
||||
public long set_l2(long p2)
|
||||
{
|
||||
l2 = p2;
|
||||
return l2 + 1;
|
||||
}
|
||||
|
||||
public static void set_si1(int p1)
|
||||
{
|
||||
si1 = p1;
|
||||
}
|
||||
|
||||
public static void set_si2(int p2)
|
||||
{
|
||||
si2 = p2;
|
||||
}
|
||||
|
||||
public static void set_sf1(float p1)
|
||||
{
|
||||
sf1 = p1;
|
||||
}
|
||||
|
||||
public static void set_sf2(float p2)
|
||||
{
|
||||
sf2 = p2;
|
||||
}
|
||||
|
||||
public static void set_sd1(double p1)
|
||||
{
|
||||
sd1 = p1;
|
||||
}
|
||||
|
||||
public static void set_sd2(double p2)
|
||||
{
|
||||
sd2 = p2;
|
||||
}
|
||||
|
||||
public static void set_sl1(long p1)
|
||||
{
|
||||
sl1 = p1;
|
||||
}
|
||||
|
||||
public static void set_sl2(long p2)
|
||||
{
|
||||
sl2 = p2;
|
||||
}
|
||||
|
||||
public UseAllBytecodes test_areturn()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/* This method does the same thing as set_i1.
|
||||
It is here to test the invokeinterface opcode. */
|
||||
public void test_an_interface(int p1)
|
||||
{
|
||||
i1 = p1;
|
||||
}
|
||||
|
||||
/* The following 10 methods test various permutations of
|
||||
try-and-catch. */
|
||||
public static void test_athrow1() throws NullPointerException
|
||||
{
|
||||
try
|
||||
{
|
||||
si1 = -1;
|
||||
throw new NullPointerException();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
si1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void test_athrow2()
|
||||
{
|
||||
int i = 1;
|
||||
try
|
||||
{
|
||||
si1 = -1;
|
||||
test_athrow1();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// This should *not* catch the exception;
|
||||
// should be caught in test_athrow1.
|
||||
si1 = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void test_athrow3()
|
||||
{
|
||||
int i = 1;
|
||||
try
|
||||
{
|
||||
// Ultimately throws NullPointerException
|
||||
si1 = -1;
|
||||
si2 = -1;
|
||||
test_athrow5();
|
||||
}
|
||||
catch (NullPointerException np)
|
||||
{
|
||||
si1 = i + 1;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
si2 = i + 1;
|
||||
}
|
||||
si1++; // total is 3
|
||||
}
|
||||
|
||||
public static void test_athrow4()
|
||||
{
|
||||
int i = 2;
|
||||
try
|
||||
{
|
||||
// Ultimately throws NoSuchMethodException
|
||||
si1 = -1;
|
||||
si2 = -1;
|
||||
test_athrow7();
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
si1 = i + 1;
|
||||
}
|
||||
catch (NoSuchMethodException nsm)
|
||||
{
|
||||
si2 = i + 1;
|
||||
}
|
||||
si2++; // total is 4
|
||||
}
|
||||
|
||||
public static void test_throw_nosuchmethod() throws NoSuchMethodException
|
||||
{
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
|
||||
public static void test_throw_nullpointer() throws NullPointerException
|
||||
{
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
public static void test_athrow5() throws NullPointerException, NoSuchMethodException
|
||||
{
|
||||
test_athrow6();
|
||||
}
|
||||
|
||||
public static void test_athrow6() throws NullPointerException, NoSuchMethodException
|
||||
{
|
||||
test_throw_nullpointer();
|
||||
}
|
||||
|
||||
public static void test_athrow7() throws NullPointerException, NoSuchMethodException
|
||||
{
|
||||
test_athrow8();
|
||||
}
|
||||
|
||||
public static void test_athrow8() throws NullPointerException, NoSuchMethodException
|
||||
{
|
||||
test_throw_nosuchmethod();
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@
|
||||
* @bug 4858522
|
||||
* @modules java.management/sun.management
|
||||
* @summary Basic unit test of HotspotRuntimeMBean.getTotalSafepointTime()
|
||||
* @author Steve Bohne
|
||||
* @run main/othervm -XX:+UsePerfData GetTotalSafepointTime
|
||||
*/
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user