changeset 3481:da3747196112 icedtea-2.2.5

8001307: Modify ACC_SUPER behavior Summary: Disallow non-virtual calls even when ACC_SUPER is absent. Reviewed-by: kvn, acorn
author kamg
date Thu, 08 Nov 2012 17:45:05 -0500
parents 60d6e32e00a6
children d2e4bf94d38d
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	Mon Jan 14 22:54:04 2013 +0000
+++ b/src/share/vm/interpreter/linkResolver.cpp	Thu Nov 08 17:45:05 2012 -0500
@@ -712,7 +712,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	Mon Jan 14 22:54:04 2013 +0000
+++ b/src/share/vm/runtime/globals.hpp	Thu Nov 08 17:45:05 2012 -0500
@@ -3902,7 +3902,10 @@
   product(bool, UseVMInterruptibleIO, false,                                \
           "(Unstable, Solaris-specific) Thread interrupt before or with "   \
           "EINTR for I/O operations results in OS_INTRPT. The default value"\
-          " of this flag is true for JDK 6 and earlier")
+          " of this flag is true for JDK 6 and earlier")                    \
+                                                                            \
+  product(bool, AllowNonVirtualCalls, false,                                \
+         "Obey the ACC_SUPER flag and allow invokenonvirtual calls")
 
 /*
  *  Macros for factoring of globals