我没有找到这些选项的详细文档。
查看源代码后,这些选项是:
- 精确:VM 线程堆栈中的每个项目可能只是整数或内部值或对象指针。并且为了注册这些信息,堆栈线程有一个寄存器映射来标记项目的状态。如果它是打开的,只有对象会被标记,这被称为精确/无小心 GC
- xxx-verify:用于 vm GC 验证步骤
- concurrent: 打开/关闭 GC 并发标记扫描步骤
- ExplicitGC:打开/关闭 java API Runtime.gc() 或信号 GC。
以下是详细信息:
在 dalvik 源代码中,这些选项用于配置 dalvikvm GC:
} else if (strncmp(argv[i], "-Xgc:", 5) == 0) {
//In VM thread, there is a register map for marking each stack item's status whether it is an object or internal value. And In GC step, only object item will be marked. If this value is OFF, all stack will be marked even if the item is only an integer.
if (strcmp(argv[i] + 5, "precise") == 0)
gDvm.preciseGc = true;
else if (strcmp(argv[i] + 5, "noprecise") == 0)
gDvm.preciseGc = false;
//Only for GC verify check
else if (strcmp(argv[i] + 5, "preverify") == 0)
gDvm.preVerify = true;
else if (strcmp(argv[i] + 5, "nopreverify") == 0)
gDvm.preVerify = false;
else if (strcmp(argv[i] + 5, "postverify") == 0)
gDvm.postVerify = true;
else if (strcmp(argv[i] + 5, "nopostverify") == 0)
gDvm.postVerify = false;
//Open/Close Dalvik vm GC markseep is concurrent or not
else if (strcmp(argv[i] + 5, "concurrent") == 0)
gDvm.concurrentMarkSweep = true;
else if (strcmp(argv[i] + 5, "noconcurrent") == 0)
gDvm.concurrentMarkSweep = false;
//Only for GC verify cardtable which is used for marking the concurrent marksweep dirty field
else if (strcmp(argv[i] + 5, "verifycardtable") == 0)
gDvm.verifyCardTable = true;
else if (strcmp(argv[i] + 5, "noverifycardtable") == 0)
gDvm.verifyCardTable = false;
else {
dvmFprintf(stderr, "Bad value for -Xgc");
return -1;
}
ALOGV("Precise GC configured %s", gDvm.preciseGc ? "ON" : "OFF");
}
PS:
要获取 Android dalvikvm 命令选项,您可以输入命令adb shell dalvikvm -h
以获取详细信息。
Android 4.3(yakju-user 4.3 JWR66Y 776638 release-keys) 中的结果是
dalvikvm: [options] class [argument ...]
dalvikvm: [options] -jar file.jar [argument ...]
The following standard options are recognized:
-classpath classpath
-Dproperty=value
-verbose:tag ('gc', 'jni', or 'class')
-ea[:<package name>... |:<class name>]
-da[:<package name>... |:<class name>]
(-enableassertions, -disableassertions)
-esa
-dsa
(-enablesystemassertions, -disablesystemassertions)
-showversion
-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)
-Xjitclass:classname[,classname]*
-Xjitoffset:offset[,offset]
-Xjitconfig:filename
-Xjitcheckcg
-Xjitverbose
-Xjitprofile
-Xjitdisableopt
-Xjitsuspendpoll
Configured with: debugger profiler hprof jit(armv7-a-neon) smp show_exception=1