Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1870)

Unified Diff: runtime/vm/assembler_arm64.cc

Issue 2014413003: Bump the C stack pointer when building Dart frames to maintain the ARM64 ABI requirements without g… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: assembler test Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/assembler_arm64.h ('k') | runtime/vm/assembler_arm64_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_arm64.cc
diff --git a/runtime/vm/assembler_arm64.cc b/runtime/vm/assembler_arm64.cc
index eeb831dd8626554376e47563eba28c48b646229d..9832dae6d621bddc1cf8eb30672d3522c3a86fb8 100644
--- a/runtime/vm/assembler_arm64.cc
+++ b/runtime/vm/assembler_arm64.cc
@@ -1126,7 +1126,33 @@ void Assembler::CheckCodePointer() {
}
+void Assembler::SetupDartSP() {
+ mov(SP, CSP);
+}
+
+
+void Assembler::RestoreCSP() {
+ mov(CSP, SP);
+}
+
+
void Assembler::EnterFrame(intptr_t frame_size) {
+ // The ARM64 ABI requires at all times
+ // - stack limit < CSP <= stack base
+ // - CSP mod 16 = 0
+ // - we do not access stack memory below CSP
+ // Pratically, this means we need to keep the C stack pointer ahead of the
+ // Dart stack pointer and 16-byte aligned for signal handlers. If we knew the
+ // real stack limit, we could just set CSP to a value near it during
+ // SetupDartSP, but we do not know the real stack limit for the initial
+ // thread or threads created by the embedder.
+ // TODO(26472): It would be safer to use CSP as the Dart stack pointer, but
+ // this requires adjustments to stack handling to maintain the 16-byte
+ // alignment.
+ const intptr_t kMaxDartFrameSize = 4096;
+ sub(TMP, SP, Operand(kMaxDartFrameSize));
+ andi(CSP, TMP, Immediate(~15));
+
PushPair(LR, FP);
mov(FP, SP);
« no previous file with comments | « runtime/vm/assembler_arm64.h ('k') | runtime/vm/assembler_arm64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698