changeset 8702:77443715ec55

8001307: Modify ACC_SUPER behavior Summary: Disallow non-virtual calls even when ACC_SUPER is absent. Reviewed-by: kvn, acorn
author kamg
date Mon, 05 Nov 2012 17:03:33 -0500
parents b95ad0610fef
children b5cb079ecaa4
files src/share/vm/interpreter/linkResolver.cpp src/share/vm/runtime/globals.hpp
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/interpreter/linkResolver.cpp	Fri Oct 26 09:27:25 2012 -0700
+++ b/src/share/vm/interpreter/linkResolver.cpp	Mon Nov 05 17:03:33 2012 -0500
@@ -786,7 +786,7 @@
 
     if (check_access &&
         // a) check if ACC_SUPER flag is set for the current class
-        current_klass->is_super() &&
+        (current_klass->is_super() || !AllowNonVirtualCalls) &&
         // b) check if the method class is a superclass of the current class (superclass relation is not reflexive!)
         current_klass->is_subtype_of(method_klass()) && current_klass() != method_klass() &&
         // c) check if the method is not <init>
--- a/src/share/vm/runtime/globals.hpp	Fri Oct 26 09:27:25 2012 -0700
+++ b/src/share/vm/runtime/globals.hpp	Mon Nov 05 17:03:33 2012 -0500
@@ -3602,7 +3602,10 @@
           "Enable internal testing APIs")                                   \
                                                                             \
   product(bool, PrintGCCause, true,                                         \
-          "Include GC cause in GC logging")
+          "Include GC cause in GC logging")                                 \
+                                                                            \
+  product(bool, AllowNonVirtualCalls, false,                                \
+          "Obey the ACC_SUPER flag and allow invokenonvirtual calls")
 
 /*
  *  Macros for factoring of globals