Compilation filter
This CL introduces a static compilation filter mechanism intended
to allow us to reduce compilation time and space requirements until
we have a profiling mechanism in place.
It supports 5 modes of filtering:
o interpret-only (compile nothing)
o deferred-compilation (compile only those methods believe to be
compute-intensive)
o space (optimized for space)
o balanced (best return on space investment)
o speed (compile everything)
A future CL will allow the default filtering mode to be set
via system property. For now, you can pass it in via command
line as follows:
dalvikvm -compiler-filter:[interpret-only|defer-compilation|
space|balanced|speed]
or dex2oat --runtime-arg -compiler-filter:[one of the above modes]
Creating a file named art/SMALL_ART will force the filter
default to interpret-only. Later on we'll move this capability
to a persistent system property.
or modify kDefaultCompilerFilter in runtime.h
It also changes the compiler driver to allow the compilers to
decline to compile a method by return NULL.
Change-Id: Ic73411818f8bb845a4a19a05b0395c50902c534f
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 5298181..70d8816 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -355,9 +355,12 @@
parsed->hook_exit_ = exit;
parsed->hook_abort_ = NULL; // We don't call abort(3) by default; see Runtime::Abort.
- parsed->small_mode_ = false;
- parsed->small_mode_method_threshold_ = Runtime::kDefaultSmallModeMethodThreshold;
- parsed->small_mode_method_dex_size_limit_ = Runtime::kDefaultSmallModeMethodDexSizeLimit;
+ parsed->compiler_filter_ = Runtime::kDefaultCompilerFilter;
+ parsed->huge_method_threshold_ = Runtime::kDefaultHugeMethodThreshold;
+ parsed->large_method_threshold_ = Runtime::kDefaultLargeMethodThreshold;
+ parsed->small_method_threshold_ = Runtime::kDefaultSmallMethodThreshold;
+ parsed->tiny_method_threshold_ = Runtime::kDefaultTinyMethodThreshold;
+ parsed->num_dex_methods_threshold_ = Runtime::kDefaultNumDexMethodsThreshold;
parsed->sea_ir_mode_ = false;
// gLogVerbosity.class_linker = true; // TODO: don't check this in!
@@ -572,14 +575,28 @@
Trace::SetDefaultClockSource(kProfilerClockSourceWall);
} else if (option == "-Xprofile:dualclock") {
Trace::SetDefaultClockSource(kProfilerClockSourceDual);
- } else if (option == "-small") {
- parsed->small_mode_ = true;
+ } else if (option == "-compiler-filter:interpret-only") {
+ parsed->compiler_filter_ = kInterpretOnly;
+ } else if (option == "-compiler-filter:defer-compilation") {
+ parsed->compiler_filter_ = kDeferCompilation;
+ } else if (option == "-compiler-filter:space") {
+ parsed->compiler_filter_ = kSpace;
+ } else if (option == "-compiler-filter:balanced") {
+ parsed->compiler_filter_ = kBalanced;
+ } else if (option == "-compiler-filter:speed") {
+ parsed->compiler_filter_ = kSpeed;
} else if (option == "-sea_ir") {
parsed->sea_ir_mode_ = true;
- } else if (StartsWith(option, "-small-mode-methods-max:")) {
- parsed->small_mode_method_threshold_ = ParseIntegerOrDie(option);
- } else if (StartsWith(option, "-small-mode-methods-size-max:")) {
- parsed->small_mode_method_dex_size_limit_ = ParseIntegerOrDie(option);
+ } else if (StartsWith(option, "-huge-method-max:")) {
+ parsed->huge_method_threshold_ = ParseIntegerOrDie(option);
+ } else if (StartsWith(option, "-large-method-max:")) {
+ parsed->large_method_threshold_ = ParseIntegerOrDie(option);
+ } else if (StartsWith(option, "-small-method-max:")) {
+ parsed->small_method_threshold_ = ParseIntegerOrDie(option);
+ } else if (StartsWith(option, "-tiny-method-max:")) {
+ parsed->tiny_method_threshold_ = ParseIntegerOrDie(option);
+ } else if (StartsWith(option, "-num-dex-methods-max:")) {
+ parsed->num_dex_methods_threshold_ = ParseIntegerOrDie(option);
} else {
if (!ignore_unrecognized) {
// TODO: print usage via vfprintf
@@ -809,9 +826,12 @@
is_zygote_ = options->is_zygote_;
is_concurrent_gc_enabled_ = options->is_concurrent_gc_enabled_;
- small_mode_ = options->small_mode_;
- small_mode_method_threshold_ = options->small_mode_method_threshold_;
- small_mode_method_dex_size_limit_ = options->small_mode_method_dex_size_limit_;
+ compiler_filter_ = options->compiler_filter_;
+ huge_method_threshold_ = options->huge_method_threshold_;
+ large_method_threshold_ = options->large_method_threshold_;
+ small_method_threshold_ = options->small_method_threshold_;
+ tiny_method_threshold_ = options->tiny_method_threshold_;
+ num_dex_methods_threshold_ = options->num_dex_methods_threshold_;
sea_ir_mode_ = options->sea_ir_mode_;
vfprintf_ = options->hook_vfprintf_;