diff options
| author | 2016-07-28 18:08:51 -0700 | |
|---|---|---|
| committer | 2016-08-03 15:46:18 -0700 | |
| commit | 36a270ae4f288e49493432b7128f899ad579849e (patch) | |
| tree | 99f134bbfe111b1c42b1b0c19d8b65175a3e6fc8 /compiler | |
| parent | 89bd8358c0a69e8cd6456d81d88ef366e261f732 (diff) | |
Change one read barrier bit to mark bit
Optimization to help slow path performance. When the GC marks an
object through the read barrier slow path. The GC sets the mark bit
in the lock word of that reference. This bit is checked from the
assembly entrypoint the common case is that it is set. If the bit is
set, the read barrier knows the object is already marked and there is
no work to do.
To prevent dirty pages in zygote and image, the bit is set by the
image writer and zygote space creation.
EAAC score (lower is better):
N9: 777 -> 700 (average 31 of runs)
N6P (960000 mhz): 1737.48 -> 1442.31 (average of 25 runs)
Bug: 30162165
Bug: 12687968
Test: N9, N6P booting, test-art-host, test-art-target all with CC
Change-Id: Iae0cacfae221e33151d3c0ab65338d1c822ab63d
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/image_writer.cc | 6 | ||||
| -rw-r--r-- | compiler/image_writer.h | 3 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_arm64.cc | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc index 7a34683bb5..c787dc59cd 100644 --- a/compiler/image_writer.cc +++ b/compiler/image_writer.cc @@ -39,6 +39,7 @@ #include "gc/accounting/card_table-inl.h" #include "gc/accounting/heap_bitmap.h" #include "gc/accounting/space_bitmap-inl.h" +#include "gc/collector/concurrent_copying.h" #include "gc/heap.h" #include "gc/space/large_object_space.h" #include "gc/space/space-inl.h" @@ -1823,6 +1824,11 @@ void ImageWriter::CopyAndFixupObject(Object* obj) { const auto it = saved_hashcode_map_.find(obj); dst->SetLockWord(it != saved_hashcode_map_.end() ? LockWord::FromHashCode(it->second, 0u) : LockWord::Default(), false); + if (kUseBakerReadBarrier && gc::collector::ConcurrentCopying::kGrayDirtyImmuneObjects) { + // Treat all of the objects in the image as marked to avoid unnecessary dirty pages. This is + // safe since we mark all of the objects that may reference non immune objects as gray. + CHECK(dst->AtomicSetMarkBit(0, 1)); + } FixupObject(obj, dst); } diff --git a/compiler/image_writer.h b/compiler/image_writer.h index 626a975aa6..7d13656b54 100644 --- a/compiler/image_writer.h +++ b/compiler/image_writer.h @@ -217,8 +217,7 @@ class ImageWriter FINAL { // uint32 = typeof(lockword_) // Subtract read barrier bits since we want these to remain 0, or else it may result in DCHECK // failures due to invalid read barrier bits during object field reads. - static const size_t kBinShift = BitSizeOf<uint32_t>() - kBinBits - - LockWord::kReadBarrierStateSize; + static const size_t kBinShift = BitSizeOf<uint32_t>() - kBinBits - LockWord::kGCStateSize; // 111000.....0 static const size_t kBinMask = ((static_cast<size_t>(1) << kBinBits) - 1) << kBinShift; diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index f3a09fd09f..bccde49a3a 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -609,6 +609,8 @@ class ReadBarrierMarkSlowPathARM64 : public SlowPathCodeARM64 { DCHECK_NE(obj_.reg(), LR); DCHECK_NE(obj_.reg(), WSP); DCHECK_NE(obj_.reg(), WZR); + // WIP0 is used by the slow path as a temp, it can not be the object register. + DCHECK_NE(obj_.reg(), IP0); DCHECK(0 <= obj_.reg() && obj_.reg() < kNumberOfWRegisters) << obj_.reg(); // "Compact" slow path, saving two moves. // |