diff options
Diffstat (limited to 'runtime/native/java_lang_reflect_Field.cc')
| -rw-r--r-- | runtime/native/java_lang_reflect_Field.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc index ce622d90d8..0d5477275a 100644 --- a/runtime/native/java_lang_reflect_Field.cc +++ b/runtime/native/java_lang_reflect_Field.cc @@ -94,13 +94,14 @@ static bool CheckReceiver(const ScopedFastNativeObjectAccess& soa, jobject j_rcv SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { soa.Self()->AssertThreadSuspensionIsAllowable(); if (f->IsStatic()) { - SirtRef<mirror::Class> sirt_klass(soa.Self(), f->GetDeclaringClass()); - if (UNLIKELY(!Runtime::Current()->GetClassLinker()->EnsureInitialized(sirt_klass, true, true))) { + StackHandleScope<1> hs(soa.Self()); + Handle<mirror::Class> h_klass(hs.NewHandle(f->GetDeclaringClass())); + if (UNLIKELY(!Runtime::Current()->GetClassLinker()->EnsureInitialized(h_klass, true, true))) { DCHECK(soa.Self()->IsExceptionPending()); *class_or_rcvr = nullptr; return false; } - *class_or_rcvr = sirt_klass.get(); + *class_or_rcvr = h_klass.Get(); return true; } @@ -271,7 +272,8 @@ static void Field_set(JNIEnv* env, jobject javaField, jobject javaObj, jobject j const char* field_type_desciptor = fh.GetTypeDescriptor(); field_prim_type = Primitive::GetType(field_type_desciptor[0]); if (field_prim_type == Primitive::kPrimNot) { - SirtRef<mirror::Object> sirt_obj(soa.Self(), o); + StackHandleScope<1> hs(soa.Self()); + HandleWrapper<mirror::Object> h(hs.NewHandleWrapper(&o)); // May cause resolution. CHECK(!kMovingFields) << "Resolution may trigger thread suspension"; field_type = fh.GetType(true); |
