Remove cruft in the default libdvm.so and add 3 more special targets.

The idea is similar to having libc.so as the default/optimal build and
libc_debug.so at a handy place.

libdvm.so       : default build to be installed with JIT on and assertion off.
libdvm_interp.so: JIT statically compiled out and assertion off.
libdvm_assert.so: assert/JIT-tuning enabled.
libdvm_sv.so    : assert/JIT-self-verification enabled.

Compile time of "mmm dalvik" from clean build with -j1:

real    2m36.144s
user    2m23.029s
sys     0m12.253s

Compile time of "mmm dalvik" from touching Interp.c with -j1:

real    0m8.493s
user    0m7.416s
sys     0m1.280s

Code size:

638152 Nov  3 16:17 libdvm.so
785604 Nov  3 16:17 libdvm_assert.so
556888 Nov  3 16:17 libdvm_interp.so
793804 Nov  3 16:17 libdvm_sv.so
diff --git a/vm/Android.mk b/vm/Android.mk
index bbb5cd1..5a74c92 100644
--- a/vm/Android.mk
+++ b/vm/Android.mk
@@ -30,28 +30,50 @@
 # Build for the target (device).
 #
 
-include $(CLEAR_VARS)
+# Build the installed version (libdvm.so) first
+include $(LOCAL_PATH)/ReconfigureDvm.mk
 
-# Variables used in the included Dvm.mk.
-dvm_os := $(TARGET_OS)
-dvm_arch := $(TARGET_ARCH)
-dvm_arch_variant := $(TARGET_ARCH_VARIANT)
-dvm_simulator := $(TARGET_SIMULATOR)
-
-include $(LOCAL_PATH)/Dvm.mk
-
-# Whether libraries are static or shared differs between host and
-# target builds, so that's mostly pulled out here and in the equivalent
-# section below.
-LOCAL_SHARED_LIBRARIES += \
-	liblog libcutils libnativehelper libz
-
-LOCAL_STATIC_LIBRARIES += libdex
-
+# Overwrite default settings
+ifeq ($(TARGET_SIMULATOR),false)
+    LOCAL_PRELINK_MODULE := true
+endif
+LOCAL_MODULE_TAGS := user
 LOCAL_MODULE := libdvm
-
 include $(BUILD_SHARED_LIBRARY)
 
+# If WITH_JIT is configured, build multiple versions of libdvm.so to facilitate
+# correctness/performance bugs triage
+ifeq ($(WITH_JIT),true)
+
+    # Derivation #1
+    # Enable assert and JIT tuning
+    include $(LOCAL_PATH)/ReconfigureDvm.mk
+
+    # Enable asserion and JIT-tuning
+    LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT \
+				    -DWITH_JIT_TUNING -DEXIT_STATS
+    LOCAL_MODULE := libdvm_assert
+    include $(BUILD_SHARED_LIBRARY)
+
+    # Derivation #2
+    # Enable assert and self-verification
+    include $(LOCAL_PATH)/ReconfigureDvm.mk
+
+    # Enable asserion and JIT self-verification
+    LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT \
+					-DWITH_SELF_VERIFICATION
+    LOCAL_MODULE := libdvm_sv
+    include $(BUILD_SHARED_LIBRARY)
+
+    # Devivation #3
+    # Compile out the JIT
+    WITH_JIT := false
+    include $(LOCAL_PATH)/ReconfigureDvm.mk
+
+    LOCAL_MODULE := libdvm_interp
+    include $(BUILD_SHARED_LIBRARY)
+
+endif
 
 #
 # Build for the host.
diff --git a/vm/Dvm.mk b/vm/Dvm.mk
index 96340a2..fa23866 100644
--- a/vm/Dvm.mk
+++ b/vm/Dvm.mk
@@ -198,9 +198,6 @@
 
 ifeq ($(WITH_JIT),true)
   LOCAL_CFLAGS += -DWITH_JIT
-  # Enable assert and JIT_TUNING for now
-  LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
-  WITH_JIT_TUNING := true
   LOCAL_SRC_FILES += \
 	../dexdump/OpCodeNames.c \
 	compiler/Compiler.c \
@@ -213,16 +210,6 @@
 	interp/Jit.c
 endif
 
-ifeq ($(strip $(WITH_JIT_TUNING)),true)
-  LOCAL_CFLAGS += -DWITH_JIT_TUNING
-endif
-
-# Enable JIT self verification tool. Runs compiled traces natively, then replays
-# them with the interpreter, and ensures memory and register state are the same.
-ifeq ($(WITH_SELF_VERIFICATION),true)
-  LOCAL_CFLAGS += -DWITH_SELF_VERIFICATION
-endif
-
 WITH_HPROF := $(strip $(WITH_HPROF))
 ifeq ($(WITH_HPROF),)
   WITH_HPROF := true
diff --git a/vm/ReconfigureDvm.mk b/vm/ReconfigureDvm.mk
new file mode 100644
index 0000000..62a0e0f
--- /dev/null
+++ b/vm/ReconfigureDvm.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include $(CLEAR_VARS)
+
+# Variables used in the included Dvm.mk.
+dvm_os := $(TARGET_OS)
+dvm_arch := $(TARGET_ARCH)
+dvm_arch_variant := $(TARGET_ARCH_VARIANT)
+dvm_simulator := $(TARGET_SIMULATOR)
+
+include $(LOCAL_PATH)/Dvm.mk
+
+LOCAL_SHARED_LIBRARIES += \
+        liblog libcutils libnativehelper libz
+
+LOCAL_STATIC_LIBRARIES += libdex
+
+# Don't prelink by default
+LOCAL_PRELINK_MODULE := false
+
+# Don't install on any build by default
+LOCAL_MODULE_TAGS := optional
diff --git a/vm/compiler/codegen/arm/Assemble.c b/vm/compiler/codegen/arm/Assemble.c
index b390885..bc39479 100644
--- a/vm/compiler/codegen/arm/Assemble.c
+++ b/vm/compiler/codegen/arm/Assemble.c
@@ -1481,6 +1481,8 @@
                     break;
 #endif
                 default:
+                    targetOffset = 0; // make gcc happy
+                    LOGE("Unexpected chaining type: %d", i);
                     dvmAbort();
             }
             COMPILER_TRACE_CHAINING(