summaryrefslogtreecommitdiff
path: root/runtime/runtime_image.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/runtime_image.cc')
-rw-r--r--runtime/runtime_image.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/runtime_image.cc b/runtime/runtime_image.cc
index 997ea2fde6..fdba92e67f 100644
--- a/runtime/runtime_image.cc
+++ b/runtime/runtime_image.cc
@@ -1610,9 +1610,15 @@ class RuntimeImageHelper {
// Clear static field values.
auto clear_class = [&] () REQUIRES_SHARED(Locks::mutator_lock_) {
MemberOffset static_offset = cls->GetFirstReferenceStaticFieldOffset(kRuntimePointerSize);
- memset(objects_.data() + offset + static_offset.Uint32Value(),
- 0,
- cls->GetClassSize() - static_offset.Uint32Value());
+ uint32_t ref_offsets = cls->GetReferenceInstanceOffsets();
+ size_t size = cls->GetClassSize() - static_offset.Uint32Value();
+ // Adjust for overflow instance-offset bitmap, which is after the static
+ // fields.
+ if ((ref_offsets & mirror::Class::kVisitReferencesSlowpathMask) != 0) {
+ ref_offsets &= ~mirror::Class::kVisitReferencesSlowpathMask;
+ size -= ref_offsets * sizeof(uint32_t);
+ }
+ memset(objects_.data() + offset + static_offset.Uint32Value(), 0, size);
};
clear_class();