Skip to content

Commit e1d99ae

Browse files
committed
[GR-59669] Remove System.exit call from TruffleFromLibGraalEntryPoints.
PullRequest: graal/19262
2 parents ac7949b + f598808 commit e1d99ae

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/LibGraalTruffleCompilationSupport.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@
5757
*/
5858
public final class LibGraalTruffleCompilationSupport implements TruffleCompilationSupport {
5959

60+
public LibGraalTruffleCompilationSupport() {
61+
/*
62+
* Eagerly verify TruffleFromLibGraalEntryPoints before creating the HotSpotTruffleRuntime.
63+
* This ensures stack traces are captured without to/from native transitions and are
64+
* generated by an application thread rather than a Truffle compiler thread.
65+
*/
66+
assert TruffleFromLibGraalEntryPoints.checkHotSpotCalls();
67+
}
68+
6069
private volatile String cachedCompilerConfigurationName;
6170

6271
public static void initializeIsolate(long isolateThreadId) {

truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/TruffleFromLibGraalEntryPoints.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
import static java.lang.System.lineSeparator;
8686
import static java.util.stream.Collectors.joining;
8787

88-
import java.io.PrintStream;
8988
import java.lang.reflect.Method;
9089
import java.lang.reflect.Modifier;
9190
import java.net.URI;
@@ -130,10 +129,6 @@
130129
*/
131130
final class TruffleFromLibGraalEntryPoints {
132131

133-
static {
134-
assert checkHotSpotCalls();
135-
}
136-
137132
@TruffleFromLibGraal(Id.OnIsolateShutdown)
138133
static void onIsolateShutdown(long isolateId) {
139134
LibGraalIsolate.unregister(isolateId);
@@ -491,7 +486,7 @@ static Object getHostMethodInfo(Object truffleRuntime, long methodHandle) {
491486
* </ol>
492487
* </p>
493488
*/
494-
private static boolean checkHotSpotCalls() {
489+
static boolean checkHotSpotCalls() {
495490
Set<Id> unimplemented = EnumSet.allOf(Id.class);
496491
Map<String, Id> entryPointMethodNames = unimplemented.stream().collect(Collectors.toMap(Id::getMethodName, (id) -> id));
497492
Map<Id, List<Method>> idToMethod = new LinkedHashMap<>();
@@ -549,13 +544,8 @@ private static String missingImpl(Id id) {
549544
private static void check(Id id, boolean condition, String format, Object... args) {
550545
if (!condition) {
551546
String msg = format(format, args);
552-
PrintStream err = System.err;
553-
if (id != null) {
554-
err.printf("ERROR: %s.%s: %s%n", TruffleFromLibGraalEntryPoints.class.getName(), id, msg);
555-
} else {
556-
err.printf("ERROR: %s: %s%n", TruffleFromLibGraalEntryPoints.class.getName(), msg);
557-
}
558-
System.exit(99);
547+
String target = id != null ? format("%s.%s", TruffleFromLibGraalEntryPoints.class.getName(), id) : TruffleFromLibGraalEntryPoints.class.getName();
548+
throw new AssertionError(format("Incompatible Truffle runtime change: %s: %s", target, msg));
559549
}
560550
}
561551
}

0 commit comments

Comments
 (0)