diff options
author | 2019-09-24 14:36:50 -0700 | |
---|---|---|
committer | 2019-10-03 20:44:33 +0000 | |
commit | c84fc3a742b160ce51cbf01c2e5f971ccc0a2c6c (patch) | |
tree | 1380b353e0d3b5015c9d1ef29fd4c2534828f97b /runtime/common_dex_operations.h | |
parent | 8679fd5e938d7bed67d3ab67c55b7f4fb2cdd92a (diff) |
Walk internal ArtField/ArtMethod pointers
During structural class redefinition we sometimes need to update some
of the ArtMethod/ArtField pointers held by runtime frames. This adds
support for doing this through a StackReflectiveHandleScope similar to
the StackHandleScope used for holding object references. This also
updates various places where reflective-handles to ArtMethods and
ArtFields are needed, for example the JniIdManager, field Read/Write
operations and events, field resolution, and the old debugger.
Test: ./test.py --host
Bug: 134162467
Change-Id: I4ea73e85956a07735c6d7b125c5828a4233670bc
Diffstat (limited to 'runtime/common_dex_operations.h')
-rw-r--r-- | runtime/common_dex_operations.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/common_dex_operations.h b/runtime/common_dex_operations.h index 2f86fbcca6..882e3ce4c7 100644 --- a/runtime/common_dex_operations.h +++ b/runtime/common_dex_operations.h @@ -35,6 +35,8 @@ #include "mirror/class.h" #include "mirror/object.h" #include "obj_ptr-inl.h" +#include "reflective_handle.h" +#include "reflective_handle_scope.h" #include "runtime.h" #include "stack.h" #include "thread.h" @@ -100,8 +102,10 @@ static ALWAYS_INLINE bool DoFieldGetCommon(Thread* self, instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); if (UNLIKELY(instrumentation->HasFieldReadListeners())) { StackHandleScope<1> hs(self); + StackArtFieldHandleScope<1> rhs(self); // Wrap in handle wrapper in case the listener does thread suspension. HandleWrapperObjPtr<mirror::Object> h(hs.NewHandleWrapper(&obj)); + ReflectiveHandleWrapper<ArtField> fh(rhs.NewReflectiveHandleWrapper(&field)); ObjPtr<mirror::Object> this_object; if (!field->IsStatic()) { this_object = obj; @@ -159,8 +163,10 @@ ALWAYS_INLINE bool DoFieldPutCommon(Thread* self, instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation(); if (UNLIKELY(instrumentation->HasFieldWriteListeners())) { StackHandleScope<2> hs(self); + StackArtFieldHandleScope<1> rhs(self); // Save this and return value (if needed) in case the instrumentation causes a suspend. HandleWrapperObjPtr<mirror::Object> h(hs.NewHandleWrapper(&obj)); + ReflectiveHandleWrapper<ArtField> fh(rhs.NewReflectiveHandleWrapper(&field)); ObjPtr<mirror::Object> this_object = field->IsStatic() ? nullptr : obj; mirror::Object* fake_root = nullptr; HandleWrapper<mirror::Object> ret(hs.NewHandleWrapper<mirror::Object>( @@ -210,8 +216,10 @@ ALWAYS_INLINE bool DoFieldPutCommon(Thread* self, ObjPtr<mirror::Class> field_class; { StackHandleScope<2> hs(self); + StackArtFieldHandleScope<1> rhs(self); HandleWrapperObjPtr<mirror::Object> h_reg(hs.NewHandleWrapper(®)); HandleWrapperObjPtr<mirror::Object> h_obj(hs.NewHandleWrapper(&obj)); + ReflectiveHandleWrapper<ArtField> fh(rhs.NewReflectiveHandleWrapper(&field)); field_class = field->ResolveType(); } // ArtField::ResolveType() may fail as evidenced with a dexing bug (b/78788577). |