OSDN Git Service

ART: Fix Mips64 JNI Calling Convention
authorVladimir Marko <vmarko@google.com>
Wed, 2 Sep 2015 20:23:32 +0000 (21:23 +0100)
committerVladimir Marko <vmarko@google.com>
Fri, 16 Oct 2015 13:23:53 +0000 (14:23 +0100)
The frame size did not include RA. RA is part of the core spill
mask, and implicitly spilled in BuildFrame. Count this.

Change-Id: Iab7565c2496ee99660c7faa39a07a2c87be53756

compiler/jni/quick/mips/calling_convention_mips.cc
compiler/jni/quick/mips64/calling_convention_mips64.cc

index ecf143d..2d31a98 100644 (file)
@@ -183,7 +183,7 @@ ManagedRegister MipsJniCallingConvention::ReturnScratchRegister() const {
 }
 
 size_t MipsJniCallingConvention::FrameSize() {
-  // Method*, LR and callee save area size, local reference segment state
+  // ArtMethod*, RA and callee save area size, local reference segment state
   size_t frame_data_size = kMipsPointerSize +
       (2 + CalleeSaveRegisters().size()) * kFramePointerSize;
   // References plus 2 words for HandleScope header
index 3a11bcf..807d740 100644 (file)
@@ -140,6 +140,7 @@ uint32_t Mips64JniCallingConvention::CoreSpillMask() const {
   // Compute spill mask to agree with callee saves initialized in the constructor
   uint32_t result = 0;
   result = 1 << S2 | 1 << S3 | 1 << S4 | 1 << S5 | 1 << S6 | 1 << S7 | 1 << GP | 1 << S8 | 1 << RA;
+  DCHECK_EQ(static_cast<size_t>(POPCOUNT(result)), callee_save_regs_.size() + 1);
   return result;
 }
 
@@ -148,9 +149,9 @@ ManagedRegister Mips64JniCallingConvention::ReturnScratchRegister() const {
 }
 
 size_t Mips64JniCallingConvention::FrameSize() {
-  // Mehtod* and callee save area size, local reference segment state
+  // ArtMethod*, RA and callee save area size, local reference segment state
   size_t frame_data_size = kFramePointerSize +
-      CalleeSaveRegisters().size() * kFramePointerSize + sizeof(uint32_t);
+      (CalleeSaveRegisters().size() + 1) * kFramePointerSize + sizeof(uint32_t);
   // References plus 2 words for HandleScope header
   size_t handle_scope_size = HandleScope::SizeOf(kFramePointerSize, ReferenceCount());
   // Plus return value spill area size