summaryrefslogtreecommitdiffstats
path: root/runtime/entrypoints
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2014-11-25 16:30:53 +0100
committerSebastien Hertz <shertz@google.com>2014-12-09 12:58:25 +0100
commita836bc9760419af4a515f96c66100a39e865f3b9 (patch)
tree3719f9a8ee66ca734fdb62fa77dae0b60e45ae3c /runtime/entrypoints
parentc4925d4c02dc8f8d51cb2653b5e7a99f6c9fd7d7 (diff)
downloadart-a836bc9760419af4a515f96c66100a39e865f3b9.zip
art-a836bc9760419af4a515f96c66100a39e865f3b9.tar.gz
art-a836bc9760419af4a515f96c66100a39e865f3b9.tar.bz2
Support proxy method in StackVisitor::GetThisObject
Adds function artQuickGetProxyThisObject which returns the 'this' object of the proxy method using the QuickArgumentVisitor. Since proxy methods have the same layout than the kRefsAndArgs runtime method and 'this' is the 1st method argument, it is located in the first GPR. Bug: 17965861 Change-Id: Ic6ef6c83b9a549c25f9929d5e00ffe1d3a9a36f0
Diffstat (limited to 'runtime/entrypoints')
-rw-r--r--runtime/entrypoints/quick/quick_trampoline_entrypoints.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index cb81629..9db1646 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -208,6 +208,22 @@ class QuickArgumentVisitor {
#endif
public:
+ // Special handling for proxy methods. Proxy methods are instance methods so the
+ // 'this' object is the 1st argument. They also have the same frame layout as the
+ // kRefAndArgs runtime method. Since 'this' is a reference, it is located in the
+ // 1st GPR.
+ static mirror::Object* GetProxyThisObject(StackReference<mirror::ArtMethod>* sp)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ CHECK(sp->AsMirrorPtr()->IsProxyMethod());
+ CHECK_EQ(kQuickCalleeSaveFrame_RefAndArgs_FrameSize, sp->AsMirrorPtr()->GetFrameSizeInBytes());
+ CHECK_GT(kNumQuickGprArgs, 0u);
+ constexpr uint32_t kThisGprIndex = 0u; // 'this' is in the 1st GPR.
+ size_t this_arg_offset = kQuickCalleeSaveFrame_RefAndArgs_Gpr1Offset +
+ GprIndexToGprOffset(kThisGprIndex);
+ uint8_t* this_arg_address = reinterpret_cast<uint8_t*>(sp) + this_arg_offset;
+ return reinterpret_cast<StackReference<mirror::Object>*>(this_arg_address)->AsMirrorPtr();
+ }
+
static mirror::ArtMethod* GetCallingMethod(StackReference<mirror::ArtMethod>* sp)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(sp->AsMirrorPtr()->IsCalleeSaveMethod());
@@ -435,6 +451,13 @@ class QuickArgumentVisitor {
bool is_split_long_or_double_;
};
+// Returns the 'this' object of a proxy method. This function is only used by StackVisitor. It
+// allows to use the QuickArgumentVisitor constants without moving all the code in its own module.
+extern "C" mirror::Object* artQuickGetProxyThisObject(StackReference<mirror::ArtMethod>* sp)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ return QuickArgumentVisitor::GetProxyThisObject(sp);
+}
+
// Visits arguments on the stack placing them into the shadow frame.
class BuildQuickShadowFrameVisitor FINAL : public QuickArgumentVisitor {
public: