From d2debeff92f82f92706dccdbdc2dcb0c52b1b4a0 Mon Sep 17 00:00:00 2001 From: Christian Haeubl Date: Fri, 22 Dec 2023 10:02:38 +0100 Subject: [PATCH] Use 64k page size by default. --- .../com/oracle/svm/core/SubstrateOptions.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java index bbc73d7fe7eb..86d580b2a47d 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java @@ -477,7 +477,7 @@ public static void updateMaxJavaStackTraceDepth(EconomicMap, Object @Option(help = "Color build output ('always', 'never', or 'auto')", type = OptionType.User)// public static final HostedOptionKey Color = new HostedOptionKey<>("auto"); - public static final boolean hasColorsEnabled(OptionValues values) { + public static boolean hasColorsEnabled(OptionValues values) { if (Color.hasBeenSet(values)) { String value = Color.getValue(values); return switch (value) { @@ -871,6 +871,10 @@ protected void onValueUpdate(EconomicMap, Object> values, Integer o maxJavaStackTraceDepth = newValue; } }; + + /** Use {@link SubstrateOptions#getPageSize()} instead. */ + @Option(help = "Define PageSize of a machine that runs the image. The default = 0 (== same as host machine page size)")// + protected static final HostedOptionKey PageSize = new HostedOptionKey<>(0); } @Option(help = "Overwrites the available number of processors provided by the OS. Any value <= 0 means using the processor count from the OS.")// @@ -934,14 +938,15 @@ public ReportingSupport(Path reportingPath) { } } - @Option(help = "Define PageSize of a machine that runs the image. The default = 0 (== same as host machine page size)")// - protected static final HostedOptionKey PageSize = new HostedOptionKey<>(0); - @Fold public static int getPageSize() { - int value = PageSize.getValue(); + int value = ConcealedOptions.PageSize.getValue(); if (value == 0) { - return Unsafe.getUnsafe().pageSize(); + /* + * Assume at least a 64k page size if none was specified. This maximizes compatibility + * because images can be executed as long as run-time page size <= build-time page size. + */ + return Math.max(64 * 1024, Unsafe.getUnsafe().pageSize()); } assert value > 0 : value; return value;