This commit is contained in:
Alejandro Murillo 2016-09-01 14:09:01 -07:00
commit 929ce0118a
50 changed files with 304 additions and 96 deletions

View File

@ -24,6 +24,7 @@
package sun.jvm.hotspot.gc.g1;
import java.io.PrintStream;
import java.util.Iterator;
import java.util.Observable;
import java.util.Observer;
@ -125,6 +126,15 @@ public class G1CollectedHeap extends CollectedHeap {
return CollectedHeapName.G1_COLLECTED_HEAP;
}
@Override
public void printOn(PrintStream tty) {
MemRegion mr = reservedRegion();
tty.print("garbage-first heap");
tty.print(" [" + mr.start() + ", " + mr.end() + "]");
tty.println(" region size " + (HeapRegion.grainBytes() / 1024) + "K");
}
public G1CollectedHeap(Address addr) {
super(addr);
}

View File

@ -5402,6 +5402,17 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa
debug_only(ik->verify();)
}
static bool relax_format_check_for(ClassLoaderData* loader_data) {
bool trusted = (loader_data->is_the_null_class_loader_data() ||
SystemDictionary::is_platform_class_loader(loader_data->class_loader()));
bool need_verify =
// verifyAll
(BytecodeVerificationLocal && BytecodeVerificationRemote) ||
// verifyRemote
(!BytecodeVerificationLocal && BytecodeVerificationRemote && !trusted);
return !need_verify;
}
ClassFileParser::ClassFileParser(ClassFileStream* stream,
Symbol* name,
ClassLoaderData* loader_data,
@ -5490,7 +5501,7 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
// Check if verification needs to be relaxed for this class file
// Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376)
_relax_verify = Verifier::relax_verify_for(_loader_data->class_loader());
_relax_verify = relax_format_check_for(_loader_data);
parse_stream(stream, CHECK);

View File

@ -88,7 +88,7 @@ bool Verifier::should_verify_for(oop class_loader, bool should_verify_class) {
BytecodeVerificationLocal : BytecodeVerificationRemote;
}
bool Verifier::relax_verify_for(oop loader) {
bool Verifier::relax_access_for(oop loader) {
bool trusted = java_lang_ClassLoader::is_trusted_loader(loader);
bool need_verify =
// verifyAll

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2016, 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
@ -58,8 +58,8 @@ class Verifier : AllStatic {
// -Xverify:all/none override this value
static bool should_verify_for(oop class_loader, bool should_verify_class);
// Relax certain verifier checks to enable some broken 1.1 apps to run on 1.2.
static bool relax_verify_for(oop class_loader);
// Relax certain access checks to enable some broken 1.1 apps to run on 1.2.
static bool relax_access_for(oop class_loader);
// Print output for class+resolve
static void trace_class_resolution(Klass* resolve_class, InstanceKlass* verify_class);

View File

@ -446,7 +446,7 @@ static bool can_relax_access_check_for(const Klass* accessor,
(accessor_ik->major_version() < Verifier::STRICTER_ACCESS_CTRL_CHECK_VERSION &&
accessee_ik->major_version() < Verifier::STRICTER_ACCESS_CTRL_CHECK_VERSION)) {
return classloader_only &&
Verifier::relax_verify_for(accessor_ik->class_loader()) &&
Verifier::relax_access_for(accessor_ik->class_loader()) &&
accessor_ik->protection_domain() == accessee_ik->protection_domain() &&
accessor_ik->class_loader() == accessee_ik->class_loader();
}

View File

@ -36,11 +36,11 @@
package compiler.intrinsics.unsafe;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
public class TestUnsafeMismatchedArrayFieldAccess {
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
static {
try {

View File

@ -45,7 +45,7 @@ package compiler.jvmci.compilerToVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
@ -114,7 +114,7 @@ public class GetResolvedJavaMethodTest {
abstract HotSpotResolvedJavaMethod getResolvedJavaMethod();
}
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final Field METASPACE_METHOD_FIELD;
private static final Class<?> TEST_CLASS = GetResolvedJavaMethodTest.class;

View File

@ -53,7 +53,7 @@ package compiler.jvmci.compilerToVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
@ -154,7 +154,7 @@ public class GetResolvedJavaTypeTest {
abstract HotSpotResolvedObjectType getResolvedJavaType();
}
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final Class TEST_CLASS = GetResolvedJavaTypeTest.class;
/* a compressed parameter for tested method is set to false because

View File

@ -53,7 +53,7 @@ import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
import jdk.internal.misc.Unsafe;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.vm.ci.meta.ConstantPool;
@ -69,7 +69,7 @@ import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CON
*/
public class ResolveFieldInPoolTest {
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
public static void main(String[] args) throws Exception {
Map<ConstantTypes, Validator> typeTests = new HashMap<>();

View File

@ -52,6 +52,7 @@ import compiler.jvmci.common.testcases.SingleSubclassedClass;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
@ -60,7 +61,7 @@ import java.util.HashSet;
import java.util.Set;
public class ResolveMethodTest {
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
public static void main(String args[]) {
ResolveMethodTest test = new ResolveMethodTest();

View File

@ -34,7 +34,7 @@
package compiler.loopopts.superword;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
public class TestVectorizationWithInvariant {
@ -43,7 +43,7 @@ public class TestVectorizationWithInvariant {
private static final long CHAR_ARRAY_OFFSET;
static {
unsafe = Utils.getUnsafe();
unsafe = UnsafeHelper.getUnsafe();
BYTE_ARRAY_OFFSET = unsafe.arrayBaseOffset(byte[].class);
CHAR_ARRAY_OFFSET = unsafe.arrayBaseOffset(char[].class);
}

View File

@ -49,7 +49,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -125,7 +125,7 @@ public class TestRTMAbortRatio extends CommandLineOptionTest {
public static class Test implements CompilableTest {
private static final int TOTAL_ITERATIONS = 10000;
private static final int WARMUP_ITERATIONS = 1000;
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();
// Following field have to be static in order to avoid escape analysis.
@SuppressWarnings("UnsuedDeclaration")

View File

@ -51,7 +51,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -158,7 +158,7 @@ public class TestRTMAfterNonRTMDeopt extends CommandLineOptionTest {
private static int field = 0;
private static final int ITERATIONS = 10000;
private static final int RANGE_CHECK_AT = ITERATIONS / 2;
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();
@Override

View File

@ -48,7 +48,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -133,7 +133,7 @@ public class TestRTMDeoptOnLowAbortRatio extends CommandLineOptionTest {
}
public static class Test implements CompilableTest {
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();
@Override

View File

@ -49,7 +49,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -142,7 +142,7 @@ public class TestRTMLockingThreshold extends CommandLineOptionTest {
@SuppressWarnings("UnsuedDeclaration")
private static int field = 0;
private static final int TOTAL_ITERATIONS = 10000;
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();

View File

@ -49,7 +49,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -113,7 +113,7 @@ public class TestRTMTotalCountIncrRate extends CommandLineOptionTest {
public static class Test implements CompilableTest {
private static final long TOTAL_ITERATIONS = 10000L;
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();
// Following field have to be static in order to avoid escape analysis.
@SuppressWarnings("UnsuedDeclaration")

View File

@ -25,7 +25,7 @@
package compiler.testlibrary.rtm;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
/**
* Current RTM locking implementation force transaction abort
@ -35,7 +35,7 @@ class XAbortProvoker extends AbortProvoker {
// Following field have to be static in order to avoid escape analysis.
@SuppressWarnings("UnsuedDeclaration")
private static int field = 0;
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
public XAbortProvoker() {
this(new Object());

View File

@ -35,6 +35,7 @@ package compiler.unsafe;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import java.util.Random;
@ -81,7 +82,7 @@ public class UnsafeRaw {
}
public static void main(String[] args) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
final int array_size = 128;
final int element_size = 4;
final int magic = 0x12345678;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2016, 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
@ -29,16 +29,16 @@
* @key gc
* @key regression
* @requires vm.gc=="null"
* @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseSerialGC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseSerialGC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseConcMarkSweepGC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseConcMarkSweepGC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseG1GC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms7M -Xmx9M -XX:+UseG1GC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseSerialGC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseSerialGC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseConcMarkSweepGC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseConcMarkSweepGC -XX:-UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:+UseLargePages TestAlignmentToUseLargePages
* @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:-UseLargePages TestAlignmentToUseLargePages
*/
public class TestAlignmentToUseLargePages {

View File

@ -37,6 +37,7 @@ import java.util.Collections;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
public class TestMaxMinHeapFreeRatioFlags {
@ -133,7 +134,7 @@ public class TestMaxMinHeapFreeRatioFlags {
*/
public static class RatioVerifier {
private static final Unsafe unsafe = Utils.getUnsafe();
private static final Unsafe unsafe = UnsafeHelper.getUnsafe();
// Size of byte array that will be allocated
public static final int CHUNK_SIZE = 1024;

View File

@ -46,6 +46,7 @@ import jdk.internal.misc.Unsafe;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import sun.hotspot.WhiteBox;
/* In order to test that TargetSurvivorRatio affects survivor space occupancy
@ -248,7 +249,7 @@ public class TestTargetSurvivorRatioFlag {
public static class TargetSurvivorRatioVerifier {
static final WhiteBox wb = WhiteBox.getWhiteBox();
static final Unsafe unsafe = Utils.getUnsafe();
static final Unsafe unsafe = UnsafeHelper.getUnsafe();
// Desired size of memory allocated at once
public static final int CHUNK_SIZE = 1024;

View File

@ -35,7 +35,7 @@ import java.util.ListIterator;
* stays nearly full.
* @run main/othervm
* -XX:+UseConcMarkSweepGC -XX:-CMSYield -XX:-CMSPrecleanRefLists1
* -XX:CMSInitiatingOccupancyFraction=0 -Xmx8m TestBubbleUpRef 16000 50 10000
* -XX:CMSInitiatingOccupancyFraction=0 -Xmx80m TestBubbleUpRef 16000 50 10000
*/
/**
@ -53,7 +53,7 @@ import java.util.ListIterator;
* Do it again.
*
* Use the following VM options
* -Xmx8m -XX:-CMSYield [-XX:+UseConcMarkSweepGC] -XX:-CMSPrecleanRefLists1
* -Xmx80m -XX:-CMSYield [-XX:+UseConcMarkSweepGC] -XX:-CMSPrecleanRefLists1
* -XX:CMSInitiatingOccupancyFraction=0
*
* Use parameter:

View File

@ -0,0 +1,138 @@
/*
* Copyright (c) 2016, 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.
*/
/*
* This file fuzzes the class name #15 to have a leading 'L' and ending ';'.
*/
class BadHelloWorld {
0xCAFEBABE;
0; // minor version
52; // version
[31] { // Constant Pool
; // first element is empty
Utf8 "BadHelloWorld"; // #1 at 0x0A
class #1; // #2 at 0x1A
Utf8 "java/lang/Object"; // #3 at 0x1D
class #3; // #4 at 0x30
Utf8 "<init>"; // #5 at 0x33
Utf8 "()V"; // #6 at 0x3C
NameAndType #5 #6; // #7 at 0x42
Method #4 #7; // #8 at 0x47
Utf8 "toString"; // #9 at 0x4C
Utf8 "()Ljava/lang/String;"; // #10 at 0x57
Utf8 "Hello, world!"; // #11 at 0x6E
String #11; // #12 at 0x7E
Utf8 "main"; // #13 at 0x81
Utf8 "([Ljava/lang/String;)V"; // #14 at 0x88
Utf8 "LBadHelloWorld;"; // #15 at 0xA1
class #15; // #16 at 0xB3
Method #16 #7; // #17 at 0xB6
Utf8 "java/lang/System"; // #18 at 0xBB
class #18; // #19 at 0xCE
Utf8 "out"; // #20 at 0xD1
Utf8 "Ljava/io/PrintStream;"; // #21 at 0xD7
NameAndType #20 #21; // #22 at 0xEF
Field #19 #22; // #23 at 0xF4
Utf8 "java/io/PrintStream"; // #24 at 0xF9
class #24; // #25 at 0x010F
Utf8 "println"; // #26 at 0x0112
Utf8 "(Ljava/lang/Object;)V"; // #27 at 0x011C
NameAndType #26 #27; // #28 at 0x0134
Method #25 #28; // #29 at 0x0139
Utf8 "Code"; // #30 at 0x013E
} // Constant Pool
0x0021; // access
#2;// this_cpx
#4;// super_cpx
[0] { // Interfaces
} // Interfaces
[0] { // fields
} // fields
[3] { // methods
{ // Member at 0x0151
0x0001; // access
#5; // name_cpx
#6; // sig_cpx
[1] { // Attributes
Attr(#30, 17) { // Code at 0x0159
1; // max_stack
1; // max_locals
Bytes[5]{
0x2AB70008B1;
};
[0] { // Traps
} // end Traps
[0] { // Attributes
} // Attributes
} // end Code
} // Attributes
} // Member
;
{ // Member at 0x0170
0x0001; // access
#9; // name_cpx
#10; // sig_cpx
[1] { // Attributes
Attr(#30, 15) { // Code at 0x0178
1; // max_stack
1; // max_locals
Bytes[3]{
0x120CB0;
};
[0] { // Traps
} // end Traps
[0] { // Attributes
} // Attributes
} // end Code
} // Attributes
} // Member
;
{ // Member at 0x018D
0x0089; // access
#13; // name_cpx
#14; // sig_cpx
[1] { // Attributes
Attr(#30, 28) { // Code at 0x0195
2; // max_stack
2; // max_locals
Bytes[16]{
0xBB001059B700114C;
0xB200172BB6001DB1;
};
[0] { // Traps
} // end Traps
[0] { // Attributes
} // Attributes
} // end Code
} // Attributes
} // Member
} // methods
[0] { // Attributes
} // Attributes
} // end class BadHelloWorld

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2016, 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 8148854
* @summary Ensure class name loaded by app class loader is format checked by default
* @library /test/lib
* @compile BadHelloWorld.jcod
* @modules java.base/jdk.internal.misc
* java.management
* @run main FormatCheckingTest
*/
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
public class FormatCheckingTest {
public static void main(String args[]) throws Throwable {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("BadHelloWorld");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("java.lang.ClassFormatError: Illegal class name");
output.shouldHaveExitValue(1);
}
}

View File

@ -34,13 +34,13 @@
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
public class CreateCoredumpOnCrash {
private static class Crasher {
public static void main(String[] args) {
Utils.getUnsafe().putInt(0L, 0);
UnsafeHelper.getUnsafe().putInt(0L, 0);
}
}

View File

@ -35,14 +35,14 @@
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
public class ProblematicFrameTest {
private static class Crasher {
public static void main(String[] args) {
Utils.getUnsafe().getInt(0);
UnsafeHelper.getUnsafe().getInt(0);
}
}

View File

@ -30,12 +30,12 @@
* @run main AllocateInstance
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class AllocateInstance {
static final Unsafe UNSAFE = Utils.getUnsafe();
static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
class TestClass {
public boolean calledConstructor = false;

View File

@ -31,13 +31,13 @@
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m AllocateMemory
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class AllocateMemory {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
// Allocate a byte, write to the location and read back the value
long address = unsafe.allocateMemory(1);

View File

@ -30,14 +30,14 @@
* @run main CopyMemory
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class CopyMemory {
final static int LENGTH = 8;
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
long src = unsafe.allocateMemory(LENGTH);
long dst = unsafe.allocateMemory(LENGTH);
assertNotEquals(src, 0L);

View File

@ -34,13 +34,13 @@
import java.security.ProtectionDomain;
import java.io.InputStream;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class DefineClass {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
TestClassLoader classloader = new TestClassLoader();
ProtectionDomain pd = new ProtectionDomain(null, null);

View File

@ -31,14 +31,14 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import java.lang.reflect.*;
import static jdk.test.lib.Asserts.*;
public class FieldOffset {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Field[] fields = Test.class.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {

View File

@ -30,14 +30,14 @@
* @run main GetField
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import java.lang.reflect.*;
import static jdk.test.lib.Asserts.*;
public class GetField {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
// Unsafe.INVALID_FIELD_OFFSET is a static final int field,
// make sure getField returns the correct field
Field field = Unsafe.class.getField("INVALID_FIELD_OFFSET");

View File

@ -31,13 +31,13 @@
*/
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutAddress {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
int addressSize = unsafe.addressSize();
// Ensure the size returned from Unsafe.addressSize is correct
assertEquals(unsafe.addressSize(), Platform.is32bit() ? 4 : 8);

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutBoolean {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("b1");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutByte {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("b");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutChar {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("c");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutDouble {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("d");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutFloat {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("f");

View File

@ -30,13 +30,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutInt {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("i");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutLong {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("l");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutObject {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Object o = new Object();
Field field = Test.class.getField("o");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutShort {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("s");

View File

@ -30,13 +30,13 @@
import static jdk.test.lib.Asserts.*;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
public class GetUncompressedObject {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
// Allocate some memory and fill it with non-zero values.
final int size = 32;

View File

@ -35,7 +35,7 @@ import java.security.ProtectionDomain;
import java.io.InputStream;
import java.lang.*;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
@ -50,7 +50,7 @@ public class NestedUnsafe {
" } } ");
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Class klass = unsafe.defineAnonymousClass(NestedUnsafe.class, klassbuf, new Object[0]);
unsafe.ensureClassInitialized(klass);

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class PageSize {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
int pageSize = unsafe.pageSize();
for (int n = 1; n != 0; n <<= 1) {

View File

@ -33,7 +33,7 @@
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
@ -60,7 +60,7 @@ public class RangeCheck {
public static class DummyClassWithMainRangeCheck {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
unsafe.getObject(new DummyClassWithMainRangeCheck(), Short.MAX_VALUE);
}
}

View File

@ -31,13 +31,13 @@
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m Reallocate
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class Reallocate {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
long address = unsafe.allocateMemory(1);
assertNotEquals(address, 0L);

View File

@ -30,13 +30,13 @@
* @run main SetMemory
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class SetMemory {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
long address = unsafe.allocateMemory(1);
assertNotEquals(address, 0L);
unsafe.setMemory(address, 1, (byte)17);

View File

@ -30,13 +30,13 @@
* @run main ThrowException
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class ThrowException {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
try {
unsafe.throwException(new TestException());
} catch (Throwable t) {

View File

@ -39,7 +39,7 @@ import java.util.regex.Pattern;
* Concrete subclasses should implement method {@link #process()}.
*/
public abstract class PathHandler {
private static final Unsafe UNSAFE = jdk.test.lib.Utils.getUnsafe();
private static final Unsafe UNSAFE = jdk.test.lib.unsafe.UnsafeHelper.getUnsafe();
private static final AtomicLong CLASS_COUNT = new AtomicLong(0L);
private static volatile boolean CLASSES_LIMIT_REACHED = false;
private static final Pattern JAR_IN_DIR_PATTERN