|
48 | 48 |
|
49 | 49 | import com.oracle.svm.core.c.libc.LibCBase; |
50 | 50 | import com.oracle.svm.core.c.libc.MuslLibC; |
| 51 | +import com.oracle.svm.core.config.ConfigurationValues; |
51 | 52 | import com.oracle.svm.core.heap.ReferenceHandler; |
52 | 53 | import com.oracle.svm.core.option.APIOption; |
53 | 54 | import com.oracle.svm.core.option.APIOptionGroup; |
|
76 | 77 | import jdk.graal.compiler.options.OptionValues; |
77 | 78 | import jdk.graal.compiler.phases.common.DeadCodeEliminationPhase; |
78 | 79 | import jdk.internal.misc.Unsafe; |
| 80 | +import jdk.vm.ci.amd64.AMD64; |
79 | 81 |
|
80 | 82 | public class SubstrateOptions { |
81 | 83 |
|
@@ -679,9 +681,6 @@ public static void updateMaxJavaStackTraceDepth(EconomicMap<OptionKey<?>, Object |
679 | 681 | "After the library path, a comma-separated list of options specific to the library can be used.", type = OptionType.User)// |
680 | 682 | public static final RuntimeOptionKey<String> JVMTIAgentPath = new RuntimeOptionKey<>(null); |
681 | 683 |
|
682 | | - @Option(help = "Alignment of AOT and JIT compiled code in bytes.")// |
683 | | - public static final HostedOptionKey<Integer> CodeAlignment = new HostedOptionKey<>(16); |
684 | | - |
685 | 684 | public static final String BUILD_ARTIFACTS_FILE_NAME = "build-artifacts.json"; |
686 | 685 | @Option(help = "Create a " + BUILD_ARTIFACTS_FILE_NAME + " file in the build directory. The output conforms to the JSON schema located at: " + |
687 | 686 | "docs/reference-manual/native-image/assets/build-artifacts-schema-v0.9.0.json", type = OptionType.User)// |
@@ -972,7 +971,15 @@ public static boolean useLIRBackend() { |
972 | 971 | */ |
973 | 972 | @Fold |
974 | 973 | public static int codeAlignment() { |
975 | | - return CodeAlignment.getValue(); |
| 974 | + int value = ConcealedOptions.CodeAlignment.getValue(); |
| 975 | + if (value > 0) { |
| 976 | + return value; |
| 977 | + } |
| 978 | + |
| 979 | + if (ConfigurationValues.getTarget().arch instanceof AMD64 && optimizationLevel() != OptimizationLevel.SIZE) { |
| 980 | + return 32; |
| 981 | + } |
| 982 | + return 16; |
976 | 983 | } |
977 | 984 |
|
978 | 985 | @Option(help = "Determines if VM internal threads (e.g., a dedicated VM operation or reference handling thread) are allowed in this image.", type = OptionType.Expert) // |
@@ -1121,11 +1128,13 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Integer o |
1121 | 1128 | @Option(help = "Physical memory size (in bytes). By default, the value is queried from the OS/container during VM startup.", type = OptionType.Expert)// |
1122 | 1129 | public static final RuntimeOptionKey<Long> MaxRAM = new RuntimeOptionKey<>(0L, IsolateCreationOnly); |
1123 | 1130 |
|
1124 | | - /** |
1125 | | - * Use {@link SubstrateOptions#getAllocatePrefetchStyle()} instead. |
1126 | | - */ |
| 1131 | + /** Use {@link SubstrateOptions#getAllocatePrefetchStyle()} instead. */ |
1127 | 1132 | @Option(help = "Generated code style for prefetch instructions: for 0 or less no prefetch instructions are generated and for 1 or more prefetch instructions are introduced after each allocation.")// |
1128 | 1133 | public static final HostedOptionKey<Integer> AllocatePrefetchStyle = new HostedOptionKey<>(null); |
| 1134 | + |
| 1135 | + /** Use {@link SubstrateOptions#codeAlignment()} instead. */ |
| 1136 | + @Option(help = "Alignment of AOT and JIT compiled code in bytes. The default of 0 automatically selects a suitable value.")// |
| 1137 | + public static final HostedOptionKey<Integer> CodeAlignment = new HostedOptionKey<>(0); |
1129 | 1138 | } |
1130 | 1139 |
|
1131 | 1140 | @Fold |
|
0 commit comments