Add missing read barriers to intern table.
Also deleted GcRoot::Assign.
Change-Id: Ib1ea739cf79c72fc92a8628cd9095c11b660e018
diff --git a/runtime/gc_root-inl.h b/runtime/gc_root-inl.h
index 2661e54..482f7bc 100644
--- a/runtime/gc_root-inl.h
+++ b/runtime/gc_root-inl.h
@@ -29,10 +29,5 @@
return ReadBarrier::BarrierForRoot<MirrorType, kReadBarrierOption>(&root_);
}
-template<class MirrorType>
-inline void GcRoot<MirrorType>::Assign(MirrorType* value) {
- root_ = value;
-}
-
} // namespace art
#endif // ART_RUNTIME_GC_ROOT_INL_H_
diff --git a/runtime/gc_root.h b/runtime/gc_root.h
index 3928f5d..b10a55c 100644
--- a/runtime/gc_root.h
+++ b/runtime/gc_root.h
@@ -28,7 +28,6 @@
public:
template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
ALWAYS_INLINE MirrorType* Read() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- ALWAYS_INLINE void Assign(MirrorType* value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
void VisitRoot(RootCallback* callback, void* arg, uint32_t thread_id, RootType root_type) {
callback(reinterpret_cast<mirror::Object**>(&root_), arg, thread_id, root_type);
diff --git a/runtime/intern_table.cc b/runtime/intern_table.cc
index c66f99e..f6e6661 100644
--- a/runtime/intern_table.cc
+++ b/runtime/intern_table.cc
@@ -103,7 +103,7 @@
Locks::intern_table_lock_->AssertHeld(Thread::Current());
auto it = table->find(GcRoot<mirror::String>(s));
if (LIKELY(it != table->end())) {
- return const_cast<GcRoot<mirror::String>&>(*it).Read<kWithReadBarrier>();
+ return const_cast<GcRoot<mirror::String>&>(*it).Read();
}
return nullptr;
}
@@ -299,7 +299,7 @@
if (new_object == nullptr) {
it = weak_interns_.erase(it);
} else {
- root.Assign(down_cast<mirror::String*>(new_object));
+ root = GcRoot<mirror::String>(down_cast<mirror::String*>(new_object));
++it;
}
}
@@ -309,8 +309,7 @@
if (kIsDebugBuild) {
Locks::mutator_lock_->AssertSharedHeld(Thread::Current());
}
- return static_cast<size_t>(
- const_cast<GcRoot<mirror::String>&>(root).Read<kWithoutReadBarrier>()->GetHashCode());
+ return static_cast<size_t>(const_cast<GcRoot<mirror::String>&>(root).Read()->GetHashCode());
}
bool InternTable::StringHashEquals::operator()(const GcRoot<mirror::String>& a,
@@ -318,8 +317,8 @@
if (kIsDebugBuild) {
Locks::mutator_lock_->AssertSharedHeld(Thread::Current());
}
- return const_cast<GcRoot<mirror::String>&>(a).Read<kWithoutReadBarrier>()->Equals(
- const_cast<GcRoot<mirror::String>&>(b).Read<kWithoutReadBarrier>());
+ return const_cast<GcRoot<mirror::String>&>(a).Read()->Equals(
+ const_cast<GcRoot<mirror::String>&>(b).Read());
}
} // namespace art