changeset 16397:9ca36e4e3137

removed use of SecurityManager and hiding fields from reflection (made redundant by -XX:+UseGraalClassLoader option)
author Doug Simon <doug.simon@oracle.com>
date Thu, 03 Jul 2014 19:07:44 +0200
parents 5c0f2b338874
children c5ab3fbec257
files graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java
diffstat 2 files changed, 0 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java	Thu Jul 03 18:57:20 2014 +0200
+++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java	Thu Jul 03 19:07:44 2014 +0200
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.api.runtime;
 
-import java.lang.reflect.*;
-
 import sun.reflect.*;
 
 public class Graal {
@@ -32,17 +30,7 @@
 
     private static native GraalRuntime initializeRuntime();
 
-    public static final java.security.Permission ACCESS_PERMISSION = new ReflectPermission("allowGraalAccess");
-
-    @CallerSensitive
     public static GraalRuntime getRuntime() {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            Class<?> cc = Reflection.getCallerClass();
-            if (cc.getClassLoader() != null) {
-                sm.checkPermission(ACCESS_PERMISSION);
-            }
-        }
         return runtime;
     }
 
@@ -54,18 +42,10 @@
             rt = new InvalidGraalRuntime();
         }
         runtime = rt;
-        Reflection.registerFieldsToFilter(Graal.class, "runtime");
     }
 
     @CallerSensitive
     public static <T> T getRequiredCapability(Class<T> clazz) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            Class<?> cc = Reflection.getCallerClass();
-            if (cc.getClassLoader() != null) {
-                sm.checkPermission(ACCESS_PERMISSION);
-            }
-        }
         T t = getRuntime().getCapability(clazz);
         if (t == null) {
             String javaHome = System.getProperty("java.home");
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Thu Jul 03 18:57:20 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Thu Jul 03 19:07:44 2014 +0200
@@ -28,13 +28,11 @@
 import static com.oracle.graal.hotspot.CompileTheWorld.Options.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.Options.*;
 import static com.oracle.graal.hotspot.InitTimer.*;
-import static sun.reflect.Reflection.*;
 
 import java.lang.reflect.*;
 import java.util.*;
 
 import sun.misc.*;
-import sun.reflect.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.code.stack.*;
@@ -79,22 +77,12 @@
             // Why deferred initialization? See comment in completeInitialization().
             instance.completeInitialization();
         }
-
-        registerFieldsToFilter(HotSpotGraalRuntime.class, "instance");
     }
 
     /**
      * Gets the singleton {@link HotSpotGraalRuntime} object.
      */
-    @CallerSensitive
     public static HotSpotGraalRuntime runtime() {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            Class<?> cc = Reflection.getCallerClass();
-            if (cc != null && cc.getClassLoader() != null) {
-                sm.checkPermission(Graal.ACCESS_PERMISSION);
-            }
-        }
         assert instance != null;
         return instance;
     }