Fix old stack frame size check
The test underestimates the frame size for JNI frames, as not enough
overhead is accounted for.
Cherry-picked from commit 291088a2983ff954c137dddcc2ba7cb1c4cc95d2
Change-Id: I6ad96bc9b8eaecd6c888b91b3ffcfc4aeddc5eb8
diff --git a/runtime/stack.cc b/runtime/stack.cc
index abaea6f..15b288e 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -280,10 +280,12 @@
// Frame sanity.
size_t frame_size = method->GetFrameSizeInBytes();
CHECK_NE(frame_size, 0u);
- // A rough guess at an upper size we expect to see for a frame. The 256 is
- // a dex register limit. The 16 incorporates callee save spills and
- // outgoing argument set up.
- const size_t kMaxExpectedFrameSize = 256 * sizeof(word) + 16;
+ // A rough guess at an upper size we expect to see for a frame.
+ // 256 registers
+ // 2 words Sirt overhead
+ // 3+3 register spills
+ // TODO: this seems architecture specific for the case of JNI frames.
+ const size_t kMaxExpectedFrameSize = (256 + 2 + 3 + 3) * sizeof(word);
CHECK_LE(frame_size, kMaxExpectedFrameSize);
size_t return_pc_offset = method->GetReturnPcOffsetInBytes();
CHECK_LT(return_pc_offset, frame_size);