diff options
Diffstat (limited to 'runtime/managed_stack.h')
| -rw-r--r-- | runtime/managed_stack.h | 80 |
1 files changed, 7 insertions, 73 deletions
diff --git a/runtime/managed_stack.h b/runtime/managed_stack.h index 07078ecb13..4f1984d55a 100644 --- a/runtime/managed_stack.h +++ b/runtime/managed_stack.h @@ -24,7 +24,6 @@ #include "base/logging.h" #include "base/macros.h" #include "base/mutex.h" -#include "base/bit_utils.h" namespace art { @@ -43,9 +42,7 @@ template <typename T> class StackReference; class PACKED(4) ManagedStack { public: ManagedStack() - : tagged_top_quick_frame_(TaggedTopQuickFrame::CreateNotTagged(nullptr)), - link_(nullptr), - top_shadow_frame_(nullptr) {} + : top_quick_frame_(nullptr), link_(nullptr), top_shadow_frame_(nullptr) {} void PushManagedStackFragment(ManagedStack* fragment) { // Copy this top fragment into given fragment. @@ -66,36 +63,17 @@ class PACKED(4) ManagedStack { return link_; } - ArtMethod** GetTopQuickFrameKnownNotTagged() const { - return tagged_top_quick_frame_.GetSpKnownNotTagged(); - } - ArtMethod** GetTopQuickFrame() const { - return tagged_top_quick_frame_.GetSp(); - } - - bool GetTopQuickFrameTag() const { - return tagged_top_quick_frame_.GetTag(); - } - - bool HasTopQuickFrame() const { - return tagged_top_quick_frame_.GetTaggedSp() != 0u; + return top_quick_frame_; } void SetTopQuickFrame(ArtMethod** top) { DCHECK(top_shadow_frame_ == nullptr); - DCHECK_ALIGNED(top, 4u); - tagged_top_quick_frame_ = TaggedTopQuickFrame::CreateNotTagged(top); + top_quick_frame_ = top; } - void SetTopQuickFrameTagged(ArtMethod** top) { - DCHECK(top_shadow_frame_ == nullptr); - DCHECK_ALIGNED(top, 4u); - tagged_top_quick_frame_ = TaggedTopQuickFrame::CreateTagged(top); - } - - static size_t TaggedTopQuickFrameOffset() { - return OFFSETOF_MEMBER(ManagedStack, tagged_top_quick_frame_); + static size_t TopQuickFrameOffset() { + return OFFSETOF_MEMBER(ManagedStack, top_quick_frame_); } ALWAYS_INLINE ShadowFrame* PushShadowFrame(ShadowFrame* new_top_frame); @@ -105,12 +83,8 @@ class PACKED(4) ManagedStack { return top_shadow_frame_; } - bool HasTopShadowFrame() const { - return GetTopShadowFrame() != nullptr; - } - void SetTopShadowFrame(ShadowFrame* top) { - DCHECK_EQ(tagged_top_quick_frame_.GetTaggedSp(), 0u); + DCHECK(top_quick_frame_ == nullptr); top_shadow_frame_ = top; } @@ -123,47 +97,7 @@ class PACKED(4) ManagedStack { bool ShadowFramesContain(StackReference<mirror::Object>* shadow_frame_entry) const; private: - // Encodes the top quick frame (which must be at least 4-byte aligned) - // and a flag that marks the GenericJNI trampoline. - class TaggedTopQuickFrame { - public: - static TaggedTopQuickFrame CreateNotTagged(ArtMethod** sp) { - DCHECK_ALIGNED(sp, 4u); - return TaggedTopQuickFrame(reinterpret_cast<uintptr_t>(sp)); - } - - static TaggedTopQuickFrame CreateTagged(ArtMethod** sp) { - DCHECK_ALIGNED(sp, 4u); - return TaggedTopQuickFrame(reinterpret_cast<uintptr_t>(sp) | 1u); - } - - // Get SP known to be not tagged and non-null. - ArtMethod** GetSpKnownNotTagged() const { - DCHECK(!GetTag()); - DCHECK_NE(tagged_sp_, 0u); - return reinterpret_cast<ArtMethod**>(tagged_sp_); - } - - ArtMethod** GetSp() const { - return reinterpret_cast<ArtMethod**>(tagged_sp_ & ~static_cast<uintptr_t>(1u)); - } - - bool GetTag() const { - return (tagged_sp_ & 1u) != 0u; - } - - uintptr_t GetTaggedSp() const { - return tagged_sp_; - } - - private: - explicit TaggedTopQuickFrame(uintptr_t tagged_sp) : tagged_sp_(tagged_sp) { } - - uintptr_t tagged_sp_; - }; - static_assert(sizeof(TaggedTopQuickFrame) == sizeof(uintptr_t), "TaggedTopQuickFrame size check"); - - TaggedTopQuickFrame tagged_top_quick_frame_; + ArtMethod** top_quick_frame_; ManagedStack* link_; ShadowFrame* top_shadow_frame_; }; |