diff options
| author | 2012-01-11 12:07:31 -0800 | |
|---|---|---|
| committer | 2012-01-11 12:07:31 -0800 | |
| commit | ed93b2ea571a49748960766a860c16ac74dec327 (patch) | |
| tree | 1702db898a21740e084980fca92ff3ecf84106b0 | |
| parent | 871fa11877f3bf5348f8de5062db9ac80957d677 (diff) | |
| parent | 725aee5889a9e57c08689f6c1cb9763e8d1fd377 (diff) | |
Merge "Fixes for 071-dexfile" into dalvik-dev
| -rw-r--r-- | src/class_linker.cc | 4 | ||||
| -rw-r--r-- | src/dalvik_system_DexFile.cc | 6 | ||||
| -rw-r--r-- | test/068-classloader/src/FancyLoader.java | 6 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/class_linker.cc b/src/class_linker.cc index 1a9618c617..1c9f064d84 100644 --- a/src/class_linker.cc +++ b/src/class_linker.cc @@ -608,6 +608,10 @@ bool ClassLinker::GenerateOatFile(const std::string& dex_filename, pid_t pid = fork(); if (pid == 0) { // no allocation allowed between fork and exec + + // change process groups, so we don't get reaped by ProcessManager + setpgid(0, 0); + execl(dex2oat, dex2oat, "--runtime-arg", "-Xms64m", "--runtime-arg", "-Xmx64m", diff --git a/src/dalvik_system_DexFile.cc b/src/dalvik_system_DexFile.cc index 41110d34c1..de3e6d6c10 100644 --- a/src/dalvik_system_DexFile.cc +++ b/src/dalvik_system_DexFile.cc @@ -104,31 +104,37 @@ static jint DexFile_openDexFile(JNIEnv* env, jclass, jstring javaSourceName, jst ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); UniquePtr<File> file(OS::OpenFile(outputName.c_str(), true)); if (file.get() == NULL) { + LOG(WARNING) << "unable to create oat file: " << outputName.c_str(); jniThrowExceptionFmt(env, "java/io/IOException", "unable to create oat file: %s", outputName.c_str()); return 0; } if (!class_linker->GenerateOatFile(sourceName.c_str(), file->Fd(), outputName.c_str())) { + LOG(WARNING) << "unable to generate oat file: " << outputName.c_str(); jniThrowExceptionFmt(env, "java/io/IOException", "unable to generate oat file: %s", outputName.c_str()); return 0; } UniquePtr<OatFile> oat_file(OatFile::Open(outputName.c_str(), "", NULL)); if (oat_file.get() == NULL) { + LOG(WARNING) << "unable to open oat file: " << outputName.c_str(); jniThrowExceptionFmt(env, "java/io/IOException", "unable to open oat file: %s", outputName.c_str()); return 0; } const OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(sourceName.c_str()); if (oat_dex_file == NULL) { + LOG(WARNING) << "unable to find dex file in oat file: " << outputName.c_str(); jniThrowExceptionFmt(env, "java/io/IOException", "unable to find dex file in oat file: %s", outputName.c_str()); return 0; } + Runtime::Current()->GetClassLinker()->RegisterOatFile(*oat_file.release()); dex_file = oat_dex_file->OpenDexFile(); } if (dex_file == NULL) { + LOG(WARNING) << "unable to open dex file: " << sourceName.c_str(); jniThrowExceptionFmt(env, "java/io/IOException", "unable to open dex file: %s", sourceName.c_str()); return 0; diff --git a/test/068-classloader/src/FancyLoader.java b/test/068-classloader/src/FancyLoader.java index 173b08f567..28c17a814c 100644 --- a/test/068-classloader/src/FancyLoader.java +++ b/test/068-classloader/src/FancyLoader.java @@ -35,10 +35,10 @@ import java.lang.reflect.InvocationTargetException; */ public class FancyLoader extends ClassLoader { /* this is where the "alternate" .class files live */ - static final String CLASS_PATH = "classes-ex/"; + static final String CLASS_PATH = "/data/art-test"; /* this is the "alternate" DEX/Jar file */ - static final String DEX_FILE = "test-ex.jar"; + static final String DEX_FILE = "068-classloader-ex.jar"; /* on Dalvik, this is a DexFile; otherwise, it's null */ private Class mDexClass; @@ -94,7 +94,7 @@ public class FancyLoader extends ClassLoader { } try { - mDexFile = ctor.newInstance(DEX_FILE); + mDexFile = ctor.newInstance(CLASS_PATH + File.separator + DEX_FILE); } catch (InstantiationException ie) { throw new ClassNotFoundException("newInstance failed", ie); } catch (IllegalAccessException iae) { |