Skip to content

Commit

Permalink
moved NATIVE_IMAGE_SETTING_KEY_PREFIX from LibGraalRuntime to LibGraa…
Browse files Browse the repository at this point in the history
…lFeature
  • Loading branch information
dougxc committed Jan 7, 2025
1 parent 8e4ad3d commit 2f4508a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package jdk.graal.compiler.hotspot;

import static jdk.vm.ci.common.InitTimer.timer;
import static jdk.graal.nativeimage.LibGraalRuntime.NATIVE_IMAGE_SETTING_KEY_PREFIX;
import static jdk.graal.compiler.libgraal.LibGraalFeature.NATIVE_IMAGE_SETTING_KEY_PREFIX;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,27 @@
import jdk.graal.nativeimage.LibGraalLoader;
import jdk.graal.nativeimage.hosted.GlobalData;
import jdk.vm.ci.hotspot.HotSpotModifiers;
import org.graalvm.nativeimage.hosted.RuntimeSystemProperties;

/**
* This feature builds the libgraal shared library (e.g., libjvmcicompiler.so on linux).
*/
@Platforms(Platform.HOSTED_ONLY.class)
public final class LibGraalFeature implements Feature {

/**
* Prefix to be used when {@linkplain RuntimeSystemProperties#register registering} properties
* describing the image configuration for libgraal. This is analogous to the configuration info
* displayed by {@code -XshowSettings}.
*
* For example:
*
* <pre>
* RuntimeSystemProperties.register(NATIVE_IMAGE_SETTING_KEY_PREFIX + "gc", "serial");
* </pre>
*/
public static final String NATIVE_IMAGE_SETTING_KEY_PREFIX = "org.graalvm.nativeimage.setting.";

private static LibGraalFeature singleton;

public LibGraalFeature() {
Expand All @@ -98,6 +112,7 @@ public LibGraalFeature() {
* null
*/
public static LibGraalFeature singleton() {
// Cannot use ImageSingletons here as it is not initialized early enough.
return singleton;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.graalvm.nativeimage.ImageSingletons;

import jdk.graal.nativeimage.impl.LibGraalRuntimeSupport;
import org.graalvm.nativeimage.hosted.RuntimeSystemProperties;

/**
* LibGraal specific extensions to {@link org.graalvm.nativeimage}.
Expand All @@ -39,19 +38,6 @@
*/
public final class LibGraalRuntime {

/**
* Prefix to be used when {@linkplain RuntimeSystemProperties#register registering} properties
* describing the image configuration for libgraal. This is analogous to the configuration info
* displayed by {@code -XshowSettings}.
*
* For example:
*
* <pre>
* RuntimeSystemProperties.register(NATIVE_IMAGE_SETTING_KEY_PREFIX + "gc", "serial");
* </pre>
*/
public static String NATIVE_IMAGE_SETTING_KEY_PREFIX = "org.graalvm.nativeimage.setting.";

/**
* Enqueues pending {@link Reference}s into their corresponding {@link ReferenceQueue}s and
* executes pending cleaners.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.List;
import java.util.Map;

import jdk.graal.nativeimage.LibGraalRuntime;
import jdk.graal.compiler.libgraal.LibGraalFeature;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.hosted.Feature;

Expand Down Expand Up @@ -131,7 +131,7 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
}

String gcName = Heap.getHeap().getGC().getName();
RuntimeSystemProperties.register(LibGraalRuntime.NATIVE_IMAGE_SETTING_KEY_PREFIX + "gc", gcName);
RuntimeSystemProperties.register(LibGraalFeature.NATIVE_IMAGE_SETTING_KEY_PREFIX + "gc", gcName);

// Needed for the barrier set.
access.registerAsUsed(Object[].class);
Expand Down

0 comments on commit 2f4508a

Please sign in to comment.