diff options
| author | 2017-05-05 00:23:38 +0000 | |
|---|---|---|
| committer | 2017-05-05 00:23:39 +0000 | |
| commit | 1a8864ec75a3a09e2e4a9eae63010f9ab6be0049 (patch) | |
| tree | 7f2903217c0773f8cc0c3580fe5aa1d90998d1c5 /runtime/openjdkjvmti/jvmti_weak_table-inl.h | |
| parent | 9e8797d1c96dd4744b667ef6bbd10812e2087f79 (diff) | |
| parent | d73aba4f0c95914cc51144b0b609d9293e5341cf (diff) | |
Merge "ART: Add Heap JVMTI extension API"
Diffstat (limited to 'runtime/openjdkjvmti/jvmti_weak_table-inl.h')
| -rw-r--r-- | runtime/openjdkjvmti/jvmti_weak_table-inl.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/openjdkjvmti/jvmti_weak_table-inl.h b/runtime/openjdkjvmti/jvmti_weak_table-inl.h index f67fffccbb..64ab3e7b2e 100644 --- a/runtime/openjdkjvmti/jvmti_weak_table-inl.h +++ b/runtime/openjdkjvmti/jvmti_weak_table-inl.h @@ -384,6 +384,23 @@ jvmtiError JvmtiWeakTable<T>::GetTaggedObjects(jvmtiEnv* jvmti_env, return ERR(NONE); } +template <typename T> +art::mirror::Object* JvmtiWeakTable<T>::Find(T tag) { + art::Thread* self = art::Thread::Current(); + art::MutexLock mu(self, allow_disallow_lock_); + Wait(self); + + for (auto& pair : tagged_objects_) { + if (tag == pair.second) { + art::mirror::Object* obj = pair.first.template Read<art::kWithReadBarrier>(); + if (obj != nullptr) { + return obj; + } + } + } + return nullptr; +} + } // namespace openjdkjvmti #endif // ART_RUNTIME_OPENJDKJVMTI_JVMTI_WEAK_TABLE_INL_H_ |