Revert "ART: Fix some performance-X tidy"
This reverts commit 89de444350fdbd7df4fb4d95bb71f00e6673b466.
Reason for revert: Seemingly breaks imgdiag_test on device.
Change-Id: I46084ecb4205575381aafffd90a0f1a1126e8d2d
Test: mmma art
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index ad44624..a060fd2 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -1768,7 +1768,7 @@
writer.Finish();
ASSERT_EQ(apk_file.GetFile()->Flush(), 0);
}
- const std::string& dex_location = apk_file.GetFilename();
+ const std::string dex_location = apk_file.GetFilename();
const std::string odex_location = GetOdexDir() + "/output.odex";
GenerateOdexForTest(dex_location,
odex_location,
@@ -1974,7 +1974,7 @@
<< "Failed to find candidate code item with only one code unit in last instruction.";
});
- const std::string& dex_location = temp_dex.GetFilename();
+ std::string dex_location = temp_dex.GetFilename();
std::string odex_location = GetOdexDir() + "/quickened.odex";
std::string vdex_location = GetOdexDir() + "/quickened.vdex";
std::unique_ptr<File> vdex_output(OS::CreateEmptyFile(vdex_location.c_str()));
@@ -2049,7 +2049,7 @@
writer.Finish();
ASSERT_EQ(invalid_dex.GetFile()->Flush(), 0);
}
- const std::string& dex_location = invalid_dex.GetFilename();
+ const std::string dex_location = invalid_dex.GetFilename();
const std::string odex_location = GetOdexDir() + "/output.odex";
std::string error_msg;
int status = GenerateOdexForTestWithStatus(
diff --git a/dex2oat/linker/arm/relative_patcher_arm_base.cc b/dex2oat/linker/arm/relative_patcher_arm_base.cc
index a2ba339..7cb8ae5 100644
--- a/dex2oat/linker/arm/relative_patcher_arm_base.cc
+++ b/dex2oat/linker/arm/relative_patcher_arm_base.cc
@@ -251,7 +251,7 @@
continue;
}
// Get the base name to use for the first occurrence of the thunk.
- const std::string& base_name = data.GetDebugName();
+ std::string base_name = data.GetDebugName();
for (size_t i = start, num = data.NumberOfThunks(); i != num; ++i) {
debug::MethodDebugInfo info = {};
if (i == 0u) {
diff --git a/dexlayout/dexlayout_test.cc b/dexlayout/dexlayout_test.cc
index 2b1352d..f148b94 100644
--- a/dexlayout/dexlayout_test.cc
+++ b/dexlayout/dexlayout_test.cc
@@ -468,7 +468,7 @@
}
std::vector<std::string> test_files = { dex_file, profile_file, output_dex, second_output_dex };
- for (const std::string& test_file : test_files) {
+ for (auto test_file : test_files) {
if (!UnlinkFile(test_file)) {
return false;
}
@@ -501,7 +501,7 @@
}
std::vector<std::string> dex_files = { input_dex, output_dex };
- for (const std::string& dex_file : dex_files) {
+ for (auto dex_file : dex_files) {
if (!UnlinkFile(dex_file)) {
return false;
}
diff --git a/imgdiag/imgdiag.cc b/imgdiag/imgdiag.cc
index fccc326..ddb8fe1 100644
--- a/imgdiag/imgdiag.cc
+++ b/imgdiag/imgdiag.cc
@@ -335,7 +335,7 @@
using ComputeDirtyFunc = std::function<void(mirror::Object* object,
const uint8_t* begin_image_ptr,
const std::set<size_t>& dirty_pages)>;
- ImgObjectVisitor(const ComputeDirtyFunc& dirty_func,
+ ImgObjectVisitor(ComputeDirtyFunc dirty_func,
const uint8_t* begin_image_ptr,
const std::set<size_t>& dirty_pages) :
dirty_func_(dirty_func),
@@ -356,7 +356,7 @@
}
private:
- const ComputeDirtyFunc& dirty_func_;
+ ComputeDirtyFunc dirty_func_;
const uint8_t* begin_image_ptr_;
const std::set<size_t>& dirty_pages_;
};
@@ -646,7 +646,7 @@
using ComputeDirtyFunc = std::function<void(ArtMethod*,
const uint8_t*,
const std::set<size_t>&)>;
- ImgArtMethodVisitor(const ComputeDirtyFunc& dirty_func,
+ ImgArtMethodVisitor(ComputeDirtyFunc dirty_func,
const uint8_t* begin_image_ptr,
const std::set<size_t>& dirty_pages) :
dirty_func_(dirty_func),
@@ -658,7 +658,7 @@
}
private:
- const ComputeDirtyFunc& dirty_func_;
+ ComputeDirtyFunc dirty_func_;
const uint8_t* begin_image_ptr_;
const std::set<size_t>& dirty_pages_;
};
diff --git a/libartbase/base/variant_map_test.cc b/libartbase/base/variant_map_test.cc
index f2da338..4677b6d 100644
--- a/libartbase/base/variant_map_test.cc
+++ b/libartbase/base/variant_map_test.cc
@@ -108,7 +108,7 @@
EXPECT_EQ(size_t(2), fmFilled.Size());
// Test copy constructor
- FruitMap fmEmptyCopy(fmEmpty); // NOLINT
+ FruitMap fmEmptyCopy(fmEmpty);
EXPECT_EQ(size_t(0), fmEmptyCopy.Size());
// Test copy constructor
diff --git a/libdexfile/dex/dex_instruction_test.cc b/libdexfile/dex/dex_instruction_test.cc
index 6ce9dba..c944085 100644
--- a/libdexfile/dex/dex_instruction_test.cc
+++ b/libdexfile/dex/dex_instruction_test.cc
@@ -135,7 +135,7 @@
static void Build35c(uint16_t* out,
Instruction::Code code,
uint16_t method_idx,
- const std::vector<uint16_t>& args) {
+ std::vector<uint16_t> args) {
out[0] = 0;
out[0] |= (args.size() << 12);
out[0] |= static_cast<uint16_t>(code);
@@ -152,7 +152,7 @@
static std::string DumpInst35c(Instruction::Code code,
uint16_t method_idx,
- const std::vector<uint16_t>& args) {
+ std::vector<uint16_t> args) {
uint16_t inst[6] = {};
Build35c(inst, code, method_idx, args);
return Instruction::At(inst)->DumpString(nullptr);
diff --git a/libprofile/profile/profile_compilation_info.cc b/libprofile/profile/profile_compilation_info.cc
index 1bb84b1..748e24e 100644
--- a/libprofile/profile/profile_compilation_info.cc
+++ b/libprofile/profile/profile_compilation_info.cc
@@ -1383,7 +1383,7 @@
// the current profile info.
// Note that the number of elements should be very small, so this should not
// be a performance issue.
- for (const ProfileLineHeader& other_profile_line_header : profile_line_headers) {
+ for (const ProfileLineHeader other_profile_line_header : profile_line_headers) {
if (!filter_fn(other_profile_line_header.dex_location, other_profile_line_header.checksum)) {
continue;
}
diff --git a/profman/profman.cc b/profman/profman.cc
index 9b47097..5fbce66 100644
--- a/profman/profman.cc
+++ b/profman/profman.cc
@@ -389,7 +389,7 @@
}
bool OpenApkFilesFromLocations(
- const std::function<void(std::unique_ptr<const DexFile>&&)>& process_fn) {
+ std::function<void(std::unique_ptr<const DexFile>&&)> process_fn) {
bool use_apk_fd_list = !apks_fd_.empty();
if (use_apk_fd_list) {
// Get the APKs from the collection of FDs.
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index cbd9880..10fa8c5 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -1822,7 +1822,7 @@
std::string ConcurrentCopying::DumpReferenceInfo(mirror::Object* ref,
const char* ref_name,
- const char* indent) {
+ std::string indent) {
std::ostringstream oss;
oss << indent << heap_->GetVerification()->DumpObjectInfo(ref, ref_name) << '\n';
if (ref != nullptr) {
@@ -1846,13 +1846,13 @@
MemberOffset offset,
mirror::Object* ref) {
std::ostringstream oss;
- constexpr const char* kIndent = " ";
- oss << kIndent << "Invalid reference: ref=" << ref
+ std::string indent = " ";
+ oss << indent << "Invalid reference: ref=" << ref
<< " referenced from: object=" << obj << " offset= " << offset << '\n';
// Information about `obj`.
- oss << DumpReferenceInfo(obj, "obj", kIndent) << '\n';
+ oss << DumpReferenceInfo(obj, "obj", indent) << '\n';
// Information about `ref`.
- oss << DumpReferenceInfo(ref, "ref", kIndent);
+ oss << DumpReferenceInfo(ref, "ref", indent);
return oss.str();
}
@@ -1928,10 +1928,10 @@
std::string ConcurrentCopying::DumpGcRoot(mirror::Object* ref) {
std::ostringstream oss;
- constexpr const char* kIndent = " ";
- oss << kIndent << "Invalid GC root: ref=" << ref << '\n';
+ std::string indent = " ";
+ oss << indent << "Invalid GC root: ref=" << ref << '\n';
// Information about `ref`.
- oss << DumpReferenceInfo(ref, "ref", kIndent);
+ oss << DumpReferenceInfo(ref, "ref", indent);
return oss.str();
}
diff --git a/runtime/gc/collector/concurrent_copying.h b/runtime/gc/collector/concurrent_copying.h
index 448525d..f1e7e2f 100644
--- a/runtime/gc/collector/concurrent_copying.h
+++ b/runtime/gc/collector/concurrent_copying.h
@@ -242,7 +242,7 @@
REQUIRES_SHARED(Locks::mutator_lock_);
// Dump information about reference `ref` and return it as a string.
// Use `ref_name` to name the reference in messages. Each message is prefixed with `indent`.
- std::string DumpReferenceInfo(mirror::Object* ref, const char* ref_name, const char* indent = "")
+ std::string DumpReferenceInfo(mirror::Object* ref, const char* ref_name, std::string indent = "")
REQUIRES_SHARED(Locks::mutator_lock_);
// Dump information about heap reference `ref`, referenced from object `obj` at offset `offset`,
// and return it as a string.
diff --git a/runtime/subtype_check_info_test.cc b/runtime/subtype_check_info_test.cc
index e40bca5..91fcc07 100644
--- a/runtime/subtype_check_info_test.cc
+++ b/runtime/subtype_check_info_test.cc
@@ -121,11 +121,11 @@
return SubtypeCheckInfo::MakeUnchecked(bs, overflow, depth);
}
- static bool HasNext(const SubtypeCheckInfo& io) {
+ static bool HasNext(SubtypeCheckInfo io) {
return io.HasNext();
}
- static BitString GetPathToRoot(const SubtypeCheckInfo& io) {
+ static BitString GetPathToRoot(SubtypeCheckInfo io) {
return io.GetPathToRoot();
}
diff --git a/runtime/subtype_check_test.cc b/runtime/subtype_check_test.cc
index 666bf81..979fa42 100644
--- a/runtime/subtype_check_test.cc
+++ b/runtime/subtype_check_test.cc
@@ -654,15 +654,13 @@
MockClass* klass,
size_t cur_depth,
size_t total_depth,
- const std::vector<std::pair<SubtypeCheckInfo::State, SubtypeCheckInfo::State>>& transitions) {
+ std::vector<std::pair<SubtypeCheckInfo::State, SubtypeCheckInfo::State>> transitions) {
MockScopedLockSubtypeCheck lock_a;
MockScopedLockMutator lock_b;
using SCTree = MockSubtypeCheck;
ASSERT_EQ(cur_depth, klass->Depth());
- ApplyTransition(SCTree::Lookup(klass),
- transitions[cur_depth].first,
- transitions[cur_depth].second);
+ ApplyTransition(SCTree::Lookup(klass), transitions[cur_depth].first, transitions[cur_depth].second);
if (total_depth == cur_depth + 1) {
return;
@@ -678,7 +676,7 @@
void EnsureStateChangedTest(
MockClass* root,
size_t depth,
- const std::vector<std::pair<SubtypeCheckInfo::State, SubtypeCheckInfo::State>>& transitions) {
+ std::vector<std::pair<SubtypeCheckInfo::State, SubtypeCheckInfo::State>> transitions) {
ASSERT_EQ(depth, transitions.size());
EnsureStateChangedTestRecursive(root, /*cur_depth*/0u, depth, transitions);
diff --git a/sigchainlib/sigchain_test.cc b/sigchainlib/sigchain_test.cc
index 9584ded..1d1e54f 100644
--- a/sigchainlib/sigchain_test.cc
+++ b/sigchainlib/sigchain_test.cc
@@ -70,7 +70,7 @@
};
-static void TestSignalBlocking(const std::function<void()>& fn) {
+static void TestSignalBlocking(std::function<void()> fn) {
// Unblock SIGSEGV, make sure it stays unblocked.
sigset64_t mask;
sigemptyset64(&mask);
diff --git a/tools/wrapagentproperties/wrapagentproperties.cc b/tools/wrapagentproperties/wrapagentproperties.cc
index 77e19e6..8b4b062 100644
--- a/tools/wrapagentproperties/wrapagentproperties.cc
+++ b/tools/wrapagentproperties/wrapagentproperties.cc
@@ -245,7 +245,7 @@
static jint CallNextAgent(StartType start,
ProxyJavaVM* vm,
- const std::string& options,
+ std::string options,
void* reserved) {
// TODO It might be good to set it up so that the library is unloaded even if no jvmtiEnv's are
// created but this isn't expected to be common so we will just not bother.