summaryrefslogtreecommitdiffstats
path: root/runtime/stack.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-03-12 15:05:13 +0000
committerNicolas Geoffray <ngeoffray@google.com>2015-03-13 10:26:47 +0000
commit15b9d5274399736ac09705f0507df24fac4f00c1 (patch)
tree04564a9265f5dccefdd32ea7bdd25adc0267f80b /runtime/stack.cc
parent8bc616d09f93523f4bc982cc60c377b00161522a (diff)
downloadart-15b9d5274399736ac09705f0507df24fac4f00c1.zip
art-15b9d5274399736ac09705f0507df24fac4f00c1.tar.gz
art-15b9d5274399736ac09705f0507df24fac4f00c1.tar.bz2
API change in StackVisitor::GetVReg*.
- Remove GetVReg() and SetVReg() that were expecting to always succeed. - Change Quick-only methods to take a FromQuickCode suffix. - Change deopt to use dead values when GetVReg does not succeed: the optimizing compiler will not have a location for uninitialized Dex registers and potentially dead registers. Change-Id: Ida05773a97aff8aa69e0caf42ea961f80f854b77
Diffstat (limited to 'runtime/stack.cc')
-rw-r--r--runtime/stack.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/runtime/stack.cc b/runtime/stack.cc
index b8ca21e..47b85ad 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -137,7 +137,11 @@ mirror::Object* StackVisitor::GetThisObject() const {
return nullptr;
} else {
uint16_t reg = code_item->registers_size_ - code_item->ins_size_;
- return reinterpret_cast<mirror::Object*>(GetVReg(m, reg, kReferenceVReg));
+ uint32_t value = 0;
+ bool success = GetVReg(m, reg, kReferenceVReg, &value);
+ // We currently always guarantee the `this` object is live throughout the method.
+ CHECK(success) << "Failed to read the this object in " << PrettyMethod(m);
+ return reinterpret_cast<mirror::Object*>(value);
}
}
}
@@ -181,8 +185,8 @@ bool StackVisitor::GetVRegFromQuickCode(mirror::ArtMethod* m, uint16_t vreg, VRe
const DexFile::CodeItem* code_item = m->GetCodeItem();
DCHECK(code_item != nullptr) << PrettyMethod(m); // Can't be NULL or how would we compile
// its instructions?
- *val = *GetVRegAddr(cur_quick_frame_, code_item, frame_info.CoreSpillMask(),
- frame_info.FpSpillMask(), frame_info.FrameSizeInBytes(), vreg);
+ *val = *GetVRegAddrFromQuickCode(cur_quick_frame_, code_item, frame_info.CoreSpillMask(),
+ frame_info.FpSpillMask(), frame_info.FrameSizeInBytes(), vreg);
return true;
}
}
@@ -291,8 +295,9 @@ bool StackVisitor::GetVRegPairFromQuickCode(mirror::ArtMethod* m, uint16_t vreg,
const DexFile::CodeItem* code_item = m->GetCodeItem();
DCHECK(code_item != nullptr) << PrettyMethod(m); // Can't be NULL or how would we compile
// its instructions?
- uint32_t* addr = GetVRegAddr(cur_quick_frame_, code_item, frame_info.CoreSpillMask(),
- frame_info.FpSpillMask(), frame_info.FrameSizeInBytes(), vreg);
+ uint32_t* addr = GetVRegAddrFromQuickCode(
+ cur_quick_frame_, code_item, frame_info.CoreSpillMask(),
+ frame_info.FpSpillMask(), frame_info.FrameSizeInBytes(), vreg);
*val = *reinterpret_cast<uint64_t*>(addr);
return true;
}
@@ -365,8 +370,9 @@ bool StackVisitor::SetVRegFromQuickCode(mirror::ArtMethod* m, uint16_t vreg, uin
const DexFile::CodeItem* code_item = m->GetCodeItem();
DCHECK(code_item != nullptr) << PrettyMethod(m); // Can't be NULL or how would we compile
// its instructions?
- uint32_t* addr = GetVRegAddr(cur_quick_frame_, code_item, frame_info.CoreSpillMask(),
- frame_info.FpSpillMask(), frame_info.FrameSizeInBytes(), vreg);
+ uint32_t* addr = GetVRegAddrFromQuickCode(
+ cur_quick_frame_, code_item, frame_info.CoreSpillMask(),
+ frame_info.FpSpillMask(), frame_info.FrameSizeInBytes(), vreg);
*addr = new_value;
return true;
}
@@ -494,8 +500,9 @@ bool StackVisitor::SetVRegPairFromQuickCode(mirror::ArtMethod* m, uint16_t vreg,
const DexFile::CodeItem* code_item = m->GetCodeItem();
DCHECK(code_item != nullptr) << PrettyMethod(m); // Can't be NULL or how would we compile
// its instructions?
- uint32_t* addr = GetVRegAddr(cur_quick_frame_, code_item, frame_info.CoreSpillMask(),
- frame_info.FpSpillMask(), frame_info.FrameSizeInBytes(), vreg);
+ uint32_t* addr = GetVRegAddrFromQuickCode(
+ cur_quick_frame_, code_item, frame_info.CoreSpillMask(),
+ frame_info.FpSpillMask(), frame_info.FrameSizeInBytes(), vreg);
*reinterpret_cast<uint64_t*>(addr) = new_value;
return true;
}