AArch64: Implicit StackOverflow/NPE/Suspend checks.
This implements implicit stack overflow checks and null pointer exceptions
for AArch64. Suspend checks are implemented but not switched on yet.
Change-Id: I2eb076f2c0c9d94793d5a898fea49cf409b4eb66
Signed-off-by: Stuart Monteith <stuart.monteith@arm.com>
diff --git a/compiler/dex/quick/arm64/call_arm64.cc b/compiler/dex/quick/arm64/call_arm64.cc
index 6fa8a4a..f00555a 100644
--- a/compiler/dex/quick/arm64/call_arm64.cc
+++ b/compiler/dex/quick/arm64/call_arm64.cc
@@ -322,6 +322,11 @@
LockTemp(rs_xIP0);
LockTemp(rs_xIP1);
+ /* TUNING:
+ * Use AllocTemp() and reuse LR if possible to give us the freedom on adjusting the number
+ * of temp registers.
+ */
+
/*
* We can safely skip the stack overflow check if we're
* a leaf *and* our frame size < fudge factor.
@@ -339,16 +344,15 @@
// Load stack limit
LoadWordDisp(rs_xSELF, Thread::StackEndOffset<8>().Int32Value(), rs_xIP1);
} else {
- // TODO(Arm64) Implement implicit checks.
// Implicit stack overflow check.
// Generate a load from [sp, #-framesize]. If this is in the stack
// redzone we will get a segmentation fault.
- // Load32Disp(rs_wSP, -Thread::kStackOverflowReservedBytes, rs_wzr);
- // MarkPossibleStackOverflowException();
- //
+
// TODO: If the frame size is small enough, is it possible to make this a pre-indexed load,
// so that we can avoid the following "sub sp" when spilling?
- LOG(FATAL) << "Implicit stack overflow checks not implemented.";
+ OpRegRegImm(kOpSub, rs_x8, rs_sp, GetStackOverflowReservedBytes(kArm64));
+ LoadWordDisp(rs_x8, 0, rs_x8);
+ MarkPossibleStackOverflowException();
}
}