class ArtMethod; class DexFile; class InstructionSetFeatures; class ProfileCompilationInfo;
// Enum for CheckProfileMethodsCompiled. Outside CompilerOptions so it can be forward-declared. enumclass ProfileMethodsCheck : uint8_t {
kNone,
kLog,
kAbort,
};
class CompilerOptions final { public: // Default values for parameters set via flags. static constexpr bool kDefaultGenerateDebugInfo = false; static constexpr bool kDefaultGenerateMiniDebugInfo = true; static constexpr size_t kDefaultHugeMethodThreshold = 10000; static constexpr size_t kDefaultInlineMaxCodeUnits = 32; // Token to represent no value set for `inline_max_code_units_`. static constexpr size_t kUnsetInlineMaxCodeUnits = -1; // We set a lower inlining threshold for baseline to reduce code size and compilation time. This // cannot be changed via flags. static constexpr size_t kBaselineInlineMaxCodeUnits = 14; // Instruction limit to control memory. static constexpr size_t kInlineMaximumNumberOfTotalInstructions = 1024; // Maximum number of instructions for considering a method small, // which we will always try to inline if the other non-instruction limits // are not reached. static constexpr size_t kInlineMaximumNumberOfInstructionsForSmallMethod = 3; // Limit the number of dex registers that we accumulate while inlining // to avoid creating large amount of nested environments. static constexpr size_t kInlineMaximumNumberOfCumulatedDexRegisters = 32; // Limit recursive call inlining, which do not benefit from too // much inlining compared to code locality. static constexpr size_t kInlineMaximumNumberOfRecursiveCalls = 4;
enumclass CompilerType : uint8_t {
kAotCompiler, // AOT compiler.
kJitCompiler, // Normal JIT compiler.
kSharedCodeJitCompiler, // Zygote JIT producing code in the shared region area, putting // restrictions on, for example, how literals are being generated.
};
enumclass ImageType : uint8_t {
kNone, // JIT or AOT app compilation producing only an oat file but no image.
kBootImage, // Creating boot image.
kBootImageExtension, // Creating boot image extension.
kAppImage, // Creating app image.
};
bool IsJniCompilationEnabled() const { #ifdef ART_USE_RESTRICTED_MODE // TODO(Simulator): Support JNICompiler. // Without the JNI compiler, GenericJNITrampoline will be used for JNI calls. returnfalse; #else return CompilerFilter::IsJniCompilationEnabled(compiler_filter_); #endif
}
// This flag controls whether the compiler collects debugging information. // The other flags control how the information is written to disk. bool GenerateAnyDebugInfo() const { return GetGenerateDebugInfo() || GetGenerateMiniDebugInfo();
}
// Returns whether we are running ART tests. // The compiler will use that information for checking invariants. bool CompileArtTest() const { return compile_art_test_;
}
// Should the code be compiled as position independent? bool GetCompilePic() const { return compile_pic_;
}
// Returns whether the given `klass` is a no-preload class (one that is not allowed to be // initialized in zygote, either because it fails initialization, or because it is a logical // error to initialize it once for all processes).
EXPORT bool IsNoPreloadClass(Handle<mirror::Class> klass) const;
// Returns true if `dex_file` is within an oat file we're producing right now. bool WithinOatFile(const DexFile* dex_file) const { 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.
EXPORT bool ShouldCompileWithClinitCheck(ArtMethod* method) const;
// Dex files from which we should not inline code. Does not own the dex files. // This is usually a very short list (i.e. a single dex file), so we // prefer vector<> over a lookup-oriented container, such as set<>.
std::vector<const DexFile*> no_inline_from_;
// List of dex files associated with the oat file, empty for JIT.
std::vector<const DexFile*> dex_files_for_oat_file_;
// Image classes, specifies the classes that will be included in the image if creating an image. // Must not be empty for real boot image, only for tests pretending to compile boot image.
ImageClassMap image_classes_;
// Info for profile guided compilation. const ProfileCompilationInfo* profile_compilation_info_;
// Vector of methods to have verbose output enabled for.
std::vector<std::string> verbose_methods_;
// Abort compilation with an error if we find a class that fails verification with a hard // failure. bool abort_on_hard_verifier_failure_; // Same for soft failures. bool abort_on_soft_verifier_failure_;
// Log initialization of initialization failures to this stream if not null.
std::unique_ptr<std::ostream> init_failure_output_;
// Whether the compiler should trade performance for determinism to guarantee exactly reproducible // outcomes. bool force_determinism_;
// Whether the compiler should check for violation of the conditions required to perform AOT // "linkage". bool check_linkage_conditions_; // Whether the compiler should crash when encountering a violation of one of // the conditions required to perform AOT "linkage". bool crash_on_linkage_violation_;
// Whether code should be deduplicated. bool deduplicate_code_;
// Whether compiled code should increment the hotness count of ArtMethod. Note that the increments // won't be atomic for performance reasons, so we accept races, just like in interpreter. bool count_hotness_in_compiled_code_;
// Whether we eagerly resolve all of the const strings that are loaded from startup methods in the // profile. bool resolve_startup_const_strings_;
// Whether we attempt to run class initializers for app image classes. bool initialize_app_image_classes_;
// When running profile-guided compilation, check that methods intended to be compiled end // up compiled and are not punted.
ProfileMethodsCheck check_profiled_methods_;
// Maximum solid block size in the generated image.
uint32_t max_image_block_size_;
// If not null, specifies optimization passes which will be run instead of defaults. // Note that passes_to_run_ is not checked for correctness and providing an incorrect // list of passes can lead to unexpected compiler behaviour. This is caused by dependencies // between passes. Failing to satisfy them can for example lead to compiler crashes. // Passing pass names which are not recognized by the compiler will result in // compiler-dependant behavior. const std::vector<std::string>* passes_to_run_;
AssumeValueOptions assume_value_options_;
// Generate code for low-overhead tracing bool enable_profile_code_;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.