summaryrefslogtreecommitdiff
path: root/runtime/mirror/reference-inl.h
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2016-10-14 14:28:47 -0700
committer Mathieu Chartier <mathieuc@google.com> 2016-10-14 14:38:43 -0700
commit5d3f73aef1b778d81ba101ece41935adee259cf2 (patch)
treefec0c2fdbb88df0a366e29b6470d1274aa6e2ec1 /runtime/mirror/reference-inl.h
parentcfdff144f154df876987fefb340058a975c43381 (diff)
Move reference processor and mirror::Reference to ObjPtr
Bug: 31113334 Test: test-art-host Change-Id: I2c7c3dfd88ebf12a0de271436f8a7781f997e061
Diffstat (limited to 'runtime/mirror/reference-inl.h')
-rw-r--r--runtime/mirror/reference-inl.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/runtime/mirror/reference-inl.h b/runtime/mirror/reference-inl.h
index 039989bcb4..a449b41087 100644
--- a/runtime/mirror/reference-inl.h
+++ b/runtime/mirror/reference-inl.h
@@ -19,6 +19,8 @@
#include "reference.h"
+#include "obj_ptr-inl.h"
+
namespace art {
namespace mirror {
@@ -27,6 +29,24 @@ inline uint32_t Reference::ClassSize(PointerSize pointer_size) {
return Class::ComputeClassSize(false, vtable_entries, 2, 0, 0, 0, 0, pointer_size);
}
+template<bool kTransactionActive>
+inline void Reference::SetReferent(ObjPtr<Object> referent) {
+ SetFieldObjectVolatile<kTransactionActive>(ReferentOffset(), referent);
+}
+
+inline void Reference::SetPendingNext(ObjPtr<Reference> pending_next) {
+ if (Runtime::Current()->IsActiveTransaction()) {
+ SetFieldObject<true>(PendingNextOffset(), pending_next);
+ } else {
+ SetFieldObject<false>(PendingNextOffset(), pending_next);
+ }
+}
+
+template<bool kTransactionActive>
+inline void FinalizerReference::SetZombie(ObjPtr<Object> zombie) {
+ return SetFieldObjectVolatile<kTransactionActive>(ZombieOffset(), zombie);
+}
+
} // namespace mirror
} // namespace art