Add option to identify primary zygote.
This will be used to customize when to start pre-jitting in
jitzygote mode.
Test: boots
Bug: 119800099
Change-Id: I1b5c1c454455d336f22e3328deead4ced1742239
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 2f8ee02..3e0c52b 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -82,6 +82,8 @@
parser_builder->
Define("-Xzygote")
.IntoKey(M::Zygote)
+ .Define("-Xprimaryzygote")
+ .IntoKey(M::PrimaryZygote)
.Define("-help")
.IntoKey(M::Help)
.Define("-showversion")
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index d8c68e6..93ba622 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -229,6 +229,7 @@
instruction_set_(InstructionSet::kNone),
compiler_callbacks_(nullptr),
is_zygote_(false),
+ is_primary_zygote_(false),
is_system_server_(false),
must_relocate_(false),
is_concurrent_gc_enabled_(true),
@@ -963,6 +964,7 @@
const char* isa,
bool profile_system_server) {
is_zygote_ = false;
+ is_primary_zygote_ = false;
if (is_native_bridge_loaded_) {
switch (action) {
@@ -1218,6 +1220,7 @@
compiler_callbacks_ = runtime_options.GetOrDefault(Opt::CompilerCallbacksPtr);
must_relocate_ = runtime_options.GetOrDefault(Opt::Relocate);
is_zygote_ = runtime_options.Exists(Opt::Zygote);
+ is_primary_zygote_ = runtime_options.Exists(Opt::PrimaryZygote);
is_explicit_gc_disabled_ = runtime_options.Exists(Opt::DisableExplicitGC);
image_dex2oat_enabled_ = runtime_options.GetOrDefault(Opt::ImageDex2Oat);
dump_native_stack_on_sig_quit_ = runtime_options.GetOrDefault(Opt::DumpNativeStackOnSigQuit);
diff --git a/runtime/runtime.h b/runtime/runtime.h
index c4baf40..dd66b85 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -163,6 +163,10 @@
return is_zygote_;
}
+ bool IsPrimaryZygote() const {
+ return is_primary_zygote_;
+ }
+
bool IsSystemServer() const {
return is_system_server_;
}
@@ -944,6 +948,7 @@
CompilerCallbacks* compiler_callbacks_;
bool is_zygote_;
+ bool is_primary_zygote_;
bool is_system_server_;
bool must_relocate_;
bool is_concurrent_gc_enabled_;
diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def
index a7b5f34..43a7229 100644
--- a/runtime/runtime_options.def
+++ b/runtime/runtime_options.def
@@ -35,6 +35,7 @@
// Parse-able keys from the command line.
RUNTIME_OPTIONS_KEY (Unit, Zygote)
+RUNTIME_OPTIONS_KEY (Unit, PrimaryZygote)
RUNTIME_OPTIONS_KEY (Unit, Help)
RUNTIME_OPTIONS_KEY (Unit, ShowVersion)
RUNTIME_OPTIONS_KEY (ParseStringList<':'>,BootClassPath) // std::vector<std::string>