8131326: Enable CheckIntrinsics in all types of builds
authorzmajo
Thu, 16 Jul 2015 15:02:12 +0200
changeset 31862 8673bd4db4b1
parent 31861 7efea6fae96b
child 31863 22ea3a456610
8131326: Enable CheckIntrinsics in all types of builds Summary: Enable CheckIntrinsics flag in all builds; make check for orphan methods available only in debug builds. Reviewed-by: kvn
hotspot/src/share/vm/classfile/classFileParser.cpp
hotspot/src/share/vm/classfile/vmSymbols.hpp
hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon Jul 13 09:44:38 2015 +0200
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Jul 16 15:02:12 2015 +0200
@@ -4172,10 +4172,13 @@
         }
       }
 
+#ifdef ASSERT
       if (CheckIntrinsics) {
         // 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,
         // 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++) {
           if (id == vmIntrinsics::_compiledLambdaForm) {
@@ -4211,8 +4214,10 @@
           }
         }
       }
+#endif // ASSERT
     }
 
+
     if (cached_class_file != NULL) {
       // JVMTI: we have an InstanceKlass now, tell it about the cached bytes
       this_klass->set_cached_class_file(cached_class_file);
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Mon Jul 13 09:44:38 2015 +0200
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Jul 16 15:02:12 2015 +0200
@@ -658,7 +658,10 @@
 // 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
 // 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
 // on the type of build. A fastdebug build exits and reports an error on a mismatch.
--- a/hotspot/src/share/vm/runtime/globals.hpp	Mon Jul 13 09:44:38 2015 +0200
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Thu Jul 16 15:02:12 2015 +0200
@@ -4130,14 +4130,18 @@
              "Use the FP register for holding the frame pointer "           \
              "and not as a general purpose register.")                      \
                                                                             \
-  diagnostic(bool, CheckIntrinsics, trueInDebug,                            \
+  diagnostic(bool, CheckIntrinsics, true,                                   \
              "When a class C is loaded, check that "                        \
              "(1) all intrinsics defined by the VM for class C are present "\
              "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 " \
              "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