Do not restore source object hash in ImageWriter.
Writing the image is the last step, so these values shall
not be needed anymore. And if we decided to restore the heap
to a usable state, we would have to clear the lockword of
all other objects as well.
Test: m test-art-host-gtest
Test: Pixel 2 XL boots.
Change-Id: I6cc807808b49f89e20f0141bcc2ad20b9005a614
diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc
index 4d986e8..de9c3d8 100644
--- a/dex2oat/linker/image_writer.cc
+++ b/dex2oat/linker/image_writer.cc
@@ -2217,12 +2217,7 @@
CopyAndFixupObject(obj);
};
Runtime::Current()->GetHeap()->VisitObjects(visitor);
- // Fix up the object previously had hash codes.
- for (const auto& hash_pair : saved_hashcode_map_) {
- Object* obj = hash_pair.first;
- DCHECK_EQ(obj->GetLockWord<kVerifyNone>(false).ReadBarrierState(), 0U);
- obj->SetLockWord<kVerifyNone>(LockWord::FromHashCode(hash_pair.second, 0U), false);
- }
+ // We no longer need the hashcode map, values have already been copied to target objects.
saved_hashcode_map_.clear();
}