8131326: Enable CheckIntrinsics in all types of builds

Enable CheckIntrinsics flag in all builds; make check for orphan methods available only in debug builds.

Reviewed-by: kvn
This commit is contained in:
Zoltan Majo 2015-07-16 15:02:12 +02:00
parent b75ed4ce34
commit 1a3b0cca61
3 changed files with 16 additions and 4 deletions

View File

@ -4172,10 +4172,13 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
} }
} }
#ifdef ASSERT
if (CheckIntrinsics) { if (CheckIntrinsics) {
// Check for orphan methods in the current class. A method m // Check for orphan methods in the current class. A method m
// of a class C is orphan if an intrinsic is defined for method m, // of a class C is orphan if an intrinsic is defined for method m,
// but class C does not declare m. // but class C does not declare m.
// The check is potentially expensive, therefore it is available
// only in debug builds.
for (int id = vmIntrinsics::FIRST_ID; id < (int)vmIntrinsics::ID_LIMIT; id++) { for (int id = vmIntrinsics::FIRST_ID; id < (int)vmIntrinsics::ID_LIMIT; id++) {
if (id == vmIntrinsics::_compiledLambdaForm) { if (id == vmIntrinsics::_compiledLambdaForm) {
@ -4211,8 +4214,10 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
} }
} }
} }
#endif // ASSERT
} }
if (cached_class_file != NULL) { if (cached_class_file != NULL) {
// JVMTI: we have an InstanceKlass now, tell it about the cached bytes // JVMTI: we have an InstanceKlass now, tell it about the cached bytes
this_klass->set_cached_class_file(cached_class_file); this_klass->set_cached_class_file(cached_class_file);

View File

@ -658,7 +658,10 @@
// annotation. If CheckIntrinsics is enabled, the VM performs the following // annotation. If CheckIntrinsics is enabled, the VM performs the following
// checks when a class C is loaded: (1) all intrinsics defined by the VM for // checks when a class C is loaded: (1) all intrinsics defined by the VM for
// class C are present in the loaded class file and are marked; // class C are present in the loaded class file and are marked;
// (2) an intrinsic is defined by the VM for all marked methods of class C. // (2) an intrinsic is defined by the VM for all marked methods of class C;
// (3) check for orphan methods in class C (i.e., methods for which the VM
// declares an intrinsic but that are not declared for the loaded class C.
// Check (3) is available only in debug builds.
// //
// If a mismatch is detected for a method, the VM behaves differently depending // If a mismatch is detected for a method, the VM behaves differently depending
// on the type of build. A fastdebug build exits and reports an error on a mismatch. // on the type of build. A fastdebug build exits and reports an error on a mismatch.

View File

@ -4130,14 +4130,18 @@ public:
"Use the FP register for holding the frame pointer " \ "Use the FP register for holding the frame pointer " \
"and not as a general purpose register.") \ "and not as a general purpose register.") \
\ \
diagnostic(bool, CheckIntrinsics, trueInDebug, \ diagnostic(bool, CheckIntrinsics, true, \
"When a class C is loaded, check that " \ "When a class C is loaded, check that " \
"(1) all intrinsics defined by the VM for class C are present "\ "(1) all intrinsics defined by the VM for class C are present "\
"in the loaded class file and are marked with the " \ "in the loaded class file and are marked with the " \
"@HotSpotIntrinsicCandidate annotation and also that " \ "@HotSpotIntrinsicCandidate annotation, that " \
"(2) there is an intrinsic registered for all loaded methods " \ "(2) there is an intrinsic registered for all loaded methods " \
"that are annotated with the @HotSpotIntrinsicCandidate " \ "that are annotated with the @HotSpotIntrinsicCandidate " \
"annotation.") "annotation, and that " \
"(3) no orphan methods exist for class C (i.e., methods for " \
"which the VM declares an intrinsic but that are not declared "\
"in the loaded class C. " \
"Check (3) is available only in debug builds.")
/* /*
* Macros for factoring of globals * Macros for factoring of globals