8015385: Remove RelaxAccessControlCheck for JDK 8 bytecodes
authorhseigel
Mon, 03 Jun 2013 10:00:10 -0400
changeset 17863 d77007cf03c1
parent 17862 b4d20f26a4fa
child 17864 29aa71317b51
8015385: Remove RelaxAccessControlCheck for JDK 8 bytecodes Summary: Check bytecode versions along with RelaxAccessControlCheck version Reviewed-by: dholmes, acorn
hotspot/src/share/vm/classfile/verifier.hpp
hotspot/src/share/vm/runtime/reflection.cpp
--- a/hotspot/src/share/vm/classfile/verifier.hpp	Sat Jun 01 09:28:26 2013 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.hpp	Mon Jun 03 10:00:10 2013 -0400
@@ -36,8 +36,10 @@
 class Verifier : AllStatic {
  public:
   enum {
+    STRICTER_ACCESS_CTRL_CHECK_VERSION  = 49,
     STACKMAP_ATTRIBUTE_MAJOR_VERSION    = 50,
-    INVOKEDYNAMIC_MAJOR_VERSION         = 51
+    INVOKEDYNAMIC_MAJOR_VERSION         = 51,
+    NO_RELAX_ACCESS_CTRL_CHECK_VERSION  = 52
   };
   typedef enum { ThrowException, NoException } Mode;
 
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Sat Jun 01 09:28:26 2013 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Mon Jun 03 10:00:10 2013 -0400
@@ -44,8 +44,6 @@
 #include "runtime/signature.hpp"
 #include "runtime/vframe.hpp"
 
-#define JAVA_1_5_VERSION                  49
-
 static void trace_class_resolution(Klass* to_class) {
   ResourceMark rm;
   int line_number = -1;
@@ -507,9 +505,11 @@
       under_host_klass(accessee_ik, accessor))
     return true;
 
-  if (RelaxAccessControlCheck ||
-      (accessor_ik->major_version() < JAVA_1_5_VERSION &&
-       accessee_ik->major_version() < JAVA_1_5_VERSION)) {
+  if ((RelaxAccessControlCheck &&
+        accessor_ik->major_version() < Verifier::NO_RELAX_ACCESS_CTRL_CHECK_VERSION &&
+        accessee_ik->major_version() < Verifier::NO_RELAX_ACCESS_CTRL_CHECK_VERSION) ||
+      (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()) &&
       accessor_ik->protection_domain() == accessee_ik->protection_domain() &&