changeset 18260:7ef05ae0bd19

8012243: about 30% regression on specjvm2008.serial on 7u25 comparing 7u21 Reviewed-by: alanb, skoivu, smarks, mchung
author dfuchs
date Thu, 02 May 2013 10:46:09 +0200
parents ac87cc8d81aa
children 3d81094a9d10
files jdk/src/share/classes/java/io/ObjectStreamClass.java jdk/src/share/classes/java/io/ObjectStreamField.java
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/share/classes/java/io/ObjectStreamClass.java	Tue Apr 30 13:55:48 2013 +0400
+++ b/jdk/src/share/classes/java/io/ObjectStreamClass.java	Thu May 02 10:46:09 2013 +0200
@@ -266,9 +266,11 @@
         if (cl == null) {
             return null;
         }
-        Class<?> caller = Reflection.getCallerClass();
-        if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), cl.getClassLoader())) {
-            ReflectUtil.checkPackageAccess(cl);
+        if (System.getSecurityManager() != null) {
+            Class<?> caller = Reflection.getCallerClass();
+            if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), cl.getClassLoader())) {
+                ReflectUtil.checkPackageAccess(cl);
+            }
         }
         return cl;
     }
--- a/jdk/src/share/classes/java/io/ObjectStreamField.java	Tue Apr 30 13:55:48 2013 +0400
+++ b/jdk/src/share/classes/java/io/ObjectStreamField.java	Thu May 02 10:46:09 2013 +0200
@@ -162,9 +162,11 @@
      */
     @CallerSensitive
     public Class<?> getType() {
-        Class<?> caller = Reflection.getCallerClass();
-        if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), type.getClassLoader())) {
-            ReflectUtil.checkPackageAccess(type);
+        if (System.getSecurityManager() != null) {
+            Class<?> caller = Reflection.getCallerClass();
+            if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), type.getClassLoader())) {
+                ReflectUtil.checkPackageAccess(type);
+            }
         }
         return type;
     }