[art] ART: add checkboot option for JavaVM

if product was configured to avoid checking boot,
we do not wipe the entire dalvik cache when boot accident occurs
This commit is contained in:
Firefly
2015-06-05 09:23:52 +08:00
committed by djw
parent a3f46fcad5
commit 07c7f87003
5 changed files with 11 additions and 1 deletions

View File

@ -448,7 +448,7 @@ ImageSpace* ImageSpace::Create(const char* image_location,
&has_system, &cache_filename, &dalvik_cache_exists,
&has_cache, &is_global_cache);
if (Runtime::Current()->IsZygote()) {
if (Runtime::Current()->IsZygote() && Runtime::Current()->IsCheckBoot()) {
MarkZygoteStart(image_isa);
}

View File

@ -227,6 +227,7 @@ bool ParsedOptions::Parse(const RuntimeOptions& options, bool ignore_unrecognize
compiler_callbacks_ = nullptr;
is_zygote_ = false;
check_boot_ = true;
must_relocate_ = kDefaultMustRelocate;
dex2oat_enabled_ = true;
image_dex2oat_enabled_ = true;
@ -309,6 +310,8 @@ bool ParsedOptions::Parse(const RuntimeOptions& options, bool ignore_unrecognize
}
} else if (StartsWith(option, "-Xcheck:jni")) {
check_jni_ = true;
} else if (StartsWith(option, "-Xcheckboot")) {
check_boot_ = false;
} else if (StartsWith(option, "-Xrunjdwp:") || StartsWith(option, "-agentlib:jdwp=")) {
std::string tail(option.substr(option[1] == 'X' ? 10 : 15));
// TODO: move parsing logic out of Dbg

View File

@ -44,6 +44,7 @@ class ParsedOptions {
std::string class_path_string_;
std::string image_;
bool check_jni_;
bool check_boot_;
std::string jni_trace_;
std::string native_bridge_library_filename_;
CompilerCallbacks* compiler_callbacks_;

View File

@ -691,6 +691,7 @@ bool Runtime::Init(const RuntimeOptions& raw_options, bool ignore_unrecognized)
patchoat_executable_ = options->patchoat_executable_;
must_relocate_ = options->must_relocate_;
is_zygote_ = options->is_zygote_;
check_boot_ = options->check_boot_;
is_explicit_gc_disabled_ = options->is_explicit_gc_disabled_;
dex2oat_enabled_ = options->dex2oat_enabled_;
image_dex2oat_enabled_ = options->image_dex2oat_enabled_;

View File

@ -122,6 +122,10 @@ class Runtime {
return is_zygote_;
}
bool IsCheckBoot() const {
return check_boot_;
}
bool IsExplicitGcDisabled() const {
return is_explicit_gc_disabled_;
}
@ -537,6 +541,7 @@ class Runtime {
CompilerCallbacks* compiler_callbacks_;
bool is_zygote_;
bool check_boot_;
bool must_relocate_;
bool is_concurrent_gc_enabled_;
bool is_explicit_gc_disabled_;