Skip to content

Commit e416945

Browse files
committed
Enable replay launcher by default.
1 parent 001f6a5 commit e416945

File tree

6 files changed

+6
-47
lines changed

6 files changed

+6
-47
lines changed

compiler/docs/ReplayCompilation.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,12 @@ Any `-ea`, `-esa`, and `-X` arguments from the command line are passed to the JV
6565

6666
Jargraal can replay both jargraal and libgraal compilations. Libgraal can replay only libgraal compilations.
6767

68-
It is necessary to explicitly enable the replay launcher entry point when building libgraal using the VM argument
69-
`-Ddebug.jdk.graal.enableReplayLauncher=true`.
70-
71-
```shell
72-
EXTRA_IMAGE_BUILDER_ARGUMENTS=-Ddebug.jdk.graal.enableReplayLauncher=true mx --env libgraal build
73-
```
74-
75-
When the `--libgraal` argument is passed to `mx replaycomp`, the previously built libgraal native library is loaded, and
76-
the native launcher is invoked instead of the Java launcher. With the below command, all replay related processing
77-
(including JSON parsing) is performed by libgraal code.
68+
To replay on libgraal, build libgraal first. Then, pass the `--libgraal` argument to `mx replaycomp`, which invokes the
69+
native launcher. With the below commands, all replay related processing (including JSON parsing) is performed by
70+
libgraal code.
7871

7972
```shell
73+
mx -p ../vm --env libgraal build
8074
mx replaycomp --libgraal ./replay-files
8175
```
8276

compiler/src/jdk.graal.compiler.libgraal/src/jdk/graal/compiler/libgraal/LibGraalEntryPoints.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import java.io.PrintStream;
3232
import java.util.Arrays;
3333
import java.util.Map;
34-
import java.util.function.BooleanSupplier;
3534

3635
import org.graalvm.collections.EconomicMap;
3736
import org.graalvm.jniutils.JNI.JNIEnv;
@@ -54,7 +53,6 @@
5453
import jdk.graal.compiler.hotspot.HotSpotGraalServices;
5554
import jdk.graal.compiler.hotspot.ProfileReplaySupport;
5655
import jdk.graal.compiler.hotspot.replaycomp.ReplayCompilationRunner;
57-
import jdk.graal.compiler.hotspot.replaycomp.ReplayCompilationSupport;
5856
import jdk.graal.compiler.options.OptionDescriptors;
5957
import jdk.graal.compiler.options.OptionKey;
6058
import jdk.graal.compiler.options.OptionValues;
@@ -301,7 +299,7 @@ private static long hashConstantOopFields(JNIEnv jniEnv,
301299
* @return the exit status of the replay compilation launcher
302300
*/
303301
@SuppressWarnings({"unused", "try"})
304-
@CEntryPoint(name = "Java_jdk_graal_compiler_hotspot_replaycomp_test_ReplayCompilationLauncher_runInLibgraal", include = LibGraalReplayLauncherEnabled.class)
302+
@CEntryPoint(name = "Java_jdk_graal_compiler_hotspot_replaycomp_test_ReplayCompilationLauncher_runInLibgraal", include = LibGraalFeature.IsEnabled.class)
305303
private static int replayCompilation(JNIEnv jniEnv,
306304
PointerBase jclass,
307305
@IsolateThreadContext long isolateThread,
@@ -322,14 +320,4 @@ private static int replayCompilation(JNIEnv jniEnv,
322320
LibGraalSupportImpl.doReferenceHandling();
323321
}
324322
}
325-
326-
/**
327-
* Controls whether the replay launcher entry point should be included in libgraal.
328-
*/
329-
private static final class LibGraalReplayLauncherEnabled implements BooleanSupplier {
330-
@Override
331-
public boolean getAsBoolean() {
332-
return new LibGraalFeature.IsEnabled().getAsBoolean() && ReplayCompilationSupport.ENABLE_REPLAY_LAUNCHER;
333-
}
334-
}
335323
}

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/replaycomp/test/ReplayCompilationLauncher.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
import jdk.graal.compiler.api.test.ModuleSupport;
3333
import jdk.graal.compiler.hotspot.replaycomp.ReplayCompilationRunner;
34-
import jdk.graal.compiler.hotspot.replaycomp.ReplayCompilationSupport;
3534
import jdk.graal.compiler.hotspot.test.LibGraalCompilationDriver;
3635

3736
/**
@@ -55,13 +54,7 @@ public class ReplayCompilationLauncher {
5554

5655
public static void main(String[] args) {
5756
if (LibGraal.isAvailable()) {
58-
try {
59-
LibGraal.registerNativeMethods(ReplayCompilationLauncher.class);
60-
} catch (Error error) {
61-
System.err.printf("The replay launcher entry point could not be linked. Build libgraal with -D%s=true as an extra image builder option to enable the launcher.%n",
62-
ReplayCompilationSupport.ENABLE_REPLAY_LAUNCHER_PROP);
63-
throw error;
64-
}
57+
LibGraal.registerNativeMethods(ReplayCompilationLauncher.class);
6558
StringBuilder argString = new StringBuilder();
6659
for (String arg : args) {
6760
if (!argString.isEmpty()) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/ReplayCompilationProxies.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.graalvm.collections.EconomicMap;
3636
import org.graalvm.collections.Equivalence;
3737

38-
import jdk.graal.compiler.core.common.LibGraalSupport;
3938
import jdk.graal.compiler.debug.DebugCloseable;
4039
import jdk.graal.compiler.debug.DebugContext;
4140
import jdk.graal.compiler.debug.GlobalMetrics;
@@ -77,7 +76,6 @@
7776
*
7877
* @see ReplayCompilationSupport
7978
*/
80-
@LibGraalSupport.HostedOnly(unlessTrue = ReplayCompilationSupport.ENABLE_REPLAY_LAUNCHER_PROP)
8179
public class ReplayCompilationProxies implements CompilationProxies {
8280
public static class Options {
8381
// @formatter:off

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/ReplayCompilationRunner.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,12 @@
6666
import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
6767
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
6868

69-
//JaCoCo Exclude
70-
7169
/**
7270
* The entry point for running replay compilations in jargraal and libgraal.
7371
*
7472
* @see ReplayCompilationSupport
7573
* @see CompilerInterfaceDeclarations
7674
*/
77-
@LibGraalSupport.HostedOnly(unlessTrue = ReplayCompilationSupport.ENABLE_REPLAY_LAUNCHER_PROP)
7875
public class ReplayCompilationRunner {
7976
/**
8077
* The exit status of a replay compilation run.

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/ReplayCompilationSupport.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import jdk.graal.compiler.options.OptionValues;
4848
import jdk.graal.compiler.printer.CanonicalStringGraphPrinter;
4949
import jdk.graal.compiler.replacements.SnippetTemplate;
50-
import jdk.graal.compiler.serviceprovider.GraalServices;
5150
import jdk.graal.compiler.util.json.JsonWriter;
5251
import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
5352
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
@@ -104,16 +103,6 @@
104103
* replay is close to the code compiled during recording.
105104
*/
106105
public final class ReplayCompilationSupport {
107-
/**
108-
* Libgraal build-time system property name for enabling the replay compilation launcher.
109-
*/
110-
public static final String ENABLE_REPLAY_LAUNCHER_PROP = "debug.jdk.graal.enableReplayLauncher";
111-
112-
/**
113-
* Whether the replay compilation launcher is enabled in libgraal.
114-
*/
115-
public static final boolean ENABLE_REPLAY_LAUNCHER = Boolean.parseBoolean(GraalServices.getSavedProperty(ENABLE_REPLAY_LAUNCHER_PROP));
116-
117106
/**
118107
* Checks whether the given method's compilation should be recorded according to the given
119108
* options.

0 commit comments

Comments
 (0)