diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2019-02-26 01:26:14 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-02-26 01:26:14 -0800 |
commit | 2c2a2774d5bd0f39024dec6c8f6ac1b5fed4e8fd (patch) | |
tree | 662ab5d73e542ec0f00dc1754da83f2432393636 /core/jni/AndroidRuntime.cpp | |
parent | 3fc88350efbf29c8a9fbe1172a3dead314a990f8 (diff) | |
parent | 77ad6aee15147ac3934570e674cbc0a994a40a56 (diff) |
Merge "Replace generic GC type flag with a specific Generational CC flag."
am: 77ad6aee15
Change-Id: I44675d5fb088cebc01f75f7a176f42cd06d4f007
Diffstat (limited to 'core/jni/AndroidRuntime.cpp')
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 815b9631ff79..7c69c3374c87 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -222,8 +222,15 @@ extern int register_com_android_internal_util_VirtualRefBasePtr(JNIEnv *env); // Namespace for Android Runtime flags applied during boot time. static const char* RUNTIME_NATIVE_BOOT_NAMESPACE = "runtime_native_boot"; -// Feature flag name for Garbage Collector type. -static const char* GCTYPE = "gctype"; +// Feature flag name to enable/disable generational garbage collection in ART's +// Concurrent Copying (CC) garbage collector. +static const char* ENABLE_GENERATIONAL_CC = "enable_generational_cc"; +// Runtime option enabling generational garbage collection in ART's Concurrent +// Copying (CC) garbage collector. +static const char* kGenerationalCCRuntimeOption = "-Xgc:generational_cc"; +// Runtime option disabling generational garbage collection in ART's Concurrent +// Copying (CC) garbage collector. +static const char* kNoGenerationalCCRuntimeOption = "-Xgc:nogenerational_cc"; static AndroidRuntime* gCurRuntime = NULL; @@ -775,17 +782,21 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote) addOption("-XX:LowMemoryMode"); } - std::string gc_type_override = - server_configurable_flags::GetServerConfigurableFlag(RUNTIME_NATIVE_BOOT_NAMESPACE, - GCTYPE, - /*default_value=*/ ""); - std::string gc_type_override_temp; - if (gc_type_override.empty()) { - parseRuntimeOption("dalvik.vm.gctype", gctypeOptsBuf, "-Xgc:"); - } else { - // Copy the string so it doesn't go out of scope since addOption does not make a copy. - gc_type_override_temp = "-Xgc:" + gc_type_override; - addOption(gc_type_override_temp.c_str()); + /* + * Garbage-collection related options. + */ + parseRuntimeOption("dalvik.vm.gctype", gctypeOptsBuf, "-Xgc:"); + + // If it set, honor the "enable_generational_cc" device configuration; + // otherwise, let the runtime use its default behavior. + std::string enable_generational_cc = + server_configurable_flags::GetServerConfigurableFlag(RUNTIME_NATIVE_BOOT_NAMESPACE, + ENABLE_GENERATIONAL_CC, + /*default_value=*/ ""); + if (enable_generational_cc == "true") { + addOption(kGenerationalCCRuntimeOption); + } else if (enable_generational_cc == "false") { + addOption(kNoGenerationalCCRuntimeOption); } parseRuntimeOption("dalvik.vm.backgroundgctype", backgroundgcOptsBuf, "-XX:BackgroundGC="); |