ART: Remove support for compiled-methods and compiled-classes
This has been superseded by profile support.
This reverts commit 70bef0d8f6aa30b0da5c6ca56e1bc5729f74654b.
This reverts commit 4bf3ae9930a155f238dfd471413c866912b2579e.
Bug: 76145463
Test: mmma art
Test: m test-art-host
Change-Id: I5a368cd01812e16869352ec219eae095df4919c4
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index d3e3a51..96a0c1b 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -138,20 +138,6 @@
return new std::unordered_set<std::string>();
}
-// Get the set of compiled classes given to the compiler-driver in SetUp. Note: the compiler
-// driver assumes ownership of the set, so the test should properly release the set.
-std::unordered_set<std::string>* CommonCompilerTest::GetCompiledClasses() {
- // Null, no selection of compiled-classes.
- return nullptr;
-}
-
-// Get the set of compiled methods given to the compiler-driver in SetUp. Note: the compiler
-// driver assumes ownership of the set, so the test should properly release the set.
-std::unordered_set<std::string>* CommonCompilerTest::GetCompiledMethods() {
- // Null, no selection of compiled-methods.
- return nullptr;
-}
-
// Get ProfileCompilationInfo that should be passed to the driver.
ProfileCompilationInfo* CommonCompilerTest::GetProfileCompilationInfo() {
// Null, profile information will not be taken into account.
@@ -190,8 +176,6 @@
isa,
instruction_set_features_.get(),
GetImageClasses(),
- GetCompiledClasses(),
- GetCompiledMethods(),
number_of_threads,
/* swap_fd */ -1,
GetProfileCompilationInfo()));
diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h
index 8af29d4..39c8bd8 100644
--- a/compiler/common_compiler_test.h
+++ b/compiler/common_compiler_test.h
@@ -67,14 +67,6 @@
// driver assumes ownership of the set, so the test should properly release the set.
virtual std::unordered_set<std::string>* GetImageClasses();
- // Get the set of compiled classes given to the compiler-driver in SetUp. Note: the compiler
- // driver assumes ownership of the set, so the test should properly release the set.
- virtual std::unordered_set<std::string>* GetCompiledClasses();
-
- // Get the set of compiled methods given to the compiler-driver in SetUp. Note: the compiler
- // driver assumes ownership of the set, so the test should properly release the set.
- virtual std::unordered_set<std::string>* GetCompiledMethods();
-
virtual ProfileCompilationInfo* GetProfileCompilationInfo();
virtual CompilerFilter::Filter GetCompilerFilter() const {
diff --git a/compiler/driver/compiled_method_storage_test.cc b/compiler/driver/compiled_method_storage_test.cc
index 0769561..42fbba5 100644
--- a/compiler/driver/compiled_method_storage_test.cc
+++ b/compiler/driver/compiled_method_storage_test.cc
@@ -34,8 +34,6 @@
/* instruction_set_ */ InstructionSet::kNone,
/* instruction_set_features */ nullptr,
/* image_classes */ nullptr,
- /* compiled_classes */ nullptr,
- /* compiled_methods */ nullptr,
/* thread_count */ 1u,
/* swap_fd */ -1,
/* profile_compilation_info */ nullptr);
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 4093833..41b7e7b 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -264,8 +264,6 @@
InstructionSet instruction_set,
const InstructionSetFeatures* instruction_set_features,
std::unordered_set<std::string>* image_classes,
- std::unordered_set<std::string>* compiled_classes,
- std::unordered_set<std::string>* compiled_methods,
size_t thread_count,
int swap_fd,
const ProfileCompilationInfo* profile_compilation_info)
@@ -279,8 +277,6 @@
requires_constructor_barrier_lock_("constructor barrier lock"),
non_relative_linker_patch_count_(0u),
image_classes_(image_classes),
- classes_to_compile_(compiled_classes),
- methods_to_compile_(compiled_methods),
number_of_soft_verifier_failures_(0),
had_hard_verifier_failure_(false),
parallel_thread_count_(thread_count),
@@ -638,7 +634,6 @@
(verified_method->GetEncounteredVerificationFailures() &
(verifier::VERIFY_ERROR_FORCE_INTERPRETER | verifier::VERIFY_ERROR_LOCKING)) == 0 &&
// Is eligable for compilation by methods-to-compile filter.
- driver->IsMethodToCompile(method_ref) &&
driver->ShouldCompileBasedOnProfile(method_ref);
if (compile) {
@@ -1065,15 +1060,6 @@
return classes_to_compile_->find(descriptor) != classes_to_compile_->end();
}
-bool CompilerDriver::IsMethodToCompile(const MethodReference& method_ref) const {
- if (methods_to_compile_ == nullptr) {
- return true;
- }
-
- std::string tmp = method_ref.PrettyMethod();
- return methods_to_compile_->find(tmp.c_str()) != methods_to_compile_->end();
-}
-
bool CompilerDriver::ShouldCompileBasedOnProfile(const MethodReference& method_ref) const {
// Profile compilation info may be null if no profile is passed.
if (!CompilerFilter::DependsOnProfile(compiler_options_->GetCompilerFilter())) {
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index a5462ee..55f3561 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -100,8 +100,6 @@
InstructionSet instruction_set,
const InstructionSetFeatures* instruction_set_features,
std::unordered_set<std::string>* image_classes,
- std::unordered_set<std::string>* compiled_classes,
- std::unordered_set<std::string>* compiled_methods,
size_t thread_count,
int swap_fd,
const ProfileCompilationInfo* profile_compilation_info);
@@ -316,9 +314,6 @@
// Checks whether the provided class should be compiled, i.e., is in classes_to_compile_.
bool IsClassToCompile(const char* descriptor) const;
- // Checks whether the provided method should be compiled, i.e., is in method_to_compile_.
- bool IsMethodToCompile(const MethodReference& method_ref) const;
-
// Checks whether profile guided compilation is enabled and if the method should be compiled
// according to the profile file.
bool ShouldCompileBasedOnProfile(const MethodReference& method_ref) const;
@@ -505,12 +500,8 @@
// This option may be restricted to the boot image, depending on a flag in the implementation.
std::unique_ptr<std::unordered_set<std::string>> classes_to_compile_;
- // Specifies the methods that will be compiled. Note that if methods_to_compile_ is null,
- // all methods are eligible for compilation (compilation filters etc. will still apply).
- // This option may be restricted to the boot image, depending on a flag in the implementation.
- std::unique_ptr<std::unordered_set<std::string>> methods_to_compile_;
-
std::atomic<uint32_t> number_of_soft_verifier_failures_;
+
bool had_hard_verifier_failure_;
// A thread pool that can (potentially) run tasks in parallel.
diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc
index 162904c..1332280 100644
--- a/compiler/driver/compiler_driver_test.cc
+++ b/compiler/driver/compiler_driver_test.cc
@@ -184,59 +184,6 @@
}
}
-class CompilerDriverMethodsTest : public CompilerDriverTest {
- protected:
- std::unordered_set<std::string>* GetCompiledMethods() OVERRIDE {
- return new std::unordered_set<std::string>({
- "byte StaticLeafMethods.identity(byte)",
- "int StaticLeafMethods.sum(int, int, int)",
- "double StaticLeafMethods.sum(double, double, double, double)"
- });
- }
-};
-
-TEST_F(CompilerDriverMethodsTest, Selection) {
- Thread* self = Thread::Current();
- jobject class_loader;
- {
- ScopedObjectAccess soa(self);
- class_loader = LoadDex("StaticLeafMethods");
- }
- ASSERT_NE(class_loader, nullptr);
-
- // Need to enable dex-file writability. Methods rejected to be compiled will run through the
- // dex-to-dex compiler.
- for (const DexFile* dex_file : GetDexFiles(class_loader)) {
- ASSERT_TRUE(dex_file->EnableWrite());
- }
-
- CompileAll(class_loader);
-
- ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
- ScopedObjectAccess soa(self);
- StackHandleScope<1> hs(self);
- Handle<mirror::ClassLoader> h_loader(
- hs.NewHandle(soa.Decode<mirror::ClassLoader>(class_loader)));
- mirror::Class* klass = class_linker->FindClass(self, "LStaticLeafMethods;", h_loader);
- ASSERT_NE(klass, nullptr);
-
- std::unique_ptr<std::unordered_set<std::string>> expected(GetCompiledMethods());
-
- const auto pointer_size = class_linker->GetImagePointerSize();
- for (auto& m : klass->GetDirectMethods(pointer_size)) {
- std::string name = m.PrettyMethod(true);
- const void* code = m.GetEntryPointFromQuickCompiledCodePtrSize(pointer_size);
- ASSERT_NE(code, nullptr);
- if (expected->find(name) != expected->end()) {
- expected->erase(name);
- EXPECT_FALSE(class_linker->IsQuickToInterpreterBridge(code));
- } else {
- EXPECT_TRUE(class_linker->IsQuickToInterpreterBridge(code));
- }
- }
- EXPECT_TRUE(expected->empty());
-}
-
class CompilerDriverProfileTest : public CompilerDriverTest {
protected:
ProfileCompilationInfo* GetProfileCompilationInfo() OVERRIDE {
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index ac5c6fb..0de00a8 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -142,8 +142,6 @@
instruction_set,
instruction_set_features_.get(),
/* image_classes */ nullptr,
- /* compiled_classes */ nullptr,
- /* compiled_methods */ nullptr,
/* thread_count */ 1,
/* swap_fd */ -1,
/* profile_compilation_info */ nullptr));
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 2b4604e..741bc64 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -629,10 +629,6 @@
image_classes_zip_filename_(nullptr),
image_classes_filename_(nullptr),
image_storage_mode_(ImageHeader::kStorageModeUncompressed),
- compiled_classes_zip_filename_(nullptr),
- compiled_classes_filename_(nullptr),
- compiled_methods_zip_filename_(nullptr),
- compiled_methods_filename_(nullptr),
passes_to_run_filename_(nullptr),
dirty_image_objects_filename_(nullptr),
multi_image_(false),
@@ -818,18 +814,6 @@
Usage("--image-classes-zip should be used with --image-classes");
}
- if (compiled_classes_filename_ != nullptr && !IsBootImage()) {
- Usage("--compiled-classes should only be used with --image");
- }
-
- if (compiled_classes_filename_ != nullptr && !boot_image_filename_.empty()) {
- Usage("--compiled-classes should not be used with --boot-image");
- }
-
- if (compiled_classes_zip_filename_ != nullptr && compiled_classes_filename_ == nullptr) {
- Usage("--compiled-classes-zip should be used with --compiled-classes");
- }
-
if (dex_filenames_.empty() && zip_fd_ == -1) {
Usage("Input must be supplied with either --dex-file or --zip-fd");
}
@@ -873,9 +857,7 @@
}
if (have_profile_file || have_profile_fd) {
- if (compiled_classes_filename_ != nullptr ||
- compiled_classes_zip_filename_ != nullptr ||
- image_classes_filename_ != nullptr ||
+ if (image_classes_filename_ != nullptr ||
image_classes_zip_filename_ != nullptr) {
Usage("Profile based image creation is not supported with image or compiled classes");
}
@@ -1210,10 +1192,6 @@
AssignIfExists(args, M::Threads, &thread_count_);
AssignIfExists(args, M::ImageClasses, &image_classes_filename_);
AssignIfExists(args, M::ImageClassesZip, &image_classes_zip_filename_);
- AssignIfExists(args, M::CompiledClasses, &compiled_classes_filename_);
- AssignIfExists(args, M::CompiledClassesZip, &compiled_classes_zip_filename_);
- AssignIfExists(args, M::CompiledMethods, &compiled_methods_filename_);
- AssignIfExists(args, M::CompiledMethodsZip, &compiled_methods_zip_filename_);
AssignIfExists(args, M::Passes, &passes_to_run_filename_);
AssignIfExists(args, M::BootImage, &parser_options->boot_image_filename);
AssignIfExists(args, M::AndroidRoot, &android_root_);
@@ -1535,8 +1513,7 @@
dex2oat::ReturnCode Setup() {
TimingLogger::ScopedTiming t("dex2oat Setup", timings_);
- if (!PrepareImageClasses() || !PrepareCompiledClasses() || !PrepareCompiledMethods() ||
- !PrepareDirtyObjects()) {
+ if (!PrepareImageClasses() || !PrepareDirtyObjects()) {
return dex2oat::ReturnCode::kOther;
}
@@ -1875,8 +1852,6 @@
instruction_set_,
instruction_set_features_.get(),
image_classes_.release(),
- compiled_classes_.release(),
- compiled_methods_.release(),
thread_count_,
swap_fd_,
profile_compilation_info_.get()));
@@ -2421,21 +2396,6 @@
return true;
}
- bool PrepareCompiledClasses() {
- // If --compiled-classes was specified, calculate the full list of classes to compile in the
- // image.
- if (compiled_classes_filename_ != nullptr) {
- compiled_classes_ =
- ReadClasses(compiled_classes_zip_filename_, compiled_classes_filename_, "compiled");
- if (compiled_classes_ == nullptr) {
- return false;
- }
- } else {
- compiled_classes_.reset(nullptr); // By default compile everything.
- }
- return true;
- }
-
static std::unique_ptr<std::unordered_set<std::string>> ReadClasses(const char* zip_filename,
const char* classes_filename,
const char* tag) {
@@ -2453,32 +2413,6 @@
return classes;
}
- bool PrepareCompiledMethods() {
- // If --compiled-methods was specified, read the methods to compile from the given file(s).
- if (compiled_methods_filename_ != nullptr) {
- std::string error_msg;
- if (compiled_methods_zip_filename_ != nullptr) {
- compiled_methods_.reset(ReadCommentedInputFromZip<std::unordered_set<std::string>>(
- compiled_methods_zip_filename_,
- compiled_methods_filename_,
- nullptr, // No post-processing.
- &error_msg));
- } else {
- compiled_methods_.reset(ReadCommentedInputFromFile<std::unordered_set<std::string>>(
- compiled_methods_filename_,
- nullptr)); // No post-processing.
- }
- if (compiled_methods_.get() == nullptr) {
- LOG(ERROR) << "Failed to create list of compiled methods from '"
- << compiled_methods_filename_ << "': " << error_msg;
- return false;
- }
- } else {
- compiled_methods_.reset(nullptr); // By default compile everything.
- }
- return true;
- }
-
bool PrepareDirtyObjects() {
if (dirty_image_objects_filename_ != nullptr) {
dirty_image_objects_.reset(ReadCommentedInputFromFile<std::unordered_set<std::string>>(
@@ -2919,10 +2853,6 @@
const char* image_classes_zip_filename_;
const char* image_classes_filename_;
ImageHeader::StorageMode image_storage_mode_;
- const char* compiled_classes_zip_filename_;
- const char* compiled_classes_filename_;
- const char* compiled_methods_zip_filename_;
- const char* compiled_methods_filename_;
const char* passes_to_run_filename_;
const char* dirty_image_objects_filename_;
std::unique_ptr<std::unordered_set<std::string>> image_classes_;
diff --git a/dex2oat/dex2oat_image_test.cc b/dex2oat/dex2oat_image_test.cc
index 6f12249..11c0c95 100644
--- a/dex2oat/dex2oat_image_test.cc
+++ b/dex2oat/dex2oat_image_test.cc
@@ -239,9 +239,7 @@
ImageSizes base_sizes = CompileImageAndGetSizes({});
ImageSizes image_classes_sizes;
ImageSizes compiled_classes_sizes;
- ImageSizes compiled_all_classes_sizes;
ImageSizes compiled_methods_sizes;
- ImageSizes compiled_all_methods_sizes;
ImageSizes profile_sizes;
std::cout << "Base compile sizes " << base_sizes << std::endl;
// Test image classes
@@ -257,65 +255,28 @@
// Sanity check that dex is the same size.
EXPECT_EQ(image_classes_sizes.vdex_size, base_sizes.vdex_size);
}
- // Test compiled classes with all the classes.
- {
- ScratchFile classes;
- // Only compile every even class.
- GenerateClasses(classes.GetFile(), /*frequency*/ 1u);
- compiled_all_classes_sizes = CompileImageAndGetSizes(
- {"--compiled-classes=" + classes.GetFilename()});
- classes.Close();
- std::cout << "Compiled all classes sizes " << compiled_all_classes_sizes << std::endl;
- // Check that oat size is smaller since we didn't compile everything.
- EXPECT_EQ(compiled_all_classes_sizes.art_size, base_sizes.art_size);
- // TODO(mathieuc): Find a reliable way to check compiled code.
- // EXPECT_EQ(compiled_all_classes_sizes.oat_size, base_sizes.oat_size);
- EXPECT_EQ(compiled_all_classes_sizes.vdex_size, base_sizes.vdex_size);
- }
// Test compiled classes.
{
ScratchFile classes;
// Only compile every even class.
GenerateClasses(classes.GetFile(), /*frequency*/ 2u);
compiled_classes_sizes = CompileImageAndGetSizes(
- {"--image-classes=" + classes.GetFilename(),
- "--compiled-classes=" + classes.GetFilename()});
+ {"--image-classes=" + classes.GetFilename()});
classes.Close();
std::cout << "Compiled classes sizes " << compiled_classes_sizes << std::endl;
- // Check that oat size is smaller since we didn't compile everything.
- // TODO(mathieuc): Find a reliable way to check compiled code.
- // EXPECT_LT(compiled_classes_sizes.oat_size, base_sizes.oat_size);
// Art file should be smaller than image classes version since we included fewer classes in the
// list.
EXPECT_LT(compiled_classes_sizes.art_size, image_classes_sizes.art_size);
}
- // Test compiled methods.
- {
- ScratchFile methods;
- // Only compile every even class.
- GenerateMethods(methods.GetFile(), /*frequency*/ 1u);
- compiled_all_methods_sizes = CompileImageAndGetSizes(
- {"--compiled-methods=" + methods.GetFilename()});
- methods.Close();
- std::cout << "Compiled all methods sizes " << compiled_all_methods_sizes << std::endl;
- EXPECT_EQ(compiled_all_classes_sizes.art_size, base_sizes.art_size);
- // TODO(mathieuc): Find a reliable way to check compiled code. b/63746626
- // EXPECT_EQ(compiled_all_classes_sizes.oat_size, base_sizes.oat_size);
- EXPECT_EQ(compiled_all_classes_sizes.vdex_size, base_sizes.vdex_size);
- }
static size_t kMethodFrequency = 3;
static size_t kTypeFrequency = 4;
// Test compiling fewer methods and classes.
{
- ScratchFile methods;
ScratchFile classes;
// Only compile every even class.
- GenerateMethods(methods.GetFile(), kMethodFrequency);
GenerateClasses(classes.GetFile(), kTypeFrequency);
compiled_methods_sizes = CompileImageAndGetSizes(
- {"--image-classes=" + classes.GetFilename(),
- "--compiled-methods=" + methods.GetFilename()});
- methods.Close();
+ {"--image-classes=" + classes.GetFilename()});
classes.Close();
std::cout << "Compiled fewer methods sizes " << compiled_methods_sizes << std::endl;
}
diff --git a/dex2oat/dex2oat_options.cc b/dex2oat/dex2oat_options.cc
index 5843691..dbb00c2 100644
--- a/dex2oat/dex2oat_options.cc
+++ b/dex2oat/dex2oat_options.cc
@@ -157,19 +157,7 @@
static void AddCompilerMappings(Builder& builder) {
builder.
- Define("--compiled-classes=_")
- .WithType<std::string>()
- .IntoKey(M::CompiledClasses)
- .Define("--compiled-classes-zip=_")
- .WithType<std::string>()
- .IntoKey(M::CompiledClassesZip)
- .Define("--compiled-methods=_")
- .WithType<std::string>()
- .IntoKey(M::CompiledMethods)
- .Define("--compiled-methods-zip=_")
- .WithType<std::string>()
- .IntoKey(M::CompiledMethodsZip)
- .Define("--run-passes=_")
+ Define("--run-passes=_")
.WithType<std::string>()
.IntoKey(M::Passes)
.Define("--profile-file=_")
diff --git a/dex2oat/dex2oat_options.def b/dex2oat/dex2oat_options.def
index 1a913a9..7be8e56 100644
--- a/dex2oat/dex2oat_options.def
+++ b/dex2oat/dex2oat_options.def
@@ -56,10 +56,6 @@
DEX2OAT_OPTIONS_KEY (std::string, ImageClasses)
DEX2OAT_OPTIONS_KEY (std::string, ImageClassesZip)
DEX2OAT_OPTIONS_KEY (ImageHeader::StorageMode, ImageFormat)
-DEX2OAT_OPTIONS_KEY (std::string, CompiledClasses)
-DEX2OAT_OPTIONS_KEY (std::string, CompiledClassesZip)
-DEX2OAT_OPTIONS_KEY (std::string, CompiledMethods)
-DEX2OAT_OPTIONS_KEY (std::string, CompiledMethodsZip)
DEX2OAT_OPTIONS_KEY (std::string, Passes)
DEX2OAT_OPTIONS_KEY (std::string, Base) // TODO: Hex string parsing.
DEX2OAT_OPTIONS_KEY (std::string, BootImage)
diff --git a/dex2oat/linker/oat_writer_test.cc b/dex2oat/linker/oat_writer_test.cc
index ea4e210..37e69f7 100644
--- a/dex2oat/linker/oat_writer_test.cc
+++ b/dex2oat/linker/oat_writer_test.cc
@@ -110,8 +110,6 @@
insn_set,
insn_features_.get(),
/* image_classes */ nullptr,
- /* compiled_classes */ nullptr,
- /* compiled_methods */ nullptr,
/* thread_count */ 2,
/* swap_fd */ -1,
/* profile_compilation_info */ nullptr));
diff --git a/dex2oat/linker/relative_patcher_test.h b/dex2oat/linker/relative_patcher_test.h
index 3f7c855..9cd51e9 100644
--- a/dex2oat/linker/relative_patcher_test.h
+++ b/dex2oat/linker/relative_patcher_test.h
@@ -49,8 +49,6 @@
instruction_set,
/* instruction_set_features*/ nullptr,
/* image_classes */ nullptr,
- /* compiled_classes */ nullptr,
- /* compiled_methods */ nullptr,
/* thread_count */ 1u,
/* swap_fd */ -1,
/* profile_compilation_info */ nullptr),
diff --git a/tools/bisection_search/bisection_search.py b/tools/bisection_search/bisection_search.py
index a1ac72d..250b5d1 100755
--- a/tools/bisection_search/bisection_search.py
+++ b/tools/bisection_search/bisection_search.py
@@ -166,10 +166,6 @@
"""Prepare command to run."""
cmd = self._base_cmd[0:self._arguments_position]
# insert additional arguments before the first argument
- if compiled_methods is not None:
- self._test_env.WriteLines(self._compiled_methods_path, compiled_methods)
- cmd += ['-Xcompiler-option', '--compiled-methods={0}'.format(
- self._compiled_methods_path)]
if passes_to_run is not None:
self._test_env.WriteLines(self._passes_to_run_path, passes_to_run)
cmd += ['-Xcompiler-option', '--run-passes={0}'.format(