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

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: 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..918524c338efe994abcf57278a4dde050c7cfab2 100644
--- a/runtime/vm/assembler_arm64.cc
+++ b/runtime/vm/assembler_arm64.cc
@@ -1126,7 +1126,30 @@ 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.
+ const intptr_t kMaxDartFrameSize = 256;
rmacnak 2016/05/27 04:44:51 Not sure where in the compiler to check this isn't
Vyacheslav Egorov (Google) 2016/05/27 15:34:52 It's not that easy. FlowGraphCompiler::StackSize
+ 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