diff options
| -rw-r--r-- | runtime/mirror/art_method.h | 7 | ||||
| -rw-r--r-- | runtime/stack.cc | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/runtime/mirror/art_method.h b/runtime/mirror/art_method.h index 7066cf6626..2e26d9c893 100644 --- a/runtime/mirror/art_method.h +++ b/runtime/mirror/art_method.h @@ -25,6 +25,7 @@ #include "object_callbacks.h" #include "quick/quick_method_frame_info.h" #include "read_barrier_option.h" +#include "stack.h" namespace art { @@ -407,8 +408,10 @@ class MANAGED ArtMethod FINAL : public Object { return frame_size_in_bytes - kPointerSize; } - size_t GetHandleScopeOffsetInBytes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - return kPointerSize; + FrameOffset GetHandleScopeOffsetInBytes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + constexpr size_t handle_scope_offset = sizeof(StackReference<mirror::ArtMethod>); + DCHECK_LT(handle_scope_offset, GetFrameSizeInBytes()); + return FrameOffset(handle_scope_offset); } void RegisterNative(Thread* self, const void* native_method, bool is_fast) diff --git a/runtime/stack.cc b/runtime/stack.cc index f0b6c21eec..7dd4f081d1 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -122,7 +122,7 @@ mirror::Object* StackVisitor::GetThisObject() const { } else if (m->IsNative()) { if (cur_quick_frame_ != NULL) { HandleScope* hs = reinterpret_cast<HandleScope*>( - reinterpret_cast<char*>(cur_quick_frame_) + m->GetHandleScopeOffsetInBytes()); + reinterpret_cast<char*>(cur_quick_frame_) + m->GetHandleScopeOffsetInBytes().SizeValue()); return hs->GetReference(0); } else { return cur_shadow_frame_->GetVRegReference(0); |