OSDN Git Service

Plumb SMP optimization control through to dexopt.
authorDan Bornstein <danfuzz@android.com>
Tue, 28 Sep 2010 22:46:54 +0000 (15:46 -0700)
committerDan Bornstein <danfuzz@android.com>
Tue, 28 Sep 2010 22:57:50 +0000 (15:57 -0700)
Change-Id: I3bfaf6723e7b14d001f9de60cc1c1fd4f8e1ed99

dexopt/OptMain.c
vm/Init.c
vm/analysis/DexPrepare.h

index ca55565..fbb7947 100644 (file)
@@ -125,12 +125,12 @@ static int extractAndProcessZip(int zipFd, int cacheFd,
         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 @@ static int extractAndProcessZip(int zipFd, int cacheFd,
         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)
     {
index 24513f3..7fbce32 100644 (file)
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -1528,6 +1528,7 @@ int dvmPrepForDexOpt(const char* bootClassPath, DexOptimizerMode dexOptMode,
     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
index ae94979..c014055 100644 (file)
@@ -34,6 +34,7 @@ typedef enum DexOptimizerMode {
 /* 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 */
 };
 
 /*