Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ At runtime, premain runtime options are set along with main class' arguments in
* (GR-49517) Add support for emitting Windows x64 unwind info. This enables stack walking in native tooling such as debuggers and profilers.
* (GR-57384) Preserve the origin of a resource included in a native image. The information is included in the report produced by -H:+GenerateEmbeddedResourcesFile.
* (GR-58000) Support for `GetStringUTFLengthAsLong` added in JNI_VERSION_24 ([JDK-8328877](https://bugs.openjdk.org/browse/JDK-8328877))
* (GR-58383) The length of the printed stack trace when using `-XX:MissingRegistrationReportingMode=Warn` can now be set with `-XX:MissingRegistrationWarnContextLines=` and its default length is now 8.

## GraalVM for JDK 23 (Internal Version 24.1.0)
* (GR-51520) The old class initialization strategy, which was deprecated in GraalVM for JDK 22, is removed. The option `StrictImageHeap` no longer has any effect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public static SubstrateOptions.ReportingMode missingRegistrationReportingMode()
return SubstrateOptions.MissingRegistrationReportingMode.getValue();
}

private static final int CONTEXT_LINES = 4;

private static final AtomicReference<Set<String>> seenOutputs = new AtomicReference<>(null);

public static void report(Error exception, StackTraceElement responsibleClass) {
Expand Down Expand Up @@ -88,14 +86,15 @@ public static void report(Error exception, StackTraceElement responsibleClass) {
printLine(sb, stackTraceElement);
printed++;
}
if (printed >= CONTEXT_LINES) {
if (printed >= SubstrateOptions.MissingRegistrationWarnContextLines.getValue()) {
break;
}
}
if (seenOutputs.get() == null && seenOutputs.compareAndSet(null, ConcurrentHashMap.newKeySet())) {
/* First output, we print an explanation message */
System.out.println("Note: this run will print partial stack traces of the locations where a " + exception.getClass().toString() + " would be thrown " +
"when the -H:+ThrowMissingRegistrationErrors option is set. The trace stops at the first entry of JDK code and provides " + CONTEXT_LINES + " lines of context.");
"when the -H:+ThrowMissingRegistrationErrors option is set. The trace stops at the first entry of JDK code and provides " +
SubstrateOptions.MissingRegistrationWarnContextLines.getValue() + " lines of context.");
}
String output = sb.toString();
if (seenOutputs.get().add(output)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,9 @@ public enum ReportingMode {
public static final RuntimeOptionKey<ReportingMode> MissingRegistrationReportingMode = new RuntimeOptionKey<>(
ReportingMode.Throw);

@Option(help = "Number of context lines printed for each missing registration error in Warn mode")//
public static final RuntimeOptionKey<Integer> MissingRegistrationWarnContextLines = new RuntimeOptionKey<>(8);

@Option(help = "Instead of warning, throw IOExceptions for link-at-build-time resources at build time")//
public static final HostedOptionKey<Boolean> ThrowLinkAtBuildTimeIOExceptions = new HostedOptionKey<>(false);

Expand Down