summaryrefslogtreecommitdiff
path: root/runtime/mirror/dex_cache-inl.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2018-06-26 19:54:12 -0700
committer Andreas Gampe <agampe@google.com> 2018-10-25 09:52:28 -0700
commit88dbad33ae92167a89a5d5469f39f41624535dbf (patch)
treeb3b0c864c12c246117143954f16df054309852c6 /runtime/mirror/dex_cache-inl.h
parentc58dca3941459b4375a53925f3471373584eab5e (diff)
ART: Do some include-what-you-use
Help with transitive includes. In preparation for new specialized headers reducing transitivity. Bug: 118385392 Test: mmma art Change-Id: Ib465ecceec3331ea81588fb4a43eb65e766b6904
Diffstat (limited to 'runtime/mirror/dex_cache-inl.h')
-rw-r--r--runtime/mirror/dex_cache-inl.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h
index 6efb7474e0..13eaf3da45 100644
--- a/runtime/mirror/dex_cache-inl.h
+++ b/runtime/mirror/dex_cache-inl.h
@@ -27,12 +27,12 @@
#include "base/enums.h"
#include "class_linker.h"
#include "dex/dex_file.h"
-#include "gc/heap-inl.h"
#include "gc_root-inl.h"
#include "mirror/call_site.h"
#include "mirror/class.h"
#include "mirror/method_type.h"
#include "obj_ptr.h"
+#include "object-inl.h"
#include "runtime.h"
#include "write_barrier-inl.h"
@@ -42,6 +42,27 @@ namespace art {
namespace mirror {
template <typename T>
+inline DexCachePair<T>::DexCachePair(ObjPtr<T> object, uint32_t index)
+ : object(object), index(index) {}
+
+template <typename T>
+inline void DexCachePair<T>::Initialize(std::atomic<DexCachePair<T>>* dex_cache) {
+ DexCachePair<T> first_elem;
+ first_elem.object = GcRoot<T>(nullptr);
+ first_elem.index = InvalidIndexForSlot(0);
+ dex_cache[0].store(first_elem, std::memory_order_relaxed);
+}
+
+template <typename T>
+inline T* DexCachePair<T>::GetObjectForIndex(uint32_t idx) {
+ if (idx != index) {
+ return nullptr;
+ }
+ DCHECK(!object.IsNull());
+ return object.Read();
+}
+
+template <typename T>
inline void NativeDexCachePair<T>::Initialize(std::atomic<NativeDexCachePair<T>>* dex_cache,
PointerSize pointer_size) {
NativeDexCachePair<T> first_elem;