From ab3f8d27ae8737c72b8b844604e6e3df6f2ad7e7 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Sat, 23 Jul 2022 15:49:51 +0000 Subject: Reland "Add clinit checks at entry for some boot image methods." This reverts commit 0ae89052f7213701b8b3a782266e84b3d3600dbf. Bug: 162110941 Bug: 238472973 Reason for revert: Remove code that forced using clinit entrypoints in debug mode. Change-Id: Ibc04e91b09deaa1ac23d32b9e45281f3299d2981 --- compiler/driver/compiler_options.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'compiler/driver/compiler_options.h') diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h index 1bffdb11ed..20f54bdecd 100644 --- a/compiler/driver/compiler_options.h +++ b/compiler/driver/compiler_options.h @@ -44,6 +44,7 @@ namespace linker { class Arm64RelativePatcherTest; } // namespace linker +class ArtMethod; class DexFile; enum class InstructionSet; class InstructionSetFeatures; @@ -300,6 +301,10 @@ class CompilerOptions final { bool IsImageClass(const char* descriptor) const; + // Returns whether the given `pretty_descriptor` is in the list of preloaded + // classes. `pretty_descriptor` should be the result of calling `PrettyDescriptor`. + bool IsPreloadedClass(const char* pretty_descriptor) const; + const VerificationResults* GetVerificationResults() const; bool ParseCompilerOptions(const std::vector& options, @@ -383,6 +388,12 @@ class CompilerOptions final { return ContainsElement(GetDexFilesForOatFile(), dex_file); } + // If this is a static non-constructor method in the boot classpath, and its class isn't + // initialized at compile-time, or won't be initialized by the zygote, add + // initialization checks at entry. This will avoid the need of trampolines + // which at runtime we will need to dirty after initialization. + bool ShouldCompileWithClinitCheck(ArtMethod* method) const; + private: bool ParseDumpInitFailures(const std::string& option, std::string* error_msg); bool ParseRegisterAllocationStrategy(const std::string& option, std::string* error_msg); @@ -408,6 +419,10 @@ class CompilerOptions final { // Must not be empty for real boot image, only for tests pretending to compile boot image. HashSet image_classes_; + // Classes listed in the preloaded-classes file, used for boot image and + // boot image extension compilation. + HashSet preloaded_classes_; + // Results of AOT verification. const VerificationResults* verification_results_; -- cgit v1.2.3-59-g8ed1b