diff options
author | Vladimir Marko <vmarko@google.com> | 2014-05-14 16:51:16 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2014-05-20 14:48:56 +0100 |
commit | 4c1c510bea6f20f4d8b09e15547cd2967ad51c88 (patch) | |
tree | f3d15233294e46db0f43e83997e71a8bb990745e /runtime/stack.cc | |
parent | fdfe733d8fad10fb8370f468fbd5905416f338fa (diff) | |
download | art-4c1c510bea6f20f4d8b09e15547cd2967ad51c88.zip art-4c1c510bea6f20f4d8b09e15547cd2967ad51c88.tar.gz art-4c1c510bea6f20f4d8b09e15547cd2967ad51c88.tar.bz2 |
Improve stack walk performance.
Move a few functions from art_method.cc to art_method-inl.h
and introduce new overloads that take already known partial
results; do not rely on the compiler to magically merge the
identical but non-trivial paths. The partial results are
DCHECKed to be correct.
Change-Id: I342c3001bbff08a2bbbb9a7b62ae67188ad8cffc
Diffstat (limited to 'runtime/stack.cc')
-rw-r--r-- | runtime/stack.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/runtime/stack.cc b/runtime/stack.cc index e0189e9..be1fba4 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -139,9 +139,11 @@ uint32_t StackVisitor::GetVReg(mirror::ArtMethod* m, uint16_t vreg, VRegKind kin if (cur_quick_frame_ != NULL) { DCHECK(context_ != NULL); // You can't reliably read registers without a context. DCHECK(m == GetMethod()); - const VmapTable vmap_table(m->GetVmapTable()); + const void* code_pointer = m->GetQuickOatCodePointer(); + DCHECK(code_pointer != nullptr); + const VmapTable vmap_table(m->GetVmapTable(code_pointer)); + QuickMethodFrameInfo frame_info = m->GetQuickFrameInfo(code_pointer); uint32_t vmap_offset; - QuickMethodFrameInfo frame_info = m->GetQuickFrameInfo(); // TODO: IsInContext stops before spotting floating point registers. if (vmap_table.IsInContext(vreg, kind, &vmap_offset)) { bool is_float = (kind == kFloatVReg) || (kind == kDoubleLoVReg) || (kind == kDoubleHiVReg); @@ -163,9 +165,11 @@ void StackVisitor::SetVReg(mirror::ArtMethod* m, uint16_t vreg, uint32_t new_val if (cur_quick_frame_ != NULL) { DCHECK(context_ != NULL); // You can't reliably write registers without a context. DCHECK(m == GetMethod()); - const VmapTable vmap_table(m->GetVmapTable()); + const void* code_pointer = m->GetQuickOatCodePointer(); + DCHECK(code_pointer != nullptr); + const VmapTable vmap_table(m->GetVmapTable(code_pointer)); + QuickMethodFrameInfo frame_info = m->GetQuickFrameInfo(code_pointer); uint32_t vmap_offset; - QuickMethodFrameInfo frame_info = m->GetQuickFrameInfo(); // TODO: IsInContext stops before spotting floating point registers. if (vmap_table.IsInContext(vreg, kind, &vmap_offset)) { bool is_float = (kind == kFloatVReg) || (kind == kDoubleLoVReg) || (kind == kDoubleHiVReg); @@ -316,7 +320,7 @@ void StackVisitor::WalkStack(bool include_transitions) { } size_t frame_size = method->GetFrameSizeInBytes(); // Compute PC for next stack frame from return PC. - size_t return_pc_offset = method->GetReturnPcOffsetInBytes(); + size_t return_pc_offset = method->GetReturnPcOffsetInBytes(frame_size); byte* return_pc_addr = reinterpret_cast<byte*>(cur_quick_frame_) + return_pc_offset; uintptr_t return_pc = *reinterpret_cast<uintptr_t*>(return_pc_addr); if (UNLIKELY(exit_stubs_installed)) { |