summaryrefslogtreecommitdiffstats
path: root/runtime/dex_file_test.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2014-09-05 14:01:17 +0100
committerVladimir Marko <vmarko@google.com>2014-09-10 16:02:14 +0100
commitaa4497db59f1eeec954f2ba5da6d458fcdf9b3a4 (patch)
tree1efe5c6c5fe93ae73b6ad02db1a4ac368c71c00e /runtime/dex_file_test.cc
parent6724a9531c92368491dd17937d0087f73a7c0642 (diff)
downloadart-aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4.zip
art-aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4.tar.gz
art-aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4.tar.bz2
Improve dex location canonicalization-related performance.
Eagerly add canonical dex file locations to the OatFile's primary lookup map in Setup(). This moves the boot.oat work from every app startup to the zygote initialization. Since we always ended up initializing the canonical location map anyway due to the way that we're loading dex files, the lazy initialization didn't save anything. Clean up dex file name canonicalization to make sure we free() the memory returned by realpath() rather than using std::unique_ptr<> with the default deleter. Avoid some unnecessary duplicate OatDexFile lookups. Bug: 16828525 Bug: 17346103 Change-Id: Id8fbc8992f62996138eb2006a0046c6529747c09
Diffstat (limited to 'runtime/dex_file_test.cc')
-rw-r--r--runtime/dex_file_test.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/runtime/dex_file_test.cc b/runtime/dex_file_test.cc
index 330d045..d0c5603 100644
--- a/runtime/dex_file_test.cc
+++ b/runtime/dex_file_test.cc
@@ -355,8 +355,8 @@ TEST_F(DexFileTest, GetMultiDexClassesDexName) {
TEST_F(DexFileTest, GetDexCanonicalLocation) {
ScratchFile file;
- char* dex_location_real = realpath(file.GetFilename().c_str(), nullptr);
- std::string dex_location(dex_location_real);
+ UniqueCPtr<const char[]> dex_location_real(realpath(file.GetFilename().c_str(), nullptr));
+ std::string dex_location(dex_location_real.get());
ASSERT_EQ(dex_location, DexFile::GetDexCanonicalLocation(dex_location.c_str()));
std::string multidex_location = DexFile::GetMultiDexClassesDexName(1, dex_location.c_str());
@@ -371,8 +371,6 @@ TEST_F(DexFileTest, GetDexCanonicalLocation) {
ASSERT_EQ(multidex_location, DexFile::GetDexCanonicalLocation(multidex_location_sym.c_str()));
ASSERT_EQ(0, unlink(dex_location_sym.c_str()));
-
- free(dex_location_real);
}
} // namespace art