diff options
author | Vladimir Marko <vmarko@google.com> | 2014-05-02 14:40:15 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2014-05-13 11:43:22 +0100 |
commit | 7624d25dad2d1ba25969ae704fccf68649103ae5 (patch) | |
tree | de72194b76a4e23e0b15ec4085447ae7e4425815 /runtime/mirror/art_method-inl.h | |
parent | e1910f1d802dff79bba5ef61e1c4fd0b95f6e5b0 (diff) | |
download | art-7624d25dad2d1ba25969ae704fccf68649103ae5.zip art-7624d25dad2d1ba25969ae704fccf68649103ae5.tar.gz art-7624d25dad2d1ba25969ae704fccf68649103ae5.tar.bz2 |
Move quick frame info to OatQuickMethodHeader.
Rename OatMethodHeader to OatQuickMethodHeader, move frame
info from OatMethodOffsets to OatQuickMethodHeader. Retrieve
the info from other places for non-quick methods (portable
compiled bytecode or jni stub, generic jni, runtime,
abstract and proxy).
This change has a libcore/ companion CL
"Remove ArtMethod's quick fields for frame size and spills."
https://android-review.googlesource.com/94164
Bug: 11767815
Change-Id: I0e31a7875d76732e1ec479c86b9b5ca01203507f
Diffstat (limited to 'runtime/mirror/art_method-inl.h')
-rw-r--r-- | runtime/mirror/art_method-inl.h | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/runtime/mirror/art_method-inl.h b/runtime/mirror/art_method-inl.h index fb9a09a..91753df 100644 --- a/runtime/mirror/art_method-inl.h +++ b/runtime/mirror/art_method-inl.h @@ -23,7 +23,8 @@ #include "entrypoints/entrypoint_utils.h" #include "object_array.h" #include "oat.h" -#include "runtime.h" +#include "quick/quick_method_frame_info.h" +#include "runtime-inl.h" namespace art { namespace mirror { @@ -81,7 +82,7 @@ inline uint32_t ArtMethod::GetCodeSize() { if (code == nullptr) { return 0u; } - return reinterpret_cast<const OatMethodHeader*>(code)[-1].code_size_; + return reinterpret_cast<const OatQuickMethodHeader*>(code)[-1].code_size_; } inline bool ArtMethod::CheckIncompatibleClassChange(InvokeType type) { @@ -201,6 +202,40 @@ inline void ArtMethod::SetNativeMethod(const void* native_method) { OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_jni_), native_method); } +inline QuickMethodFrameInfo ArtMethod::GetQuickFrameInfo() { + if (UNLIKELY(IsPortableCompiled())) { + // Portable compiled dex bytecode or jni stub. + return QuickMethodFrameInfo(kStackAlignment, 0u, 0u); + } + Runtime* runtime = Runtime::Current(); + if (UNLIKELY(IsAbstract()) || UNLIKELY(IsProxyMethod())) { + return runtime->GetCalleeSaveMethodFrameInfo(Runtime::kRefsAndArgs); + } + if (UNLIKELY(IsRuntimeMethod())) { + return runtime->GetRuntimeMethodFrameInfo(this); + } + + const void* entry_point = runtime->GetInstrumentation()->GetQuickCodeFor(this); + // On failure, instead of nullptr we get the quick-generic-jni-trampoline for native method + // indicating the generic JNI, or the quick-to-interpreter-bridge (but not the trampoline) + // for non-native methods. And we really shouldn't see a failure for non-native methods here. + DCHECK(entry_point != GetQuickToInterpreterBridgeTrampoline(runtime->GetClassLinker())); + CHECK(entry_point != GetQuickToInterpreterBridge()); + + if (UNLIKELY(entry_point == GetQuickGenericJniTrampoline())) { + // Generic JNI frame. + DCHECK(IsNative()); + uint32_t sirt_refs = MethodHelper(this).GetNumberOfReferenceArgsWithoutReceiver() + 1; + size_t sirt_size = StackIndirectReferenceTable::GetAlignedSirtSize(sirt_refs); + QuickMethodFrameInfo callee_info = runtime->GetCalleeSaveMethodFrameInfo(Runtime::kRefsAndArgs); + return QuickMethodFrameInfo(callee_info.FrameSizeInBytes() + sirt_size, + callee_info.CoreSpillMask(), callee_info.FpSpillMask()); + } + + const void* code_pointer = EntryPointToCodePointer(entry_point); + return reinterpret_cast<const OatQuickMethodHeader*>(code_pointer)[-1].frame_info_; +} + } // namespace mirror } // namespace art |