Compile less stuff
Don't compile class initializers, compile programs with fewer than
commmand-line specified number of methods, mildly refactor SLOW_MODE,
rename into LIGHT_MODE.
Also, walks the image for uncompiled methods and fixes up with pointers to the
interpreter entry point.
(Removed hot method list and light method limit as these are experimental.)
Change-Id: I2ae33d8add84ab9f4d76f9d910cae422c81a7832
diff --git a/src/compiler/driver/compiler_driver.cc b/src/compiler/driver/compiler_driver.cc
index 204f639..f08e629 100644
--- a/src/compiler/driver/compiler_driver.cc
+++ b/src/compiler/driver/compiler_driver.cc
@@ -284,9 +284,9 @@
}
CompilerDriver::CompilerDriver(CompilerBackend compiler_backend, InstructionSet instruction_set,
- bool image, size_t thread_count, bool support_debugging,
- const std::set<std::string>* image_classes, bool dump_stats,
- bool dump_timings)
+ bool image, size_t thread_count, bool support_debugging, bool light_mode,
+ const std::set<std::string>* image_classes,
+ bool dump_stats, bool dump_timings)
: compiler_backend_(compiler_backend),
instruction_set_(instruction_set),
freezing_constructor_lock_("freezing constructor lock"),
@@ -295,6 +295,7 @@
image_(image),
thread_count_(thread_count),
support_debugging_(support_debugging),
+ light_mode_(light_mode),
start_ns_(0),
stats_(new AOTCompilationStats),
dump_stats_(dump_stats),
@@ -1612,10 +1613,15 @@
CHECK(compiled_method != NULL);
} else if ((access_flags & kAccAbstract) != 0) {
} else {
- bool dont_compile = false;
-#if ART_SLOW_MODE
- dont_compile = (image_classes_ == NULL) || (image_classes_->size() == 0);
-#endif // ART_SLOW_MODE
+ std::string method_name(PrettyMethod(method_idx, dex_file, false));
+ // In light mode we only compile image classes.
+ bool dont_compile = light_mode_ && ((image_classes_ == NULL) || (image_classes_->size() == 0));
+
+ // Don't compile class initializers, ever.
+ if ((access_flags & kAccConstructor) && (access_flags & kAccStatic)) {
+ dont_compile = true;
+ }
+
if (!dont_compile) {
compiled_method = (*compiler_)(*this, code_item, access_flags, invoke_type, class_def_idx,
method_idx, class_loader, dex_file);
diff --git a/src/compiler/driver/compiler_driver.h b/src/compiler/driver/compiler_driver.h
index 385bc00..fae6902 100644
--- a/src/compiler/driver/compiler_driver.h
+++ b/src/compiler/driver/compiler_driver.h
@@ -67,9 +67,9 @@
// can assume will be in the image, with NULL implying all available
// classes.
explicit CompilerDriver(CompilerBackend compiler_backend, InstructionSet instruction_set, bool image,
- size_t thread_count, bool support_debugging,
- const std::set<std::string>* image_classes, bool dump_stats,
- bool dump_timings);
+ size_t thread_count, bool support_debugging, bool light_mode,
+ const std::set<std::string>* image_classes,
+ bool dump_stats, bool dump_timings);
~CompilerDriver();
@@ -84,6 +84,10 @@
return support_debugging_;
}
+ bool IsLightMode() const {
+ return light_mode_;
+ }
+
InstructionSet GetInstructionSet() const {
return instruction_set_;
}
@@ -340,6 +344,7 @@
bool image_;
size_t thread_count_;
bool support_debugging_;
+ const bool light_mode_;
uint64_t start_ns_;
UniquePtr<AOTCompilationStats> stats_;