diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-12-08 12:59:27 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-12-08 12:59:51 -0800 |
commit | 4099b788d2797b1d5ad247296e7ca18e60f010c0 (patch) | |
tree | 53cb258a3d1a09e03f9a146a99572bc36016dd93 | |
parent | a4b1eee59648703f8fab664b45d1d61c861c80fe (diff) | |
download | art-4099b788d2797b1d5ad247296e7ca18e60f010c0.tar.gz art-4099b788d2797b1d5ad247296e7ca18e60f010c0.tar.bz2 art-4099b788d2797b1d5ad247296e7ca18e60f010c0.zip |
Re-add missing read barriers
Also added DCHECKS
Change-Id: Ie4c43432479e0e8db197f7a6568a33126e38ccdb
-rw-r--r-- | runtime/reference_table.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/reference_table.cc b/runtime/reference_table.cc index 17eb7edac..366b1f0ab 100644 --- a/runtime/reference_table.cc +++ b/runtime/reference_table.cc @@ -78,6 +78,11 @@ struct ObjectComparator { Locks::mutator_lock_->AssertSharedHeld(Thread::Current()); mirror::Object* obj1 = root1.Read<kWithoutReadBarrier>(); mirror::Object* obj2 = root2.Read<kWithoutReadBarrier>(); + DCHECK(obj1 != nullptr); + DCHECK(obj2 != nullptr); + Runtime* runtime = Runtime::Current(); + DCHECK(!runtime->IsClearedJniWeakGlobal(obj1)); + DCHECK(!runtime->IsClearedJniWeakGlobal(obj2)); // Sort by class... if (obj1->GetClass() != obj2->GetClass()) { return obj1->GetClass()->IdentityHashCode() < obj2->IdentityHashCode(); @@ -153,7 +158,7 @@ void ReferenceTable::Dump(std::ostream& os, Table& entries) { os << " Last " << (count - first) << " entries (of " << count << "):\n"; Runtime* runtime = Runtime::Current(); for (int idx = count - 1; idx >= first; --idx) { - mirror::Object* ref = entries[idx].Read<kWithoutReadBarrier>(); + mirror::Object* ref = entries[idx].Read(); if (ref == nullptr) { continue; } @@ -189,7 +194,7 @@ void ReferenceTable::Dump(std::ostream& os, Table& entries) { // Make a copy of the table and sort it, only adding non null and not cleared elements. Table sorted_entries; for (GcRoot<mirror::Object>& root : entries) { - if (!root.IsNull() && !runtime->IsClearedJniWeakGlobal(root.Read<kWithoutReadBarrier>())) { + if (!root.IsNull() && !runtime->IsClearedJniWeakGlobal(root.Read())) { sorted_entries.push_back(root); } } |