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;
if (opc != NULL) {
dexoptFlags |= DEXOPT_GEN_REGISTER_MAPS;
}
+
+ opc = strstr(dexoptFlagStr, "u="); /* uniprocessor target */
+ if (opc != NULL) {
+ switch (*(opc+2)) {
+ case 'y': dexoptFlags |= DEXOPT_UNIPROCESSOR; break;
+ case 'n': dexoptFlags |= DEXOPT_SMP; break;
+ default: break;
+ }
+ }
}
+
+ /*
+ * Prep the VM and perform the optimization.
+ */
+
if (dvmPrepForDexOpt(bootClassPath, dexOptMode, verifyMode,
dexoptFlags) != 0)
{
if (matchOffset > 0 && bcp[matchOffset-1] == ':')
matchOffset--;
LOGV("DexOptZ: found '%s' in bootclasspath, cutting off at %d\n",
- inputFileName, matchOffset);
+ zipName, matchOffset);
bcpCopy = strdup(bcp);
bcpCopy[matchOffset] = '\0';
const char* outName = argv[3];
const char* dexoptFlags = argv[4];
+ if (strstr(dexoptFlags, "u=y") == NULL &&
+ strstr(dexoptFlags, "u=n") == NULL)
+ {
+ fprintf(stderr, "Either 'u=y' or 'u=n' must be specified\n");
+ goto bail;
+ }
+
zipFd = open(zipName, O_RDONLY);
if (zipFd < 0) {
perror(argv[0]);
bool onlyOptVerifiedDex = false;
DexClassVerifyMode verifyMode;
DexOptimizerMode dexOptMode;
- int dexoptFlags = 0;
/* ugh -- upgrade these to a bit field if they get any more complex */
if ((flags & DEXOPT_VERIFY_ENABLED) != 0) {
} else {
dexOptMode = OPTIMIZE_MODE_NONE;
}
- if ((flags & DEXOPT_GEN_REGISTER_MAP) != 0) {
- dexoptFlags |= DEXOPT_GEN_REGISTER_MAPS;
- }
- if (dvmPrepForDexOpt(bootClassPath, dexOptMode, verifyMode,
- dexoptFlags) != 0)
- {
+ if (dvmPrepForDexOpt(bootClassPath, dexOptMode, verifyMode, flags) != 0) {
LOGE("VM init failed\n");
goto bail;
}