diff options
| author | 2016-01-22 14:18:57 -0800 | |
|---|---|---|
| committer | 2016-01-26 15:19:36 -0800 | |
| commit | 522d51b088c63d757e487d07d769f8f09e042f2a (patch) | |
| tree | f1b5a1646ef0fa68f7b51e68caaf1f82624099e2 /runtime/mirror/reference.h | |
| parent | c31fb58453ec1eba82390c3313623d37314c5490 (diff) | |
Factor out common code for SetPendingNext.
Change-Id: I6c1f9cd6da7b2c21714175455e61479273d3669f
Diffstat (limited to 'runtime/mirror/reference.h')
| -rw-r--r-- | runtime/mirror/reference.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/mirror/reference.h b/runtime/mirror/reference.h index 51ae760515..5e467ab94a 100644 --- a/runtime/mirror/reference.h +++ b/runtime/mirror/reference.h @@ -22,6 +22,7 @@ #include "object.h" #include "object_callbacks.h" #include "read_barrier_option.h" +#include "runtime.h" #include "thread.h" namespace art { @@ -80,9 +81,14 @@ class MANAGED Reference : public Object { Reference* GetPendingNext() SHARED_REQUIRES(Locks::mutator_lock_) { return GetFieldObject<Reference>(PendingNextOffset()); } - template<bool kTransactionActive> - void SetPendingNext(Reference* pending_next) SHARED_REQUIRES(Locks::mutator_lock_) { - SetFieldObject<kTransactionActive>(PendingNextOffset(), pending_next); + + void SetPendingNext(Reference* pending_next) + SHARED_REQUIRES(Locks::mutator_lock_) { + if (Runtime::Current()->IsActiveTransaction()) { + SetFieldObject<true>(PendingNextOffset(), pending_next); + } else { + SetFieldObject<false>(PendingNextOffset(), pending_next); + } } bool IsEnqueued() SHARED_REQUIRES(Locks::mutator_lock_) { |