From 0795f23920ee9aabf28e45c63cd592dcccf00216 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Tue, 27 Sep 2016 18:43:30 -0700 Subject: 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 --- runtime/java_vm_ext.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'runtime/java_vm_ext.cc') diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc index 979495ab9e..0c752ef4fe 100644 --- a/runtime/java_vm_ext.cc +++ b/runtime/java_vm_ext.cc @@ -36,7 +36,7 @@ #include "runtime-inl.h" #include "runtime_options.h" #include "ScopedLocalRef.h" -#include "scoped_thread_state_change.h" +#include "scoped_thread_state_change-inl.h" #include "thread-inl.h" #include "thread_list.h" @@ -532,17 +532,17 @@ bool JavaVMExt::ShouldTrace(ArtMethod* method) { return true; } -jobject JavaVMExt::AddGlobalRef(Thread* self, mirror::Object* obj) { +jobject JavaVMExt::AddGlobalRef(Thread* self, ObjPtr obj) { // Check for null after decoding the object to handle cleared weak globals. if (obj == nullptr) { return nullptr; } WriterMutexLock mu(self, globals_lock_); - IndirectRef ref = globals_.Add(IRT_FIRST_SEGMENT, obj); + IndirectRef ref = globals_.Add(IRT_FIRST_SEGMENT, obj.Decode()); return reinterpret_cast(ref); } -jweak JavaVMExt::AddWeakGlobalRef(Thread* self, mirror::Object* obj) { +jweak JavaVMExt::AddWeakGlobalRef(Thread* self, ObjPtr obj) { if (obj == nullptr) { return nullptr; } @@ -550,7 +550,7 @@ jweak JavaVMExt::AddWeakGlobalRef(Thread* self, mirror::Object* obj) { while (UNLIKELY(!MayAccessWeakGlobals(self))) { weak_globals_add_condition_.WaitHoldingLocks(self); } - IndirectRef ref = weak_globals_.Add(IRT_FIRST_SEGMENT, obj); + IndirectRef ref = weak_globals_.Add(IRT_FIRST_SEGMENT, obj.Decode()); return reinterpret_cast(ref); } @@ -755,15 +755,15 @@ bool JavaVMExt::LoadNativeLibrary(JNIEnv* env, ScopedObjectAccess soa(env); // As the incoming class loader is reachable/alive during the call of this function, // it's okay to decode it without worrying about unexpectedly marking it alive. - mirror::ClassLoader* loader = soa.Decode(class_loader); + ObjPtr loader = soa.Decode(class_loader); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); - if (class_linker->IsBootClassLoader(soa, loader)) { + if (class_linker->IsBootClassLoader(soa, loader.Decode())) { loader = nullptr; class_loader = nullptr; } - class_loader_allocator = class_linker->GetAllocatorForClassLoader(loader); + class_loader_allocator = class_linker->GetAllocatorForClassLoader(loader.Decode()); CHECK(class_loader_allocator != nullptr); } if (library != nullptr) { -- cgit v1.2.3-59-g8ed1b