Skip to content
Closed
2 changes: 0 additions & 2 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1810,8 +1810,6 @@ bool Arguments::check_vm_args_consistency() {
return false;
}
}
PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true",
AddProperty, UnwriteableProperty, InternalProperty);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/arguments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ class Arguments : AllStatic {
static char* _java_command;
// number of unique modules specified in the --add-modules option
static unsigned int _addmods_count;
// number of unique modules specified in the --add-modules option
#if INCLUDE_JVMCI
// was jdk.internal.vm.ci module specified in the --add-modules option?
static bool _jvmci_module_added;
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ private JVMCIServiceLocator(Void ignore) {
*/
protected JVMCIServiceLocator() {
this(checkPermission());
Services.checkJVMCIEnabled();
Services.openJVMCITo(getClass().getModule());
}

Expand All @@ -85,7 +84,6 @@ protected JVMCIServiceLocator() {
* {@link JVMCIPermission}
*/
public static <S> List<S> getProviders(Class<S> service) {
Services.checkJVMCIEnabled();
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,6 @@ private Services() {
*/
private static volatile Map<String, String> savedProperties;

static final boolean JVMCI_ENABLED = Boolean.parseBoolean(VM.getSavedProperties().get("jdk.internal.vm.ci.enabled"));

/**
* Checks that JVMCI is enabled in the VM and throws an error if it isn't.
*/
static void checkJVMCIEnabled() {
if (!JVMCI_ENABLED) {
throw new Error("The EnableJVMCI VM option must be true (i.e., -XX:+EnableJVMCI) to use JVMCI");
}
}

/**
* Gets an unmodifiable copy of the system properties as of VM startup.
*
Expand All @@ -84,7 +73,6 @@ static void checkJVMCIEnabled() {
* on the command line are ignored.
*/
public static Map<String, String> getSavedProperties() {
checkJVMCIEnabled();
if (savedProperties == null) {
synchronized (Services.class) {
if (savedProperties == null) {
Expand Down Expand Up @@ -113,7 +101,6 @@ public static String getSavedProperty(String name) {
* Causes the JVMCI subsystem to be initialized if it isn't already initialized.
*/
public static void initializeJVMCI() {
checkJVMCIEnabled();
try {
Class.forName("jdk.vm.ci.runtime.JVMCI");
} catch (ClassNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public void jniEnomemTest() throws Exception {
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
"-XX:+UnlockExperimentalVMOptions",
"-XX:+EnableJVMCI",
"--add-modules=jdk.internal.vm.ci",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stared at this for a while to understand why passing this option was required. It's a bit confusing that explicitly passing -XX:+EnableJVMCI has different effects based on the value of UseJVMCINativeLibrary. I think that if EnableJVMCI is passed on the command line then it should add the module even if libgraal is in use. So something like:
if ((!UseJVMCINativeLibrary || FLAG_IS_CMDLINE(EnableJVMCI) && ClassLoader::is_module_observable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not aware FLAG_IS_CMDLINE can be used for altering the semantics of a flag but there seems to be at least one precedent for it with UseCompactObjectHeaders. This is quite nice as now nothing needs to change for Truffle users in terms of enabling the Truffle optimized runtime (cc @chumer).

"-XX:-UseJVMCICompiler",
"-XX:+UseJVMCINativeLibrary",
"-Dtest.jvmci.forceEnomemOnLibjvmciInit=true",
Expand Down