test/compiler/whitebox/GetNMethodTest.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/test/compiler/whitebox/GetNMethodTest.java Wed Nov 5 19:24:02 2014
--- new/test/compiler/whitebox/GetNMethodTest.java Wed Nov 5 19:24:02 2014
*** 20,30 ****
--- 20,32 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
+ import sun.hotspot.code.BlobType;
import sun.hotspot.code.NMethod;
+ import com.oracle.java.testlibrary.Asserts;
/*
* @test GetNMethodTest
* @bug 8038240
* @library /testlibrary /testlibrary/whitebox
*** 50,72 ****
--- 52,99 ----
protected void test() throws Exception {
checkNotCompiled();
compile();
checkCompiled();
+
NMethod nmethod = NMethod.get(method, testCase.isOsr());
if (IS_VERBOSE) {
System.out.println("nmethod = " + nmethod);
}
if (nmethod == null) {
! throw new RuntimeException("nmethod of compiled method is null");
+ Asserts.assertNotNull(nmethod,
! "nmethod of compiled method is null");
+ Asserts.assertNotNull(nmethod.insts,
+ "nmethod.insts of compiled method is null");
+ Asserts.assertGT(nmethod.insts.length, 0,
+ "compiled method's instructions is empty");
+ Asserts.assertNotNull(nmethod.code_blob_type, "blob type is null");
+ if (WHITE_BOX.getBooleanVMFlag("SegmentedCodeCache")) {
+ Asserts.assertNE(nmethod.code_blob_type, BlobType.All);
+ switch (nmethod.comp_level) {
+ case 1:
+ case 4:
+ checkBlockType(nmethod, BlobType.MethodNonProfiled);
+ break;
+ case 2:
+ case 3:
+ checkBlockType(nmethod, BlobType.MethodNonProfiled);
+ break;
+ default:
+ throw new Error("unexpected comp level " + nmethod);
}
! if (nmethod.insts.length == 0) {
! throw new RuntimeException("compiled method's instructions is empty");
! } else {
! Asserts.assertEQ(nmethod.code_blob_type, BlobType.All);
}
+
deoptimize();
checkNotCompiled();
nmethod = NMethod.get(method, testCase.isOsr());
if (nmethod != null) {
! throw new RuntimeException("nmethod of non-compiled method isn't null");
+ Asserts.assertNull(nmethod,
! "nmethod of non-compiled method isn't null");
}
+
+ private void checkBlockType(NMethod nmethod, BlobType expectedType) {
+ Asserts.assertEQ(nmethod.code_blob_type, expectedType,
+ String.format("blob_type[%s] for %d level isn't %s",
+ nmethod.code_blob_type, nmethod.comp_level, expectedType));
}
}
test/compiler/whitebox/GetNMethodTest.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File