summaryrefslogtreecommitdiff
path: root/runtime/stack.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/stack.cc')
-rw-r--r--runtime/stack.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/runtime/stack.cc b/runtime/stack.cc
index 5ad1f7c9c5..bbea48b441 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -154,13 +154,13 @@ mirror::Object* StackVisitor::GetThisObject() const {
return cur_shadow_frame_->GetVRegReference(0);
}
} else {
- const DexFile::CodeItem* code_item = m->GetCodeItem();
- if (code_item == nullptr) {
+ CodeItemDataAccessor accessor(m);
+ if (!accessor.HasCodeItem()) {
UNIMPLEMENTED(ERROR) << "Failed to determine this object of abstract or proxy method: "
<< ArtMethod::PrettyMethod(m);
return nullptr;
} else {
- uint16_t reg = code_item->registers_size_ - code_item->ins_size_;
+ uint16_t reg = accessor.RegistersSize() - accessor.InsSize();
uint32_t value = 0;
bool success = GetVReg(m, reg, kReferenceVReg, &value);
// We currently always guarantee the `this` object is live throughout the method.
@@ -223,11 +223,11 @@ bool StackVisitor::GetVReg(ArtMethod* m, uint16_t vreg, VRegKind kind, uint32_t*
bool StackVisitor::GetVRegFromOptimizedCode(ArtMethod* m, uint16_t vreg, VRegKind kind,
uint32_t* val) const {
DCHECK_EQ(m, GetMethod());
- const DexFile::CodeItem* code_item = m->GetCodeItem();
- DCHECK(code_item != nullptr) << m->PrettyMethod(); // Can't be null or how would we compile
- // its instructions?
- uint16_t number_of_dex_registers = code_item->registers_size_;
- DCHECK_LT(vreg, code_item->registers_size_);
+ // Can't be null or how would we compile its instructions?
+ DCHECK(m->GetCodeItem() != nullptr) << m->PrettyMethod();
+ CodeItemDataAccessor accessor(m);
+ uint16_t number_of_dex_registers = accessor.RegistersSize();
+ DCHECK_LT(vreg, number_of_dex_registers);
const OatQuickMethodHeader* method_header = GetCurrentOatQuickMethodHeader();
CodeInfo code_info = method_header->GetOptimizedCodeInfo();
CodeInfoEncoding encoding = code_info.ExtractEncoding();
@@ -395,8 +395,8 @@ bool StackVisitor::SetVReg(ArtMethod* m,
uint16_t vreg,
uint32_t new_value,
VRegKind kind) {
- const DexFile::CodeItem* code_item = m->GetCodeItem();
- if (code_item == nullptr) {
+ CodeItemDataAccessor accessor(m);
+ if (!accessor.HasCodeItem()) {
return false;
}
ShadowFrame* shadow_frame = GetCurrentShadowFrame();
@@ -404,7 +404,7 @@ bool StackVisitor::SetVReg(ArtMethod* m,
// This is a compiled frame: we must prepare and update a shadow frame that will
// be executed by the interpreter after deoptimization of the stack.
const size_t frame_id = GetFrameId();
- const uint16_t num_regs = code_item->registers_size_;
+ const uint16_t num_regs = accessor.RegistersSize();
shadow_frame = thread_->FindOrCreateDebuggerShadowFrame(frame_id, num_regs, m, GetDexPc());
CHECK(shadow_frame != nullptr);
// Remember the vreg has been set for debugging and must not be overwritten by the
@@ -432,15 +432,15 @@ bool StackVisitor::SetVRegPair(ArtMethod* m,
LOG(FATAL) << "Expected long or double: kind_lo=" << kind_lo << ", kind_hi=" << kind_hi;
UNREACHABLE();
}
- const DexFile::CodeItem* code_item = m->GetCodeItem();
- if (code_item == nullptr) {
+ CodeItemDataAccessor accessor(m);
+ if (!accessor.HasCodeItem()) {
return false;
}
ShadowFrame* shadow_frame = GetCurrentShadowFrame();
if (shadow_frame == nullptr) {
// This is a compiled frame: we must prepare for deoptimization (see SetVRegFromDebugger).
const size_t frame_id = GetFrameId();
- const uint16_t num_regs = code_item->registers_size_;
+ const uint16_t num_regs = accessor.RegistersSize();
shadow_frame = thread_->FindOrCreateDebuggerShadowFrame(frame_id, num_regs, m, GetDexPc());
CHECK(shadow_frame != nullptr);
// Remember the vreg pair has been set for debugging and must not be overwritten by the