From cf4035a4c41ccfcc3e89a0cee25f5218a11b0705 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Wed, 28 May 2014 22:43:01 -0700 Subject: ART: Use StackReference in Quick Stack Frame The method reference at the bottom of a quick frame is a stack reference and not a native pointer. This is important for 64b architectures, where the notions do not coincide. Change key methods to have StackReference* parameter instead of mirror::ArtMethod**. Make changes to invoke stubs for 64b archs, change the frame setup for JNI code (both generic JNI and compilers), tie up loose ends. Tested on x86 and x86-64 with host tests. On x86-64, tests succeed with jni compiler activated. x86-64 QCG was not tested. Tested on ARM32 with device tests. Fix ARM64 not saving x19 (used for wSUSPEND) on upcalls. Tested on ARM64 in interpreter-only + generic-jni mode. Fix ARM64 JNI Compiler to work with the CL. Tested on ARM64 in interpreter-only + jni compiler. Change-Id: I77931a0cbadd04d163b3eb8d6f6a6f8740578f13 --- runtime/stack.h | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'runtime/stack.h') diff --git a/runtime/stack.h b/runtime/stack.h index 2e32f51343..e93fcbcc21 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -429,11 +429,11 @@ class PACKED(4) ManagedStack { return link_; } - mirror::ArtMethod** GetTopQuickFrame() const { + StackReference* GetTopQuickFrame() const { return top_quick_frame_; } - void SetTopQuickFrame(mirror::ArtMethod** top) { + void SetTopQuickFrame(StackReference* top) { DCHECK(top_shadow_frame_ == NULL); top_quick_frame_ = top; } @@ -491,7 +491,7 @@ class PACKED(4) ManagedStack { private: ManagedStack* link_; ShadowFrame* top_shadow_frame_; - mirror::ArtMethod** top_quick_frame_; + StackReference* top_quick_frame_; uintptr_t top_quick_frame_pc_; }; @@ -512,17 +512,7 @@ class StackVisitor { if (cur_shadow_frame_ != nullptr) { return cur_shadow_frame_->GetMethod(); } else if (cur_quick_frame_ != nullptr) { - return *cur_quick_frame_; - } else { - return nullptr; - } - } - - mirror::ArtMethod** GetMethodAddress() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - if (cur_shadow_frame_ != nullptr) { - return cur_shadow_frame_->GetMethodAddress(); - } else if (cur_quick_frame_ != nullptr) { - return cur_quick_frame_; + return cur_quick_frame_->AsMirrorPtr(); } else { return nullptr; } @@ -578,7 +568,8 @@ class StackVisitor { void SetGPR(uint32_t reg, uintptr_t value); // This is a fast-path for getting/setting values in a quick frame. - uint32_t* GetVRegAddr(mirror::ArtMethod** cur_quick_frame, const DexFile::CodeItem* code_item, + uint32_t* GetVRegAddr(StackReference* cur_quick_frame, + const DexFile::CodeItem* code_item, uint32_t core_spills, uint32_t fp_spills, size_t frame_size, uint16_t vreg) const { int offset = GetVRegOffset(code_item, core_spills, fp_spills, frame_size, vreg, kRuntimeISA); @@ -679,7 +670,7 @@ class StackVisitor { return cur_quick_frame_pc_; } - mirror::ArtMethod** GetCurrentQuickFrame() const { + StackReference* GetCurrentQuickFrame() const { return cur_quick_frame_; } @@ -688,7 +679,7 @@ class StackVisitor { } HandleScope* GetCurrentHandleScope() const { - mirror::ArtMethod** sp = GetCurrentQuickFrame(); + StackReference* sp = GetCurrentQuickFrame(); ++sp; // Skip Method*; handle scope comes next; return reinterpret_cast(sp); } @@ -706,7 +697,7 @@ class StackVisitor { Thread* const thread_; ShadowFrame* cur_shadow_frame_; - mirror::ArtMethod** cur_quick_frame_; + StackReference* cur_quick_frame_; uintptr_t cur_quick_frame_pc_; // Lazily computed, number of frames in the stack. size_t num_frames_; -- cgit v1.2.3-59-g8ed1b