summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_options.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2022-03-22 15:44:57 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2022-07-08 10:00:33 +0000
commitc37e3a0a532fb89b62753d0478c1ba3c9fc87bb3 (patch)
tree93d519edbe9d5cf5a42e2ca9de15e5dee4c283f5 /compiler/driver/compiler_options.h
parentd88c1499efe2f718f3cc1f45a3dc178471b22ce6 (diff)
Add clinit checks at entry for some boot image methods.
Look at the list of preloaded classes to know whether the class will be initialized. If it's not in the list, add explicit clinit checks at entry. Update FixupStaticTrampolines to only update the entrypoint if it is the resolution stub. This adds two pages to current on-device boot classpath oat files. Test: imgdiag Bug: 162110941 Change-Id: Ic7b0b01a772444bc615b62cdb9305a1ef555c780
Diffstat (limited to 'compiler/driver/compiler_options.h')
-rw-r--r--compiler/driver/compiler_options.h15
1 files changed, 15 insertions, 0 deletions
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<std::string>& 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<std::string> image_classes_;
+ // Classes listed in the preloaded-classes file, used for boot image and
+ // boot image extension compilation.
+ HashSet<std::string> preloaded_classes_;
+
// Results of AOT verification.
const VerificationResults* verification_results_;