Plumb SMP optimization control through to dexopt.

Change-Id: I3bfaf6723e7b14d001f9de60cc1c1fd4f8e1ed99
diff --git a/dexopt/OptMain.c b/dexopt/OptMain.c
index ca55565..fbb7947 100644
--- a/dexopt/OptMain.c
+++ b/dexopt/OptMain.c
@@ -125,12 +125,12 @@
         goto bail;
     }
 
-    /*
-     * Prep the VM and perform the optimization.
-     */
+    /* Parse the options. */
+
     DexClassVerifyMode verifyMode = VERIFY_MODE_ALL;
     DexOptimizerMode dexOptMode = OPTIMIZE_MODE_VERIFIED;
     int dexoptFlags = 0;        /* bit flags, from enum DexoptFlags */
+
     if (dexoptFlagStr[0] != '\0') {
         const char* opc;
         const char* val;
@@ -159,7 +159,17 @@
         if (opc != NULL) {
             dexoptFlags |= DEXOPT_GEN_REGISTER_MAPS;
         }
+
+        opc = strstr(dexoptFlagStr, "u=y");     /* uniprocessor target */
+        if (opc != NULL) {
+            dexoptFlags |= DEXOPT_UNIPROCESSOR;
+        }
     }
+
+    /*
+     * Prep the VM and perform the optimization.
+     */
+
     if (dvmPrepForDexOpt(bootClassPath, dexOptMode, verifyMode,
             dexoptFlags) != 0)
     {
diff --git a/vm/Init.c b/vm/Init.c
index 24513f3..7fbce32 100644
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -1528,6 +1528,7 @@
     gDvm.dexOptMode = dexOptMode;
     gDvm.classVerifyMode = verifyMode;
     gDvm.generateRegisterMaps = (dexoptFlags & DEXOPT_GEN_REGISTER_MAPS) != 0;
+    gDvm.dexOptForSmp = (dexoptFlags & DEXOPT_UNIPROCESSOR) == 0;
 
     /*
      * Initialize the heap, some basic thread control mutexes, and
diff --git a/vm/analysis/DexPrepare.h b/vm/analysis/DexPrepare.h
index ae94979..c014055 100644
--- a/vm/analysis/DexPrepare.h
+++ b/vm/analysis/DexPrepare.h
@@ -34,6 +34,7 @@
 /* some additional bit flags for dexopt */
 enum DexoptFlags {
     DEXOPT_GEN_REGISTER_MAPS = 1, /* generate register maps during verify */
+    DEXOPT_UNIPROCESSOR = 1 << 1, /* assume a uniprocessor target */
 };
 
 /*