Mercurial > hg > graal-jvmci-8
changeset 23380:cd8fd4cced6c
added JVMCIPermission (JDK-8155023)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 09 May 2016 16:34:20 +0200 |
parents | 24505bf61633 |
children | a2faf07d2fa5 |
files | jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/EventProvider.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotVMEventListener.java jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/services/JVMCICompilerFactory.java jvmci/jdk.vm.ci.services/src/jdk/vm/ci/services/JVMCIPermission.java jvmci/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java mx.jvmci/suite.py |
diffstat | 6 files changed, 50 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/EventProvider.java Mon May 09 16:08:16 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/EventProvider.java Mon May 09 16:34:20 2016 +0200 @@ -24,6 +24,7 @@ import jdk.vm.ci.hotspot.services.EmptyEventProvider.EmptyCompilationEvent; import jdk.vm.ci.hotspot.services.EmptyEventProvider.EmptyCompilerFailureEvent; +import jdk.vm.ci.services.JVMCIPermission; /** * Service-provider class for logging compiler related events. @@ -33,7 +34,7 @@ private static Void checkPermission() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(new RuntimePermission("jvmci")); + sm.checkPermission(new JVMCIPermission()); } return null; } @@ -46,7 +47,7 @@ * Initializes a new instance of this class. * * @throws SecurityException if a security manager has been installed and it denies - * {@code RuntimePermission("jvmci")} + * {@link JVMCIPermission} */ protected EventProvider() { this(checkPermission());
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotVMEventListener.java Mon May 09 16:08:16 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotVMEventListener.java Mon May 09 16:34:20 2016 +0200 @@ -28,6 +28,7 @@ import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.meta.JVMCIMetaAccessContext; import jdk.vm.ci.meta.ResolvedJavaType; +import jdk.vm.ci.services.JVMCIPermission; /** * Service-provider class for responding to VM events and for creating @@ -38,7 +39,7 @@ private static Void checkPermission() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(new RuntimePermission("jvmci")); + sm.checkPermission(new JVMCIPermission()); } return null; } @@ -51,7 +52,7 @@ * Initializes a new instance of this class. * * @throws SecurityException if a security manager has been installed and it denies - * {@code RuntimePermission("jvmci")} + * {@link JVMCIPermission} */ protected HotSpotVMEventListener() { this(checkPermission());
--- a/jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/services/JVMCICompilerFactory.java Mon May 09 16:08:16 2016 +0200 +++ b/jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/services/JVMCICompilerFactory.java Mon May 09 16:34:20 2016 +0200 @@ -24,6 +24,7 @@ import jdk.vm.ci.runtime.JVMCICompiler; import jdk.vm.ci.runtime.JVMCIRuntime; +import jdk.vm.ci.services.JVMCIPermission; /** * Service-provider class for creating JVMCI compilers. @@ -33,7 +34,7 @@ private static Void checkPermission() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(new RuntimePermission("jvmci")); + sm.checkPermission(new JVMCIPermission()); } return null; } @@ -46,7 +47,7 @@ * Initializes a new instance of this class. * * @throws SecurityException if a security manager has been installed and it denies - * {@code RuntimePermission("jvmci")} + * {@link JVMCIPermission} */ protected JVMCICompilerFactory() { this(checkPermission());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.vm.ci.services/src/jdk/vm/ci/services/JVMCIPermission.java Mon May 09 16:34:20 2016 +0200 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.services; + +import java.security.BasicPermission; + +/** + * This class represents the permission to access JVMCI services. + */ +public class JVMCIPermission extends BasicPermission { + + private static final long serialVersionUID = 6346818963934448226L; + + public JVMCIPermission() { + super("jvmci"); + } +}
--- a/jvmci/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java Mon May 09 16:08:16 2016 +0200 +++ b/jvmci/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java Mon May 09 16:34:20 2016 +0200 @@ -75,7 +75,7 @@ * * @param requestor a class requesting access to the JVMCI module for its module * @throws SecurityException if a security manager is present and it denies - * {@code RuntimePermission("jvmci")} + * {@link JVMCIPermission} */ public static void exportJVMCITo(Class<?> requestor) { // There are no modules in JVMCI-8. @@ -91,7 +91,7 @@ public static <S> Iterable<S> load(Class<S> service) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(new RuntimePermission("jvmci")); + sm.checkPermission(new JVMCIPermission()); } try { return (Iterable<S>) cache.get(service); @@ -113,7 +113,7 @@ public static <S> S loadSingle(Class<S> service, boolean required) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(new RuntimePermission("jvmci")); + sm.checkPermission(new JVMCIPermission()); } Iterable<S> providers; try {
--- a/mx.jvmci/suite.py Mon May 09 16:08:16 2016 +0200 +++ b/mx.jvmci/suite.py Mon May 09 16:34:20 2016 +0200 @@ -100,6 +100,7 @@ "sourceDirs" : ["src"], "dependencies" : [ "jdk.vm.ci.code", + "jdk.vm.ci.services", ], "checkstyle" : "jdk.vm.ci.services", "javaCompliance" : "1.8", @@ -164,7 +165,6 @@ "jdk.vm.ci.common", "jdk.vm.ci.inittimer", "jdk.vm.ci.runtime", - "jdk.vm.ci.services", ], "annotationProcessors" : [ "JVMCI_HOTSPOTVMCONFIG_PROCESSOR",