Merge "Add -XX:+DisableExplicitGC option for Art" into dalvik-dev
diff --git a/compiler/elf_writer_quick.cc b/compiler/elf_writer_quick.cc
index 29963fe..014c51e 100644
--- a/compiler/elf_writer_quick.cc
+++ b/compiler/elf_writer_quick.cc
@@ -661,7 +661,7 @@
return false;
}
- LOG(INFO) << "ELF file written successfully: " << elf_file_->GetPath();
+ VLOG(compiler) << "ELF file written successfully: " << elf_file_->GetPath();
return true;
}
diff --git a/runtime/native/java_lang_Runtime.cc b/runtime/native/java_lang_Runtime.cc
index e380c17..55575cf 100644
--- a/runtime/native/java_lang_Runtime.cc
+++ b/runtime/native/java_lang_Runtime.cc
@@ -28,6 +28,10 @@
namespace art {
static void Runtime_gc(JNIEnv*, jclass) {
+ if (Runtime::Current()->IsExplicitGcDisabled()) {
+ LOG(INFO) << "Explicit GC skipped.";
+ return;
+ }
Runtime::Current()->GetHeap()->CollectGarbage(false);
}
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index a30403d..aaae300 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -72,6 +72,7 @@
: is_compiler_(false),
is_zygote_(false),
is_concurrent_gc_enabled_(true),
+ is_explicit_gc_disabled_(false),
default_stack_size_(0),
heap_(NULL),
monitor_list_(NULL),
@@ -346,6 +347,7 @@
parsed->is_zygote_ = false;
parsed->interpreter_only_ = false;
parsed->is_concurrent_gc_enabled_ = true;
+ parsed->is_explicit_gc_disabled_ = false;
parsed->lock_profiling_threshold_ = 0;
parsed->hook_is_sensitive_thread_ = NULL;
@@ -516,6 +518,8 @@
LOG(WARNING) << "Ignoring unknown -Xgc option: " << gc_options[i];
}
}
+ } else if (option == "-XX:+DisableExplicitGC") {
+ parsed->is_explicit_gc_disabled_ = true;
} else if (StartsWith(option, "-verbose:")) {
std::vector<std::string> verbose_options;
Split(option.substr(strlen("-verbose:")), ',', verbose_options);
@@ -827,6 +831,7 @@
is_compiler_ = options->is_compiler_;
is_zygote_ = options->is_zygote_;
is_concurrent_gc_enabled_ = options->is_concurrent_gc_enabled_;
+ is_explicit_gc_disabled_ = options->is_explicit_gc_disabled_;
compiler_filter_ = options->compiler_filter_;
huge_method_threshold_ = options->huge_method_threshold_;
diff --git a/runtime/runtime.h b/runtime/runtime.h
index b93ae9d..8aba762 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -99,6 +99,7 @@
bool is_zygote_;
bool interpreter_only_;
bool is_concurrent_gc_enabled_;
+ bool is_explicit_gc_disabled_;
size_t heap_initial_size_;
size_t heap_maximum_size_;
size_t heap_growth_limit_;
@@ -146,6 +147,10 @@
return is_concurrent_gc_enabled_;
}
+ bool IsExplicitGcDisabled() const {
+ return is_explicit_gc_disabled_;
+ }
+
#ifdef ART_SEA_IR_MODE
bool IsSeaIRMode() const {
return sea_ir_mode_;
@@ -405,6 +410,7 @@
bool is_compiler_;
bool is_zygote_;
bool is_concurrent_gc_enabled_;
+ bool is_explicit_gc_disabled_;
CompilerFilter compiler_filter_;
size_t huge_method_threshold_;