diff options
author | 2015-10-16 17:13:34 +0100 | |
---|---|---|
committer | 2015-10-20 11:52:11 +0100 | |
commit | 524e7ea8cd17bad17bd9f3e0ccbb19ad0d4d9c02 (patch) | |
tree | ad07cc96f633bdae839ff2f1553d84b9c864a930 /runtime/entrypoints/entrypoint_utils.cc | |
parent | b697c447eb61c2e14315166ec3b0d16375ae403c (diff) |
Remove ArtCode.
- Instead use OatQuickMethodHeader.
- Various cleanups now that we don't have all those
ArtMethod -> ArtCode -> OatQuickMethodHeader indirections.
As a consequence of this cleanup, exception handling got a bit
faster.
ParserCombinators benchmark (exception intensive) on x64: (lower is better)
Before:
ParserCombinators(RunTime): 1062500.0 us.
After:
ParserCombinators(RunTime): 833000.0 us.
Change-Id: Idac917b6f1b0dc254ad68fb3781cd61bccadb0f3
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils.cc')
-rw-r--r-- | runtime/entrypoints/entrypoint_utils.cc | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc index 17e6aac357..e57569e140 100644 --- a/runtime/entrypoints/entrypoint_utils.cc +++ b/runtime/entrypoints/entrypoint_utils.cc @@ -16,7 +16,6 @@ #include "entrypoints/entrypoint_utils.h" -#include "art_code.h" #include "art_field-inl.h" #include "art_method-inl.h" #include "base/mutex.h" @@ -31,6 +30,7 @@ #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "nth_caller_visitor.h" +#include "oat_quick_method_header.h" #include "reflection.h" #include "scoped_thread_state_change.h" #include "ScopedLocalRef.h" @@ -359,33 +359,31 @@ ArtMethod* GetCalleeSaveMethodCaller(ArtMethod** sp, const size_t callee_frame_size = GetCalleeSaveFrameSize(kRuntimeISA, type); auto** caller_sp = reinterpret_cast<ArtMethod**>( reinterpret_cast<uintptr_t>(sp) + callee_frame_size); - ArtCode current_code = GetCallingCodeFrom(caller_sp); + const size_t callee_return_pc_offset = GetCalleeSaveReturnPcOffset(kRuntimeISA, type); + uintptr_t caller_pc = *reinterpret_cast<uintptr_t*>( + (reinterpret_cast<uint8_t*>(sp) + callee_return_pc_offset)); ArtMethod* outer_method = *caller_sp; ArtMethod* caller = outer_method; - if ((outer_method != nullptr) && current_code.IsOptimized(sizeof(void*))) { - const size_t callee_return_pc_offset = GetCalleeSaveReturnPcOffset(kRuntimeISA, type); - uintptr_t caller_pc = *reinterpret_cast<uintptr_t*>( - (reinterpret_cast<uint8_t*>(sp) + callee_return_pc_offset)); - if (LIKELY(caller_pc != reinterpret_cast<uintptr_t>(GetQuickInstrumentationExitPc()))) { - uintptr_t native_pc_offset = current_code.NativeQuickPcOffset(caller_pc); - CodeInfo code_info = current_code.GetOptimizedCodeInfo(); - StackMapEncoding encoding = code_info.ExtractEncoding(); - StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset, encoding); - DCHECK(stack_map.IsValid()); - if (stack_map.HasInlineInfo(encoding)) { - InlineInfo inline_info = code_info.GetInlineInfoOf(stack_map, encoding); - caller = GetResolvedMethod(outer_method, inline_info, inline_info.GetDepth() - 1); - } - } else { - // We're instrumenting, just use the StackVisitor which knows how to - // handle instrumented frames. - NthCallerVisitor visitor(Thread::Current(), 1, true); - visitor.WalkStack(); - caller = visitor.caller; - if (kIsDebugBuild) { - // Avoid doing the check below. - do_caller_check = false; + if (outer_method != nullptr) { + const OatQuickMethodHeader* current_code = outer_method->GetOatQuickMethodHeader(caller_pc); + if (current_code->IsOptimized()) { + if (LIKELY(caller_pc != reinterpret_cast<uintptr_t>(GetQuickInstrumentationExitPc()))) { + uintptr_t native_pc_offset = current_code->NativeQuickPcOffset(caller_pc); + CodeInfo code_info = current_code->GetOptimizedCodeInfo(); + StackMapEncoding encoding = code_info.ExtractEncoding(); + StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset, encoding); + DCHECK(stack_map.IsValid()); + if (stack_map.HasInlineInfo(encoding)) { + InlineInfo inline_info = code_info.GetInlineInfoOf(stack_map, encoding); + caller = GetResolvedMethod(outer_method, inline_info, inline_info.GetDepth() - 1); + } + } else { + // We're instrumenting, just use the StackVisitor which knows how to + // handle instrumented frames. + NthCallerVisitor visitor(Thread::Current(), 1, true); + visitor.WalkStack(); + caller = visitor.caller; } } } |