Merge "Fix the logic of parsing profilebootclasspath flags."

This commit is contained in:
Treehugger Robot
2022-11-10 19:17:24 +00:00
committed by Gerrit Code Review

View File

@@ -19,6 +19,7 @@
#define LOG_NDEBUG 1 #define LOG_NDEBUG 1
#include <android-base/macros.h> #include <android-base/macros.h>
#include <android-base/parsebool.h>
#include <android-base/properties.h> #include <android-base/properties.h>
#include <android/graphics/jni_runtime.h> #include <android/graphics/jni_runtime.h>
#include <android_runtime/AndroidRuntime.h> #include <android_runtime/AndroidRuntime.h>
@@ -52,6 +53,8 @@
using namespace android; using namespace android;
using android::base::GetBoolProperty; using android::base::GetBoolProperty;
using android::base::GetProperty; using android::base::GetProperty;
using android::base::ParseBool;
using android::base::ParseBoolResult;
extern int register_android_os_Binder(JNIEnv* env); extern int register_android_os_Binder(JNIEnv* env);
extern int register_android_os_Process(JNIEnv* env); extern int register_android_os_Process(JNIEnv* env);
@@ -701,17 +704,24 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote, bool p
// Read if we are using the profile configuration, do this at the start since the last ART args // Read if we are using the profile configuration, do this at the start since the last ART args
// take precedence. // take precedence.
property_get("dalvik.vm.profilebootclasspath", propBuf, ""); std::string profile_boot_class_path_flag =
std::string profile_boot_class_path_flag = propBuf; server_configurable_flags::GetServerConfigurableFlag(RUNTIME_NATIVE_BOOT_NAMESPACE,
// Empty means the property is unset and we should default to the phenotype property. PROFILE_BOOT_CLASS_PATH,
// The possible values are {"true", "false", ""} /*default_value=*/"");
if (profile_boot_class_path_flag.empty()) { bool profile_boot_class_path;
profile_boot_class_path_flag = server_configurable_flags::GetServerConfigurableFlag( switch (ParseBool(profile_boot_class_path_flag)) {
RUNTIME_NATIVE_BOOT_NAMESPACE, case ParseBoolResult::kError:
PROFILE_BOOT_CLASS_PATH, // Default to the system property.
/*default_value=*/ ""); profile_boot_class_path =
GetBoolProperty("dalvik.vm.profilebootclasspath", /*default_value=*/false);
break;
case ParseBoolResult::kTrue:
profile_boot_class_path = true;
break;
case ParseBoolResult::kFalse:
profile_boot_class_path = false;
break;
} }
const bool profile_boot_class_path = (profile_boot_class_path_flag == "true");
if (profile_boot_class_path) { if (profile_boot_class_path) {
addOption("-Xcompiler-option"); addOption("-Xcompiler-option");
addOption("--count-hotness-in-compiled-code"); addOption("--count-hotness-in-compiled-code");