Skip to content

Commit 200ca30

Browse files
committed
Always preserve frame pointer on AArch64 Windows and Darwin.
1 parent bbaceb2 commit 200ca30

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,30 @@ public static final long getTearDownFailureNanos() {
346346
public static final HostedOptionKey<Integer> MaxNodesInTrivialLeafMethod = new HostedOptionKey<>(40);
347347

348348
@Option(help = "Saves stack base pointer on the stack on method entry.")//
349-
public static final HostedOptionKey<Boolean> PreserveFramePointer = new HostedOptionKey<>(false);
349+
public static final HostedOptionKey<Boolean> PreserveFramePointer = new HostedOptionKey<Boolean>(false) {
350+
@Override
351+
public Boolean getValueOrDefault(UnmodifiableEconomicMap<OptionKey<?>, Object> values) {
352+
if (SubstrateUtil.getArchitectureName().equals("aarch64") && (OS.WINDOWS.isCurrent() || OS.DARWIN.isCurrent())) {
353+
/*
354+
* While running on AArch64 Windows or Darwin, PreserveFramePointer must be set. For
355+
* more information, see:
356+
*
357+
* @formatter:off
358+
* https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
359+
* https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions
360+
* @formatter:on
361+
*/
362+
return true;
363+
}
364+
return super.getValueOrDefault(values);
365+
}
366+
367+
@Override
368+
public Boolean getValue(OptionValues values) {
369+
assert checkDescriptorExists();
370+
return getValueOrDefault(values.getMap());
371+
}
372+
};
350373

351374
@Option(help = "Use callee saved registers to reduce spilling for low-frequency calls to stubs (if callee saved registers are supported by the architecture)")//
352375
public static final HostedOptionKey<Boolean> UseCalleeSavedRegisters = new HostedOptionKey<>(true);

0 commit comments

Comments
 (0)