Dalvik启动参数

android5.0:   ./frameworks/base/core/jni/AndroidRuntime.cpp
 537 int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
 538 {
 539     int result = -1;
 540     JavaVMInitArgs initArgs;
 541     char propBuf[PROPERTY_VALUE_MAX];
 542     char stackTraceFileBuf[sizeof("-Xstacktracefile:")-1 + PROPERTY_VALUE_MAX];
 543     char jniOptsBuf[sizeof("-Xjniopts:")-1 + PROPERTY_VALUE_MAX];
 544     char heapstartsizeOptsBuf[sizeof("-Xms")-1 + PROPERTY_VALUE_MAX];
 545     char heapsizeOptsBuf[sizeof("-Xmx")-1 + PROPERTY_VALUE_MAX];
 546     char heapgrowthlimitOptsBuf[sizeof("-XX:HeapGrowthLimit=")-1 + PROPERTY_VALUE_MAX];
 547     char heapminfreeOptsBuf[sizeof("-XX:HeapMinFree=")-1 + PROPERTY_VALUE_MAX];
 548     char heapmaxfreeOptsBuf[sizeof("-XX:HeapMaxFree=")-1 + PROPERTY_VALUE_MAX];
 549     char gctypeOptsBuf[sizeof("-Xgc:")-1 + PROPERTY_VALUE_MAX];
 550     char backgroundgcOptsBuf[sizeof("-XX:BackgroundGC=")-1 + PROPERTY_VALUE_MAX];
 551     char heaptargetutilizationOptsBuf[sizeof("-XX:HeapTargetUtilization=")-1 + PROPERTY_VALUE_MAX];
 552     char dex2oatXmsImageFlagsBuf[sizeof("-Xms")-1 + PROPERTY_VALUE_MAX];
 553     char dex2oatXmxImageFlagsBuf[sizeof("-Xmx")-1 + PROPERTY_VALUE_MAX];
 554     char dex2oatXmsFlagsBuf[sizeof("-Xms")-1 + PROPERTY_VALUE_MAX];
 555     char dex2oatXmxFlagsBuf[sizeof("-Xmx")-1 + PROPERTY_VALUE_MAX];
 556     char dex2oatCompilerFilterBuf[sizeof("--compiler-filter=")-1 + PROPERTY_VALUE_MAX];
 557     char dex2oatImageCompilerFilterBuf[sizeof("--compiler-filter=")-1 + PROPERTY_VALUE_MAX];
search hit TOP, continuing at BOTTOM
 838 jstring AndroidRuntime::NewStringLatin1(JNIEnv* env, const char* bytes) {
 839     if (!bytes) return NULL;
 840     int length = strlen(bytes);
 841     jchar* buffer = (jchar *)alloca(length * sizeof(jchar));
 842     if (!buffer) return NULL;
 843     jchar* chp = buffer;
 844     for (int i = 0; i < length; i++) {
 845         *chp++ = *bytes++;
 846     }
 847     return env->NewString(buffer, length);
 848 }
 849
 850
 851 /*
 852  * Start the Android runtime.  This involves starting the virtual machine
 853  * and calling the "static void main(String[] args)" method in the class
 854  * named by "className".
 855  *
 856  * Passes the main function two arguments, the class name and the specified
 857  * options string.
 858  *startVm(&mJavaVM, &env) != 0) {
 859         return;
 860     }
 861     onVmCreated(env);
 862
 863     /*
 864      * Register android functions.
 865      */
 866     if (startReg(env) < 0) {
 867         ALOGE("Unable to register all android natives\n");
 868         return;
 869     }
 870
 871     /*
 872      * We want to call main() with a String array with arguments in it.
 873      * At present we have two arguments, the class name and an option string.
 874      * Create an array to hold them.
 875      */
 876     jclass stringClass;
 877     jobjectArray strArray;
 878     jstring classNameStr;
search hit BOTTOM, continuing at TOP
 788     // Depth of bounded stack data
 789     parseRuntimeOption("dalvik.vm.profile.stack-depth",
 790                        profileMaxStackDepth,
 791                        "-Xprofile-max-stack-depth:");
 792
 793     // Native bridge library. "0" means that native bridge is disabled.
 794     property_get("ro.dalvik.vm.native.bridge", propBuf, "");
 795     if (propBuf[0] == '\0') {
 796         ALOGW("ro.dalvik.vm.native.bridge is not expected to be empty");
 797     } else if (strcmp(propBuf, "0") != 0) {
 798         snprintf(nativeBridgeLibrary, sizeof("-XX:NativeBridge=") + PROPERTY_VALUE_MAX,
 799                  "-XX:NativeBridge=%s", propBuf);
 800         addOption(nativeBridgeLibrary);
 801     }
 802
 803     initArgs.version = JNI_VERSION_1_4;
 804     initArgs.options = mOptions.editArray();
 805     initArgs.nOptions = mOptions.size();
 806     initArgs.ignoreUnrecognized = JNI_FALSE;
 807
 808     /*
 809      * Initialize the VM.
 810      *
 811      * The JavaVM* is essentially per-process, and the JNIEnv* is per-thread.
 812      * If this call succeeds, the VM is ready, and we can start issuing
 813      * JNI calls.
 814      */
 815     if (JNI_CreateJavaVM(pJavaVM, pEnv, &initArgs) < 0) {
 816         ALOGE("JNI_CreateJavaVM failed\n");
 817         goto bail;
 818     }
 819
 820     result = 0;
 821
 822 bail:
 823     return result;
 824 }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值