Skip to content

Commit

Permalink
Merge pull request #27783 from zakkak/reduce-H-options
Browse files Browse the repository at this point in the history
Reduce `native-image` `-H:` options
  • Loading branch information
zakkak authored Sep 8, 2022
2 parents 9819069 + 3551b45 commit 68bea9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
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

0 comments on commit 68bea9c

Please sign in to comment.