< prev index next >

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2014, 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. --- 1,7 ---- /* ! * Copyright (c) 2014, 2018, 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.
*** 20,31 **** * or visit www.oracle.com if you need additional information or have any * questions. */ package jdk.vm.ci.services; - import java.lang.reflect.Method; import java.util.Map; /** * Provides utilities needed by JVMCI clients. */ public final class Services { --- 20,33 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package jdk.vm.ci.services; import java.util.Map; + import java.util.Set; + + import jdk.internal.misc.VM; /** * Provides utilities needed by JVMCI clients. */ public final class Services {
*** 59,80 **** } private Services() { } ! @SuppressWarnings("unchecked") ! private static Map<String, String> initSavedProperties() throws InternalError { ! try { ! Class<?> vmClass = Class.forName("jdk.internal.misc.VM"); ! Method m = vmClass.getMethod("getSavedProperties"); ! return (Map<String, String>) m.invoke(null); ! } catch (Exception e) { ! throw new InternalError(e); ! } ! } ! ! static final Map<String, String> SAVED_PROPERTIES = initSavedProperties(); static final boolean JVMCI_ENABLED = Boolean.parseBoolean(SAVED_PROPERTIES.get("jdk.internal.vm.ci.enabled")); /** * Checks that JVMCI is enabled in the VM and throws an error if it isn't. */ --- 61,71 ---- } private Services() { } ! static final Map<String, String> SAVED_PROPERTIES = VM.getSavedProperties(); static final boolean JVMCI_ENABLED = Boolean.parseBoolean(SAVED_PROPERTIES.get("jdk.internal.vm.ci.enabled")); /** * Checks that JVMCI is enabled in the VM and throws an error if it isn't. */
*** 105,110 **** --- 96,117 ---- Class.forName("jdk.vm.ci.runtime.JVMCI"); } catch (ClassNotFoundException e) { throw new InternalError(e); } } + + /** + * Opens all JVMCI packages to {@code otherModule}. + */ + static void openJVMCITo(Module otherModule) { + Module jvmci = Services.class.getModule(); + if (jvmci != otherModule) { + Set<String> packages = jvmci.getPackages(); + for (String pkg : packages) { + boolean opened = jvmci.isOpen(pkg, otherModule); + if (!opened) { + jvmci.addOpens(pkg, otherModule); + } + } + } + } }
< prev index next >