ART: Make some variables references
Avoid copying values.
Bug: 32619234
Test: m
Change-Id: I86bc206d6f6fccdf730c62c60317a7a4ae26c11b
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 1b87725..8503934 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1522,7 +1522,7 @@
if (!use_dex_cache) {
bool method_in_image = false;
- const std::vector<gc::space::ImageSpace*> image_spaces = heap->GetBootImageSpaces();
+ const std::vector<gc::space::ImageSpace*>& image_spaces = heap->GetBootImageSpaces();
for (gc::space::ImageSpace* image_space : image_spaces) {
const auto& method_section = image_space->GetImageHeader().GetMethodsSection();
if (method_section.Contains(reinterpret_cast<uint8_t*>(method) - image_space->Begin())) {
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 118daac..0b602e9 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -1606,7 +1606,7 @@
std::ostringstream oss;
bool first = true;
- for (auto msg : error_msgs) {
+ for (const auto& msg : error_msgs) {
if (!first) {
oss << "\n ";
}
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index fde0a2c..d71ef54 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -398,7 +398,7 @@
while (!temp.empty() && index < shared_libraries_split.size() - 1) {
DexFileAndClassPair pair(temp.top());
const DexFile* dex_file = pair.GetDexFile();
- std::string dex_filename(dex_file->GetLocation());
+ const std::string& dex_filename = dex_file->GetLocation();
uint32_t dex_checksum = dex_file->GetLocationChecksum();
if (dex_filename != shared_libraries_split[index] ||
dex_checksum != std::stoul(shared_libraries_split[index + 1])) {