summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk2
-rw-r--r--src/dalvik_system_DexFile.cc27
2 files changed, 28 insertions, 1 deletions
diff --git a/Android.mk b/Android.mk
index 4086c2f1c4..2dd2d8f8cc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -127,7 +127,7 @@ OAT_TARGET_TARGETS :=
define declare-oat-target-target
.PHONY: oat-target-$(1)
oat-target-$(1): $(PRODUCT_OUT)/$(1) $(TARGET_BOOT_IMG_OUT) $(DEX2OAT_DEPENDENCY)
- $(DEX2OAT) --runtime-arg -Xms64m --runtime-arg -Xmx64m --boot-image=$(TARGET_BOOT_IMG_OUT) --dex-file=$(PRODUCT_OUT)/$(1) --dex-location=$(1) --oat-file=$(call art-cache-out,$(1).oat) --host-prefix=$(PRODUCT_OUT)
+ $(DEX2OAT) --runtime-arg -Xms64m --runtime-arg -Xmx64m --boot-image=$(TARGET_BOOT_IMG_OUT) --dex-file=$(PRODUCT_OUT)/$(1) --dex-location=/$(1) --oat-file=$(call art-cache-out,$(1).oat) --host-prefix=$(PRODUCT_OUT)
OAT_TARGET_TARGETS += oat-target-$(1)
endef
diff --git a/src/dalvik_system_DexFile.cc b/src/dalvik_system_DexFile.cc
index f6568a7555..c76877657f 100644
--- a/src/dalvik_system_DexFile.cc
+++ b/src/dalvik_system_DexFile.cc
@@ -165,12 +165,16 @@ jobjectArray DexFile_getClassNameList(JNIEnv* env, jclass, jint cookie) {
}
jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename) {
+ bool debug_logging = false;
+
ScopedUtfChars filename(env, javaFilename);
if (filename.c_str() == NULL) {
+ LOG(ERROR) << "DexFile_isDexOptNeeded null filename";
return JNI_TRUE;
}
if (!OS::FileExists(filename.c_str())) {
+ LOG(ERROR) << "DexFile_isDexOptNeeded file '" << filename.c_str() << "' does not exist";
jniThrowExceptionFmt(env, "java/io/FileNotFoundException", "%s", filename.c_str());
return JNI_TRUE;
}
@@ -181,6 +185,9 @@ jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename) {
const std::vector<const DexFile*>& boot_class_path = class_linker->GetBootClassPath();
for (size_t i = 0; i < boot_class_path.size(); i++) {
if (boot_class_path[i]->GetLocation() == filename.c_str()) {
+ if (debug_logging) {
+ LOG(INFO) << "DexFile_isDexOptNeeded ignoring boot class path file: " << filename.c_str();
+ }
return JNI_FALSE;
}
}
@@ -191,6 +198,9 @@ jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename) {
std::string oat_filename(OatFile::DexFilenameToOatFilename(filename.c_str()));
const OatFile* oat_file = class_linker->FindOatFileFromOatLocation(oat_filename);
if (oat_file != NULL && oat_file->GetOatDexFile(filename.c_str()) != NULL) {
+ if (debug_logging) {
+ LOG(INFO) << "DexFile_isDexOptNeeded ignoring precompiled file: " << filename.c_str();
+ }
return JNI_FALSE;
}
@@ -198,23 +208,40 @@ jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename) {
std::string cache_location(GetArtCacheFilenameOrDie(oat_filename));
oat_file = class_linker->FindOatFileFromOatLocation(cache_location);
if (oat_file == NULL) {
+ LOG(INFO) << "DexFile_isDexOptNeeded cache file " << cache_location
+ << " does not exist for " << filename.c_str();
return JNI_TRUE;
}
const OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(filename.c_str());
if (oat_dex_file == NULL) {
+ LOG(ERROR) << "DexFile_isDexOptNeeded cache file " << cache_location
+ << " does not contain contents for " << filename.c_str();
+ std::vector<const OatFile::OatDexFile*> oat_dex_files = oat_file->GetOatDexFiles();
+ for (size_t i = 0; i < oat_dex_files.size(); i++) {
+ const OatFile::OatDexFile* oat_dex_file = oat_dex_files[i];
+ LOG(ERROR) << "DexFile_isDexOptNeeded cache file " << cache_location
+ << " contains contents for " << oat_dex_file->GetDexFileLocation();
+ }
return JNI_TRUE;
}
uint32_t location_checksum;
if (!DexFile::GetChecksum(filename.c_str(), location_checksum)) {
+ LOG(ERROR) << "DexFile_isDexOptNeeded failed to compute checksum of " << filename.c_str();
return JNI_TRUE;
}
if (location_checksum != oat_dex_file->GetDexFileLocationChecksum()) {
+ LOG(INFO) << "DexFile_isDexOptNeeded cache file " << cache_location
+ << " has out-of-date checksum compared to " << filename.c_str();
return JNI_TRUE;
}
+ if (debug_logging) {
+ LOG(INFO) << "DexFile_isDexOptNeeded cache file " << cache_location
+ << " is up-to-date for " << filename.c_str();
+ }
return JNI_FALSE;
}