diff options
Diffstat (limited to 'runtime/mirror/class.cc')
-rw-r--r-- | runtime/mirror/class.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc index 3fcb188697..6df7204555 100644 --- a/runtime/mirror/class.cc +++ b/runtime/mirror/class.cc @@ -278,14 +278,15 @@ void Class::DumpClass(std::ostream& os, int flags) { } void Class::SetReferenceInstanceOffsets(uint32_t new_reference_offsets) { - if (new_reference_offsets != CLASS_WALK_SUPER) { + if (kIsDebugBuild && (new_reference_offsets != kClassWalkSuper)) { // Sanity check that the number of bits set in the reference offset bitmap // agrees with the number of references - size_t count = 0; + uint32_t count = 0; for (Class* c = this; c != nullptr; c = c->GetSuperClass()) { count += c->NumReferenceInstanceFieldsDuringLinking(); } - CHECK_EQ((size_t)POPCOUNT(new_reference_offsets), count); + // +1 for the Class in Object. + CHECK_EQ(static_cast<uint32_t>(POPCOUNT(new_reference_offsets)) + 1, count); } // Not called within a transaction. SetField32<false>(OFFSET_OF_OBJECT_MEMBER(Class, reference_instance_offsets_), |