8001307: Modify ACC_SUPER behavior
authorkamg
Mon, 05 Nov 2012 17:03:33 -0500
changeset 15918 3fcc894aca8c
parent 15917 e8b270c49398
child 15919 15a548ffc099
8001307: Modify ACC_SUPER behavior Summary: Disallow non-virtual calls even when ACC_SUPER is absent. Reviewed-by: kvn, acorn
hotspot/src/share/vm/interpreter/linkResolver.cpp
hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Fri Oct 26 09:27:25 2012 -0700
+++ b/hotspot/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/hotspot/src/share/vm/runtime/globals.hpp	Fri Oct 26 09:27:25 2012 -0700
+++ b/hotspot/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