Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce native-image -H: options #27783

Merged
merged 2 commits into from
Sep 8, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public class NativeConfig {

/**
* If {@code -H:+InlineBeforeAnalysis} flag will be added to the native-image run
*
* @deprecated inlineBeforeAnalysis is always enabled starting from GraalVM 21.3.
*/
@Deprecated
@ConfigItem(defaultValue = "true")
public boolean inlineBeforeAnalysis;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,11 +741,11 @@ public NativeImageInvokerInfo build() {
}

if (nativeConfig.enableFallbackImages) {
nativeImageArgs.add("-H:FallbackThreshold=5");
nativeImageArgs.add("--auto-fallback");
} else {
//Default: be strict as those fallback images aren't very useful
//and tend to cover up real problems.
nativeImageArgs.add("-H:FallbackThreshold=0");
nativeImageArgs.add("--no-fallback");
}

// 22.1 removes --allow-incomplete-classpath and makes it the default. --link-at-build-time is now
Expand All @@ -757,7 +757,7 @@ public NativeImageInvokerInfo build() {
}

if (nativeConfig.reportErrorsAtRuntime) {
nativeImageArgs.add("-H:+ReportUnsupportedElementsAtRuntime");
nativeImageArgs.add("--report-unsupported-elements-at-runtime");
}
if (nativeConfig.reportExceptionStackTraces) {
nativeImageArgs.add("-H:+ReportExceptionStackTraces");
Expand Down Expand Up @@ -796,14 +796,9 @@ public NativeImageInvokerInfo build() {
nativeImageArgs.add("-H:-AddAllCharsets");
}
if (!protocols.isEmpty()) {
nativeImageArgs.add("-H:EnableURLProtocols=" + String.join(",", protocols));
nativeImageArgs.add("--enable-url-protocols=" + String.join(",", protocols));
}
if (inlineBeforeAnalysis) {
if (graalVMVersion.isOlderThan(GraalVM.Version.VERSION_21_3)) {
// Enabled by default in GraalVM >= 21.3
nativeImageArgs.add("-H:+InlineBeforeAnalysis");
}
} else {
if (!inlineBeforeAnalysis) {
nativeImageArgs.add("-H:-InlineBeforeAnalysis");
}
if (!noPIE.isEmpty()) {
Expand Down