summaryrefslogtreecommitdiffstats
path: root/runtime/stack.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-04-22 11:03:52 +0000
committerNicolas Geoffray <ngeoffray@google.com>2014-05-02 10:44:52 +0100
commit42fcd9838a87abaf7a2ef86853a5287f86dbe391 (patch)
treed8ffcfcb9c1997c06c6ef93b551abaa900ebcf8e /runtime/stack.h
parent608168b380b741e2c7e1a2b0b568c0738986166b (diff)
downloadart-42fcd9838a87abaf7a2ef86853a5287f86dbe391.zip
art-42fcd9838a87abaf7a2ef86853a5287f86dbe391.tar.gz
art-42fcd9838a87abaf7a2ef86853a5287f86dbe391.tar.bz2
Revert "Revert "64bit changes to the stack walker for the Quick ABI.""
This reverts commit 8d5ead52a92675c258113d3dfa71bf8fceba5d9f. Change-Id: I6b4774a9bd180de33551975e106322ba1192e6ab
Diffstat (limited to 'runtime/stack.h')
-rw-r--r--runtime/stack.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/runtime/stack.h b/runtime/stack.h
index ab903d6..afc4f25 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -19,9 +19,10 @@
#include "dex_file.h"
#include "instrumentation.h"
+#include "arch/context.h"
#include "base/casts.h"
#include "base/macros.h"
-#include "arch/context.h"
+#include "instruction_set.h"
#include "mirror/object.h"
#include "mirror/object_reference.h"
#include "verify_object.h"
@@ -577,7 +578,7 @@ class StackVisitor {
uint32_t* GetVRegAddr(mirror::ArtMethod** cur_quick_frame, const DexFile::CodeItem* code_item,
uint32_t core_spills, uint32_t fp_spills, size_t frame_size,
uint16_t vreg) const {
- int offset = GetVRegOffset(code_item, core_spills, fp_spills, frame_size, vreg);
+ int offset = GetVRegOffset(code_item, core_spills, fp_spills, frame_size, vreg, kRuntimeISA);
DCHECK_EQ(cur_quick_frame, GetCurrentQuickFrame());
byte* vreg_addr = reinterpret_cast<byte*>(cur_quick_frame) + offset;
return reinterpret_cast<uint32_t*>(vreg_addr);
@@ -634,14 +635,15 @@ class StackVisitor {
*/
static int GetVRegOffset(const DexFile::CodeItem* code_item,
uint32_t core_spills, uint32_t fp_spills,
- size_t frame_size, int reg) {
+ size_t frame_size, int reg, InstructionSet isa) {
DCHECK_EQ(frame_size & (kStackAlignment - 1), 0U);
DCHECK_NE(reg, static_cast<int>(kVRegInvalid));
-
- int num_spills = __builtin_popcount(core_spills) + __builtin_popcount(fp_spills) + 1; // Filler.
+ int spill_size = __builtin_popcount(core_spills) * GetBytesPerGprSpillLocation(isa)
+ + __builtin_popcount(fp_spills) * GetBytesPerFprSpillLocation(isa)
+ + sizeof(uint32_t); // Filler.
int num_ins = code_item->ins_size_;
int num_regs = code_item->registers_size_ - num_ins;
- int locals_start = frame_size - ((num_spills + num_regs) * sizeof(uint32_t));
+ int locals_start = frame_size - spill_size - num_regs * sizeof(uint32_t);
if (reg == static_cast<int>(kVRegMethodPtrBaseReg)) {
// The current method pointer corresponds to special location on stack.
return 0;
@@ -654,19 +656,20 @@ class StackVisitor {
* temp is at offset -4 bytes from locals, the second is at -8 bytes from locals,
* and so on.
*/
- int relative_offset = (reg + std::abs(static_cast<int>(kVRegNonSpecialTempBaseReg)) - 1) * sizeof(uint32_t);
+ int relative_offset =
+ (reg + std::abs(static_cast<int>(kVRegNonSpecialTempBaseReg)) - 1) * sizeof(uint32_t);
return locals_start + relative_offset;
} else if (reg < num_regs) {
return locals_start + (reg * sizeof(uint32_t));
} else {
// Handle ins.
- return frame_size + ((reg - num_regs) * sizeof(uint32_t)) + sizeof(StackReference<mirror::ArtMethod>);
+ return frame_size + ((reg - num_regs) * sizeof(uint32_t)) + GetBytesPerGprSpillLocation(isa);
}
}
- static int GetOutVROffset(uint16_t out_num) {
+ static int GetOutVROffset(uint16_t out_num, InstructionSet isa) {
// According to stack model, the first out is above the Method ptr.
- return sizeof(StackReference<mirror::ArtMethod>) + (out_num * sizeof(uint32_t));
+ return GetBytesPerGprSpillLocation(isa) + (out_num * sizeof(uint32_t));
}
uintptr_t GetCurrentQuickFramePc() const {