diff options
author | 2016-09-27 18:43:30 -0700 | |
---|---|---|
committer | 2016-09-29 17:31:09 -0700 | |
commit | 0795f23920ee9aabf28e45c63cd592dcccf00216 (patch) | |
tree | ff3f880c5e84f3316532b47d0e9a7729ade848ac /runtime/reflection.cc | |
parent | d1224dce59eb0019507e41da5e10f12dda66bee4 (diff) |
Clean up ScopedThreadStateChange to use ObjPtr
Also fixed inclusion of -inl.h files in .h files by adding
scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h
Changed AddLocalReference / Decode to use ObjPtr.
Changed libartbenchmark to be debug to avoid linkage errors.
Bug: 31113334
Test: test-art-host
Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483
Diffstat (limited to 'runtime/reflection.cc')
-rw-r--r-- | runtime/reflection.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/runtime/reflection.cc b/runtime/reflection.cc index 7c0f2b5115..b663b4c8ed 100644 --- a/runtime/reflection.cc +++ b/runtime/reflection.cc @@ -28,7 +28,7 @@ #include "mirror/executable.h" #include "mirror/object_array-inl.h" #include "nth_caller_visitor.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "stack_reference.h" #include "well_known_classes.h" @@ -115,7 +115,7 @@ class ArgArray { AppendFloat(va_arg(ap, jdouble)); break; case 'L': - Append(soa.Decode<mirror::Object*>(va_arg(ap, jobject))); + Append(soa.Decode<mirror::Object>(va_arg(ap, jobject))); break; case 'D': AppendDouble(va_arg(ap, jdouble)); @@ -157,7 +157,7 @@ class ArgArray { Append(args[args_offset].i); break; case 'L': - Append(soa.Decode<mirror::Object*>(args[args_offset].l)); + Append(soa.Decode<mirror::Object>(args[args_offset].l)); break; case 'D': case 'J': @@ -459,7 +459,7 @@ JValue InvokeWithVarArgs(const ScopedObjectAccessAlreadyRunnable& soa, jobject o // Replace calls to String.<init> with equivalent StringFactory call. method = WellKnownClasses::StringInitToStringFactory(method); } - ObjPtr<mirror::Object> receiver = method->IsStatic() ? nullptr : soa.Decode<mirror::Object*>(obj); + ObjPtr<mirror::Object> receiver = method->IsStatic() ? nullptr : soa.Decode<mirror::Object>(obj); uint32_t shorty_len = 0; const char* shorty = method->GetInterfaceMethodIfProxy(kRuntimePointerSize)->GetShorty(&shorty_len); @@ -490,7 +490,7 @@ JValue InvokeWithJValues(const ScopedObjectAccessAlreadyRunnable& soa, jobject o // Replace calls to String.<init> with equivalent StringFactory call. method = WellKnownClasses::StringInitToStringFactory(method); } - ObjPtr<mirror::Object> receiver = method->IsStatic() ? nullptr : soa.Decode<mirror::Object*>(obj); + ObjPtr<mirror::Object> receiver = method->IsStatic() ? nullptr : soa.Decode<mirror::Object>(obj); uint32_t shorty_len = 0; const char* shorty = method->GetInterfaceMethodIfProxy(kRuntimePointerSize)->GetShorty(&shorty_len); @@ -515,7 +515,7 @@ JValue InvokeVirtualOrInterfaceWithJValues(const ScopedObjectAccessAlreadyRunnab return JValue(); } - ObjPtr<mirror::Object> receiver = soa.Decode<mirror::Object*>(obj); + ObjPtr<mirror::Object> receiver = soa.Decode<mirror::Object>(obj); ArtMethod* method = FindVirtualMethod(receiver, soa.DecodeMethod(mid)); bool is_string_init = method->GetDeclaringClass()->IsStringClass() && method->IsConstructor(); if (is_string_init) { @@ -547,7 +547,7 @@ JValue InvokeVirtualOrInterfaceWithVarArgs(const ScopedObjectAccessAlreadyRunnab return JValue(); } - ObjPtr<mirror::Object> receiver = soa.Decode<mirror::Object*>(obj); + ObjPtr<mirror::Object> receiver = soa.Decode<mirror::Object>(obj); ArtMethod* method = FindVirtualMethod(receiver, soa.DecodeMethod(mid)); bool is_string_init = method->GetDeclaringClass()->IsStringClass() && method->IsConstructor(); if (is_string_init) { @@ -580,18 +580,17 @@ jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject javaM return nullptr; } - ObjPtr<mirror::Executable> executable = soa.Decode<mirror::Executable*>(javaMethod); + ObjPtr<mirror::Executable> executable = soa.Decode<mirror::Executable>(javaMethod); const bool accessible = executable->IsAccessible(); ArtMethod* m = executable->GetArtMethod(); ObjPtr<mirror::Class> declaring_class = m->GetDeclaringClass(); if (UNLIKELY(!declaring_class->IsInitialized())) { StackHandleScope<1> hs(soa.Self()); - Handle<mirror::Class> h_class(hs.NewHandle(declaring_class.Decode())); + HandleWrapperObjPtr<mirror::Class> h_class(hs.NewHandleWrapper(&declaring_class)); if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(soa.Self(), h_class, true, true)) { return nullptr; } - declaring_class = h_class.Get(); } ObjPtr<mirror::Object> receiver; @@ -602,7 +601,7 @@ jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject javaM CHECK(javaReceiver == nullptr); } else { // Check that the receiver is non-null and an instance of the field's declaring class. - receiver = soa.Decode<mirror::Object*>(javaReceiver); + receiver = soa.Decode<mirror::Object>(javaReceiver); if (!VerifyObjectIsClass(receiver, declaring_class)) { return nullptr; } @@ -613,7 +612,8 @@ jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject javaM } // Get our arrays of arguments and their types, and check they're the same size. - auto* objects = soa.Decode<mirror::ObjectArray<mirror::Object>*>(javaArgs); + ObjPtr<mirror::ObjectArray<mirror::Object>> objects = + soa.Decode<mirror::ObjectArray<mirror::Object>>(javaArgs); auto* np_method = m->GetInterfaceMethodIfProxy(kRuntimePointerSize); const DexFile::TypeList* classes = np_method->GetParameterTypeList(); uint32_t classes_size = (classes == nullptr) ? 0 : classes->Size(); @@ -682,7 +682,7 @@ jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject javaM ObjPtr<mirror::Object> BoxPrimitive(Primitive::Type src_class, const JValue& value) { if (src_class == Primitive::kPrimNot) { - return value.GetL(); + return MakeObjPtr(value.GetL()); } if (src_class == Primitive::kPrimVoid) { // There's no such thing as a void field, and void methods invoked via reflection return null. |