summaryrefslogtreecommitdiffstats
path: root/runtime/stack.h
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-05-28 22:43:01 -0700
committerAndreas Gampe <agampe@google.com>2014-05-29 20:50:49 -0700
commitcf4035a4c41ccfcc3e89a0cee25f5218a11b0705 (patch)
tree323d9e98e6129c67e464a3e6857ee02593a2f2c2 /runtime/stack.h
parent29b53d3d715b1ec19349e8cbf7c5e4ff529bd5fe (diff)
downloadart-cf4035a4c41ccfcc3e89a0cee25f5218a11b0705.zip
art-cf4035a4c41ccfcc3e89a0cee25f5218a11b0705.tar.gz
art-cf4035a4c41ccfcc3e89a0cee25f5218a11b0705.tar.bz2
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<mirror::ArtMethod>* 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
Diffstat (limited to 'runtime/stack.h')
-rw-r--r--runtime/stack.h27
1 files changed, 9 insertions, 18 deletions
diff --git a/runtime/stack.h b/runtime/stack.h
index 2e32f51..e93fcbc 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -429,11 +429,11 @@ class PACKED(4) ManagedStack {
return link_;
}
- mirror::ArtMethod** GetTopQuickFrame() const {
+ StackReference<mirror::ArtMethod>* GetTopQuickFrame() const {
return top_quick_frame_;
}
- void SetTopQuickFrame(mirror::ArtMethod** top) {
+ void SetTopQuickFrame(StackReference<mirror::ArtMethod>* 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<mirror::ArtMethod>* 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<mirror::ArtMethod>* 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<mirror::ArtMethod>* GetCurrentQuickFrame() const {
return cur_quick_frame_;
}
@@ -688,7 +679,7 @@ class StackVisitor {
}
HandleScope* GetCurrentHandleScope() const {
- mirror::ArtMethod** sp = GetCurrentQuickFrame();
+ StackReference<mirror::ArtMethod>* sp = GetCurrentQuickFrame();
++sp; // Skip Method*; handle scope comes next;
return reinterpret_cast<HandleScope*>(sp);
}
@@ -706,7 +697,7 @@ class StackVisitor {
Thread* const thread_;
ShadowFrame* cur_shadow_frame_;
- mirror::ArtMethod** cur_quick_frame_;
+ StackReference<mirror::ArtMethod>* cur_quick_frame_;
uintptr_t cur_quick_frame_pc_;
// Lazily computed, number of frames in the stack.
size_t num_frames_;