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
diff --git a/src/dalvik_system_DexFile.cc b/src/dalvik_system_DexFile.cc
index de3e6d6..a14f124 100644
--- a/src/dalvik_system_DexFile.cc
+++ b/src/dalvik_system_DexFile.cc
@@ -144,7 +144,7 @@
 
 static const DexFile* toDexFile(JNIEnv* env, int dex_file_address) {
   const DexFile* dex_file = reinterpret_cast<const DexFile*>(static_cast<uintptr_t>(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 fe5ca7a..1efc956 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -146,7 +146,10 @@
 }
 
 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 4d95b4b..e9d5677 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -386,6 +386,8 @@
       parsed->hook_abort_ = reinterpret_cast<void(*)()>(options[i].second);
     } else if (option == "host-prefix") {
       parsed->host_prefix_ = reinterpret_cast<const char*>(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