From c4f105d75cd0cbc5145620068bbb8a819148e535 Mon Sep 17 00:00:00 2001 From: Anwar Ghuloum Date: Wed, 10 Apr 2013 16:12:11 -0700 Subject: 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 --- src/compiler/driver/compiler_driver.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/compiler/driver/compiler_driver.cc') diff --git a/src/compiler/driver/compiler_driver.cc b/src/compiler/driver/compiler_driver.cc index 204f6391dc..f08e6297ef 100644 --- a/src/compiler/driver/compiler_driver.cc +++ b/src/compiler/driver/compiler_driver.cc @@ -284,9 +284,9 @@ static Fn FindFunction(const std::string& compiler_so_name, void* library, const } CompilerDriver::CompilerDriver(CompilerBackend compiler_backend, InstructionSet instruction_set, - bool image, size_t thread_count, bool support_debugging, - const std::set* image_classes, bool dump_stats, - bool dump_timings) + bool image, size_t thread_count, bool support_debugging, bool light_mode, + const std::set* 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 @@ CompilerDriver::CompilerDriver(CompilerBackend compiler_backend, InstructionSet 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 @@ void CompilerDriver::CompileMethod(const DexFile::CodeItem* code_item, uint32_t 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); -- cgit v1.2.3-59-g8ed1b