dexopt flags

Bytecode Verification

  • verification v=
    • v=n VERIFY_MODE_NONE
    • v=r VERIFY_MODE_REMOTE
    • v=a VERIFY_MODE_ALL (default)
  • optimization o=
    • o=n OPTIMIZE_MODE_NONE
    • o=v OPTIMIZE_MODE_VERIFIED (default) only optimizes classes that successfully verified
    • o=a OPTIMIZE_MODE_ALL
    • o=f OPTIMIZE_MODE_FULL
  • register map m=y
  • uniprocessor target u=
    • u=y DEXOPT_UNIPROCESSOR
    • u=n DEXOPT_SMP
setprop dalvik.vm.dexopt-flags=m=y,o=v,u=y
setprop dalvik.vm.dexopt-flags "m=y,o=f,v=n"
setprop dalvik.vm.dexopt-flags "m=y"
setprop dalvik.vm.dexopt-flags "v=n,o=v"

dalvik

http://milk.com/kodebase/dalvik-docs-mirror/docs/embedded-vm-control.html

# dalvikvm --help
The following extended options are recognized:
  -Xrunjdwp:<options>
  -Xbootclasspath:bootclasspath
  -Xcheck:tag  (e.g. 'jni')
  -XmsN  (min heap, must be multiple of 1K, >= 1MB)
  -XmxN  (max heap, must be multiple of 1K, >= 2MB)
  -XssN  (stack size, >= 1KB, <= 256KB)
  -Xverify:{none,remote,all}
  -Xrs
  -Xint  (extended to accept ':portable', ':fast' and ':jit')
 
These are unique to Dalvik:
  -Xzygote
  -Xdexopt:{none,verified,all,full}
  -Xnoquithandler
  -Xjnigreflimit:N  (must be multiple of 100, >= 200)
  -Xjniopts:{warnonly,forcecopy}
  -Xjnitrace:substring (eg NativeClass or nativeMethod)
  -Xstacktracefile:<filename>
  -Xgc:[no]precise
  -Xgc:[no]preverify
  -Xgc:[no]postverify
  -Xgc:[no]concurrent
  -Xgc:[no]verifycardtable
  -XX:+DisableExplicitGC
  -X[no]genregmap
  -Xverifyopt:[no]checkmon
  -Xcheckdexsum
  -Xincludeselectedop
  -Xjitop:hexopvalue[-endvalue][,hexopvalue[-endvalue]]*
  -Xincludeselectedmethod
  -Xjitthreshold:decimalvalue
  -Xjitblocking
  -Xjitmethod:signature[,signature]* (eg Ljava/lang/String\;replace)
  -Xjitcheckcg
  -Xjitverbose
  -Xjitprofile
  -Xjitdisableopt
  -Xjitsuspendpoll

Interpreter

  • portable dalvik.vm.execution-mode=int:portable
  • fast dalvik.vm.execution-mode=int:fast
  • JIT dalvik.vm.execution-mode=int:jit

Not all platforms have an optimized implementation. In such cases, the “fast” interpreter is generated as a series of C stubs, and the result will be slower than the “portable” version

Extended JNI Checks

Default RO: ro.kernel.android.checkjni can be overriden by: dalvik.vm.checkjni

setprop dalvik.vm.checkjni true

To pass dalvik.vm.jniopts option as -Xjniopts argument.

setprop dalvik.vm.jniopts forcecopy

Stack size

setprop dalvik.vm.extra-opts "-Xss16K"

dalvik.vm.verify-bytecode false

# DISABLE ERROR CHECKING
ro.kernel.android.checkjni=0
 
dalvik.vm.checkjni=false
dalvik.vm.dexopt-data-only=1
dalvik.vm.heapsize=64m
dalvik.vm.verify-bytecode=false
dalvik.vm.lockprof.threshold=250
dalvik.vm.dexopt-flags=m=v,o=y
-Xverify:none -Xdexopt:verified
 
dalvik.vm.stack-trace-file=/data/anr/traces.txt
dalvik.vm.jmiopts=forcecopy

# MAKES APPS LOAD FASTER AND FREES MORE RAM / use only one of them dalvik.vm.dexopt-flags=v=a,o=v,m=y,u=y dalvik.vm.dexopt-flags m=y,o=v,u=y dalvik.vm.dexopt-flags=m=y