Add more checks for helping with b/284236137.
Bug: 284236137
Test: test.py
Change-Id: I5458c19c617eddd569eb8bc9f56a2b14c1b235c9
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index 3321636..1252946 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -542,6 +542,9 @@
dex::TypeIndex type_index = k->GetDexTypeIndex();
uint32_t copied_methods_start = klass->GetCopiedMethodsStartOffset();
LengthPrefixedArray<ArtMethod>* methods = klass->GetMethodsPtr();
+ if (methods != nullptr) {
+ CHECK_LE(copied_methods_start, methods->size()) << k->PrettyClass();
+ }
DexFileRecords* dex_file_records;
auto it = dex_file_records_map_.find(&dex_file);
@@ -593,11 +596,13 @@
continue;
}
const size_t methods_size = methods->size();
+ CHECK_LE(class_record.copied_methods_start, methods_size)
+ << dex_file->PrettyType(class_record.type_index);
for (size_t index = class_record.copied_methods_start; index != methods_size; ++index) {
// Note: Using `ArtMethod` array with implicit `kRuntimePointerSize`.
ArtMethod& method = methods->At(index);
- DCHECK(method.IsCopied());
- DCHECK(!method.IsNative());
+ CHECK(method.IsCopied()) << dex_file->PrettyType(class_record.type_index);
+ CHECK(!method.IsNative()) << dex_file->PrettyType(class_record.type_index);
if (method.IsInvokable()) {
const DexFile* method_dex_file = method.GetDexFile();
DexFileRecords* method_dex_file_records = dex_file_records;