changeset 8728:db58bf8ee204

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
author zmajo
date Thu, 16 Jul 2015 15:02:12 +0200
parents 3b81bc9fe683
children aa7220a36fb0
files src/share/vm/classfile/classFileParser.cpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/runtime/globals.hpp
diffstat 3 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp	Mon Jul 13 09:44:38 2015 +0200
+++ b/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/src/share/vm/classfile/vmSymbols.hpp	Mon Jul 13 09:44:38 2015 +0200
+++ b/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/src/share/vm/runtime/globals.hpp	Mon Jul 13 09:44:38 2015 +0200
+++ b/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