Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
[GR-48318] Add jdk.compiler.graal in addition to jdk.internal.vm.comp…
Browse files Browse the repository at this point in the history
…iler.

PullRequest: labsjdk-ce-21/30
  • Loading branch information
dougxc committed Oct 14, 2023
2 parents af67e4e + 6acf1a0 commit f0b1057
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 27 deletions.
4 changes: 2 additions & 2 deletions ci.jsonnet
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# https://github.com/graalvm/labs-openjdk-21/blob/master/doc/testing.md
local run_test_spec = "test/hotspot/jtreg/compiler/jvmci test/jdk/tools/jlink/plugins/SaveJlinkArgfilesPluginTest.java";

local labsjdk_builder_version = "8928c95fac6928559341b784233d0f1b985a3a4f";
local labsjdk_builder_version = "bcdc3fc82760543571fac7c1c35452dbb2ce6b9b";

# Returns true if `str` contains `needle` as a substring.
local contains(str, needle) = std.findSubstr(needle, str) != [];

{
overlay: "9aaf850438f4551337c76b9133b700c23abfd739",
overlay: "087852016f367deb24c7d893052ab48e04e698c1",
specVersion: "3",

mxDependencies:: {
Expand Down
2 changes: 2 additions & 0 deletions make/common/Modules.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ ifeq ($(INCLUDE_JVMCI), false)
MODULES_FILTER += jdk.internal.vm.ci
MODULES_FILTER += jdk.internal.vm.compiler
MODULES_FILTER += jdk.internal.vm.compiler.management
MODULES_FILTER += jdk.compiler.graal
MODULES_FILTER += jdk.compiler.graal.management
endif

# jpackage is only on windows, macosx, and linux
Expand Down
2 changes: 2 additions & 0 deletions make/conf/module-loader-map.conf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ UPGRADEABLE_PLATFORM_MODULES= \
java.compiler \
jdk.internal.vm.compiler \
jdk.internal.vm.compiler.management \
jdk.compiler.graal \
jdk.compiler.graal.management \
#

PLATFORM_MODULES= \
Expand Down
12 changes: 2 additions & 10 deletions src/java.base/share/lib/security/default.policy
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,8 @@ grant codeBase "jrt:/jdk.internal.vm.compiler" {
permission java.security.AllPermission;
};

grant codeBase "jrt:/jdk.internal.vm.compiler.management" {
permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.vm.compiler.collections";
permission java.lang.RuntimePermission "accessClassInPackage.jdk.vm.ci.runtime";
permission java.lang.RuntimePermission "accessClassInPackage.jdk.vm.ci.services";
permission java.lang.RuntimePermission "accessClassInPackage.org.graalvm.compiler.core.common";
permission java.lang.RuntimePermission "accessClassInPackage.org.graalvm.compiler.debug";
permission java.lang.RuntimePermission "accessClassInPackage.org.graalvm.compiler.hotspot";
permission java.lang.RuntimePermission "accessClassInPackage.org.graalvm.compiler.options";
permission java.lang.RuntimePermission "accessClassInPackage.org.graalvm.compiler.phases.common.jmx";
permission java.lang.RuntimePermission "accessClassInPackage.org.graalvm.compiler.serviceprovider";
grant codeBase "jrt:/jdk.compiler.graal" {
permission java.security.AllPermission;
};

grant codeBase "jrt:/jdk.jsobject" {
Expand Down
41 changes: 41 additions & 0 deletions src/jdk.compiler.graal.management/share/classes/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2023, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/

/**
* Registers JVMCI compiler specific management interfaces for the JVM.
*
* This is an empty and upgradeable module that is a placeholder for an
* external implementation of a JVMCI compiler. It must be upgradeable so
* that it can be replaced when jlinking a new JDK image without failing
* the hash check for the qualified exports in jdk.internal.vm.ci's
* module descriptor.
*
* @moduleGraph
* @since 22
*/
module jdk.compiler.graal.management {
requires jdk.internal.vm.ci;
}

41 changes: 41 additions & 0 deletions src/jdk.compiler.graal/share/classes/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2023, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/

/**
* JVMCI compiler implementation for the JVM.
*
* This is an empty and upgradeable module that is a placeholder for an
* external implementation of a JVMCI compiler. It must be upgradeable so
* that it can be replaced when jlinking a new JDK image without failing
* the hash check for the qualified exports in jdk.internal.vm.ci's
* module descriptor.
*
* @moduleGraph
* @since 22
*/

module jdk.compiler.graal {
requires jdk.internal.vm.ci;
}
14 changes: 9 additions & 5 deletions src/jdk.internal.vm.ci/share/classes/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@
module jdk.internal.vm.ci {
exports jdk.vm.ci.services to
jdk.internal.vm.compiler,
jdk.internal.vm.compiler.management;
jdk.internal.vm.compiler.management,
jdk.compiler.graal,
jdk.compiler.graal.management;
exports jdk.vm.ci.runtime to
jdk.internal.vm.compiler,
jdk.internal.vm.compiler.management;
exports jdk.vm.ci.meta to jdk.internal.vm.compiler;
exports jdk.vm.ci.code to jdk.internal.vm.compiler;
exports jdk.vm.ci.hotspot to jdk.internal.vm.compiler;
jdk.internal.vm.compiler.management,
jdk.compiler.graal,
jdk.compiler.graal.management;
exports jdk.vm.ci.meta to jdk.internal.vm.compiler, jdk.compiler.graal;
exports jdk.vm.ci.code to jdk.internal.vm.compiler, jdk.compiler.graal;
exports jdk.vm.ci.hotspot to jdk.internal.vm.compiler, jdk.compiler.graal;

uses jdk.vm.ci.services.JVMCIServiceLocator;
uses jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* @requires vm.graal.enabled & vm.compMode == "Xmixed"
* @library /test/lib /
* @library ../common/patches
* @modules jdk.internal.vm.compiler
* @modules java.base/jdk.internal.misc
* @modules java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,11 @@ static Set<String> systemModules() {

Set<String> mods = Set.of(
// All JVMCI packages other than jdk.vm.ci.services are dynamically
// exported to jdk.internal.vm.compiler
"jdk.internal.vm.compiler", "jdk.internal.vm.compiler.management"
// exported to Graal
"jdk.compiler.graal", "jdk.compiler.graal.management"
);
// Filters all modules that directly or indirectly require jdk.internal.vm.compiler
// and jdk.internal.vm.compiler.management, as these are upgradeable and
// also provide APIs to add qualified exports dynamically
// Filters all modules that directly or indirectly require Graal modules
// as these are upgradeable and also provide APIs to add qualified exports dynamically
Set<String> filters = mods.stream().flatMap(mn -> findDeps(mn, inverseDeps).stream())
.collect(Collectors.toSet());
System.out.println("Filtered modules: " + filters);
Expand Down
4 changes: 2 additions & 2 deletions test/jdk/jdk/modules/etc/UpgradeableModules.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
public class UpgradeableModules {
private static final List<String> UPGRADEABLE_MODULES =
List.of("java.compiler",
"jdk.internal.vm.compiler",
"jdk.internal.vm.compiler.management");
"jdk.compiler.graal",
"jdk.compiler.graal.management");


public static void main(String... args) {
Expand Down
4 changes: 2 additions & 2 deletions test/jdk/tools/jimage/VerifyJimage.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ private String toClassName(String entry) {
}

// All JVMCI packages other than jdk.vm.ci.services are dynamically
// exported to jdk.internal.vm.compiler
private static Set<String> EXCLUDED_MODULES = Set.of("jdk.internal.vm.compiler");
// exported to jdk.compiler.graal
private static Set<String> EXCLUDED_MODULES = Set.of("jdk.compiler.graal");

private boolean accept(String entry) {
int index = entry.indexOf('/', 1);
Expand Down

0 comments on commit f0b1057

Please sign in to comment.