diff options
author | Mathieu Chartier <mathieuc@google.com> | 2016-09-27 18:43:30 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2016-09-29 17:31:09 -0700 |
commit | 0795f23920ee9aabf28e45c63cd592dcccf00216 (patch) | |
tree | ff3f880c5e84f3316532b47d0e9a7729ade848ac /runtime/java_vm_ext.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/java_vm_ext.cc')
-rw-r--r-- | runtime/java_vm_ext.cc | 16 |
1 files changed, 8 insertions, 8 deletions
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<mirror::Object> 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<jobject>(ref); } -jweak JavaVMExt::AddWeakGlobalRef(Thread* self, mirror::Object* obj) { +jweak JavaVMExt::AddWeakGlobalRef(Thread* self, ObjPtr<mirror::Object> 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<jweak>(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<mirror::ClassLoader*>(class_loader); + ObjPtr<mirror::ClassLoader> loader = soa.Decode<mirror::ClassLoader>(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) { |