Implement << operator for ProfileCompilationInfo::DexRefence
It avoids the need to use inner fields in the inliner.
Bug: 139884006
Test: m test-art-host-gtest
Change-Id: I3b2276094829a0e431dc145bf1ff13cbfa746742
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index d57b916..ff7ed34 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -746,8 +746,7 @@
}
}
if (!found) {
- VLOG(compiler) << "Could not find profiled dex file: "
- << offline_profile.dex_references[i].profile_key;
+ VLOG(compiler) << "Could not find profiled dex file: " << offline_profile.dex_references[i];
return kInlineCacheMissingTypes;
}
}
diff --git a/libprofile/profile/profile_compilation_info.cc b/libprofile/profile/profile_compilation_info.cc
index dc21a48..9b4ee90 100644
--- a/libprofile/profile/profile_compilation_info.cc
+++ b/libprofile/profile/profile_compilation_info.cc
@@ -2158,4 +2158,13 @@
return IsForBootImage() ? kSizeErrorThresholdBootBytes : kSizeErrorThresholdBytes;
}
+std::ostream& operator<<(std::ostream& stream,
+ const ProfileCompilationInfo::DexReference& dex_ref) {
+ stream << "[profile_key=" << dex_ref.profile_key
+ << ",dex_checksum=" << std::hex << dex_ref.dex_checksum << std::dec
+ << ",num_method_ids=" << dex_ref.num_method_ids
+ << "]";
+ return stream;
+}
+
} // namespace art
diff --git a/libprofile/profile/profile_compilation_info.h b/libprofile/profile/profile_compilation_info.h
index f7f21e5..9810112 100644
--- a/libprofile/profile/profile_compilation_info.h
+++ b/libprofile/profile/profile_compilation_info.h
@@ -833,6 +833,8 @@
uint8_t version_[kProfileVersionSize];
};
+std::ostream& operator<<(std::ostream& stream,
+ const ProfileCompilationInfo::DexReference& dex_ref);
} // namespace art
#endif // ART_LIBPROFILE_PROFILE_PROFILE_COMPILATION_INFO_H_