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
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index bfa2b69..38ee468 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -33,7 +33,7 @@
#include "nth_caller_visitor.h"
#include "oat_quick_method_header.h"
#include "reflection.h"
-#include "scoped_thread_state_change.h"
+#include "scoped_thread_state_change-inl.h"
#include "well_known_classes.h"
namespace art {
@@ -165,7 +165,7 @@
CHECK(soa.Self()->IsExceptionPending());
return zero;
}
- soa.Decode<mirror::ObjectArray<mirror::Object>* >(args_jobj)->Set<false>(i, val);
+ soa.Decode<mirror::ObjectArray<mirror::Object>>(args_jobj)->Set<false>(i, val);
}
}
}
@@ -187,13 +187,13 @@
return zero;
} else {
ArtMethod* interface_method =
- soa.Decode<mirror::Method*>(interface_method_jobj)->GetArtMethod();
+ soa.Decode<mirror::Method>(interface_method_jobj)->GetArtMethod();
// This can cause thread suspension.
PointerSize pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
mirror::Class* result_type = interface_method->GetReturnType(true /* resolve */, pointer_size);
- mirror::Object* result_ref = soa.Decode<mirror::Object*>(result);
+ ObjPtr<mirror::Object> result_ref = soa.Decode<mirror::Object>(result);
JValue result_unboxed;
- if (!UnboxPrimitiveForResult(result_ref, result_type, &result_unboxed)) {
+ if (!UnboxPrimitiveForResult(result_ref.Decode(), result_type, &result_unboxed)) {
DCHECK(soa.Self()->IsExceptionPending());
return zero;
}
@@ -207,9 +207,9 @@
bool declares_exception = false;
{
ScopedAssertNoThreadSuspension ants(__FUNCTION__);
- mirror::Object* rcvr = soa.Decode<mirror::Object*>(rcvr_jobj);
+ ObjPtr<mirror::Object> rcvr = soa.Decode<mirror::Object>(rcvr_jobj);
mirror::Class* proxy_class = rcvr->GetClass();
- mirror::Method* interface_method = soa.Decode<mirror::Method*>(interface_method_jobj);
+ ObjPtr<mirror::Method> interface_method = soa.Decode<mirror::Method>(interface_method_jobj);
ArtMethod* proxy_method = rcvr->GetClass()->FindVirtualMethodForInterface(
interface_method->GetArtMethod(), kRuntimePointerSize);
auto virtual_methods = proxy_class->GetVirtualMethodsSlice(kRuntimePointerSize);
diff --git a/runtime/entrypoints/jni/jni_entrypoints.cc b/runtime/entrypoints/jni/jni_entrypoints.cc
index 22226c1..fd23ced 100644
--- a/runtime/entrypoints/jni/jni_entrypoints.cc
+++ b/runtime/entrypoints/jni/jni_entrypoints.cc
@@ -18,7 +18,7 @@
#include "base/logging.h"
#include "entrypoints/entrypoint_utils.h"
#include "mirror/object-inl.h"
-#include "scoped_thread_state_change.h"
+#include "scoped_thread_state_change-inl.h"
#include "thread.h"
namespace art {
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index cfd948e..c52bc8e 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -36,7 +36,7 @@
#include "oat_quick_method_header.h"
#include "quick_exception_handler.h"
#include "runtime.h"
-#include "scoped_thread_state_change.h"
+#include "scoped_thread_state_change-inl.h"
#include "stack.h"
#include "debugger.h"
@@ -834,7 +834,7 @@
void BuildQuickArgumentVisitor::FixupReferences() {
// Fixup any references which may have changed.
for (const auto& pair : references_) {
- pair.second->Assign(soa_->Decode<mirror::Object*>(pair.first));
+ pair.second->Assign(soa_->Decode<mirror::Object>(pair.first).Decode());
soa_->Env()->DeleteLocalRef(pair.first);
}
}
@@ -926,7 +926,7 @@
void RememberForGcArgumentVisitor::FixupReferences() {
// Fixup any references which may have changed.
for (const auto& pair : references_) {
- pair.second->Assign(soa_->Decode<mirror::Object*>(pair.first));
+ pair.second->Assign(soa_->Decode<mirror::Object>(pair.first).Decode());
soa_->Env()->DeleteLocalRef(pair.first);
}
}