From b3e66dfcd069db8818cd902d787ff1d7bbca45f2 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 12 Jan 2012 14:49:18 -0800 Subject: Minor fixes. Fix a crash when shutting down if a daemon thread suspended while holding the heap lock. For some reason, presumably involving extra daemon threads, CTS hits this a lot. Silently ignore a couple of dalvikvm options for backwards compatibility. This makes CTS less noisy. Remove redundant parentheses that would make it easy for us to introduce a ==/= bug. Change-Id: Id44eab29ce393a85585459c280ad47c5a5c749b9 --- src/dalvik_system_DexFile.cc | 2 +- src/heap.cc | 5 ++++- src/runtime.cc | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dalvik_system_DexFile.cc b/src/dalvik_system_DexFile.cc index de3e6d6c10..a14f1241ef 100644 --- a/src/dalvik_system_DexFile.cc +++ b/src/dalvik_system_DexFile.cc @@ -144,7 +144,7 @@ static jint DexFile_openDexFile(JNIEnv* env, jclass, jstring javaSourceName, jst static const DexFile* toDexFile(JNIEnv* env, int dex_file_address) { const DexFile* dex_file = reinterpret_cast(static_cast(dex_file_address)); - if ((dex_file == NULL)) { + if (dex_file == NULL) { jniThrowNullPointerException(env, "dex_file == null"); } return dex_file; diff --git a/src/heap.cc b/src/heap.cc index fe5ca7a90d..1efc956452 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -146,7 +146,10 @@ void Heap::Init(size_t initial_size, size_t maximum_size, size_t growth_size, } void Heap::Destroy() { - ScopedHeapLock lock; + // We can't take the heap lock here because there might be a daemon thread suspended with the + // heap lock held. We know though that no non-daemon threads are executing, and we know that + // all daemon threads are suspended, and we also know that the threads list have been deleted, so + // those threads can't resume. We're the only running thread, and we can do whatever we like... STLDeleteElements(&spaces_); if (mark_bitmap_ != NULL) { delete mark_bitmap_; diff --git a/src/runtime.cc b/src/runtime.cc index 4d95b4b01d..e9d5677aab 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -386,6 +386,8 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b parsed->hook_abort_ = reinterpret_cast(options[i].second); } else if (option == "host-prefix") { parsed->host_prefix_ = reinterpret_cast(options[i].second); + } else if (option == "-Xgenregmap" || option == "-Xgc:precise") { + // We silently ignore these for backwards compatibility. } else { if (!ignore_unrecognized) { // TODO: print usage via vfprintf -- cgit v1.2.3-59-g8ed1b