1*795d594fSAndroid Build Coastguard Worker /* 2*795d594fSAndroid Build Coastguard Worker * Copyright (C) 2011 The Android Open Source Project 3*795d594fSAndroid Build Coastguard Worker * 4*795d594fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*795d594fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*795d594fSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*795d594fSAndroid Build Coastguard Worker * 8*795d594fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*795d594fSAndroid Build Coastguard Worker * 10*795d594fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*795d594fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*795d594fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*795d594fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*795d594fSAndroid Build Coastguard Worker * limitations under the License. 15*795d594fSAndroid Build Coastguard Worker */ 16*795d594fSAndroid Build Coastguard Worker 17*795d594fSAndroid Build Coastguard Worker #ifndef ART_DEX2OAT_DRIVER_COMPILER_DRIVER_H_ 18*795d594fSAndroid Build Coastguard Worker #define ART_DEX2OAT_DRIVER_COMPILER_DRIVER_H_ 19*795d594fSAndroid Build Coastguard Worker 20*795d594fSAndroid Build Coastguard Worker #include <atomic> 21*795d594fSAndroid Build Coastguard Worker #include <set> 22*795d594fSAndroid Build Coastguard Worker #include <string> 23*795d594fSAndroid Build Coastguard Worker #include <vector> 24*795d594fSAndroid Build Coastguard Worker 25*795d594fSAndroid Build Coastguard Worker #include "arch/instruction_set.h" 26*795d594fSAndroid Build Coastguard Worker #include "base/array_ref.h" 27*795d594fSAndroid Build Coastguard Worker #include "base/bit_utils.h" 28*795d594fSAndroid Build Coastguard Worker #include "base/hash_set.h" 29*795d594fSAndroid Build Coastguard Worker #include "base/mutex.h" 30*795d594fSAndroid Build Coastguard Worker #include "base/os.h" 31*795d594fSAndroid Build Coastguard Worker #include "base/quasi_atomic.h" 32*795d594fSAndroid Build Coastguard Worker #include "base/safe_map.h" 33*795d594fSAndroid Build Coastguard Worker #include "base/timing_logger.h" 34*795d594fSAndroid Build Coastguard Worker #include "class_status.h" 35*795d594fSAndroid Build Coastguard Worker #include "compiler.h" 36*795d594fSAndroid Build Coastguard Worker #include "dex/class_reference.h" 37*795d594fSAndroid Build Coastguard Worker #include "dex/dex_file_types.h" 38*795d594fSAndroid Build Coastguard Worker #include "dex/method_reference.h" 39*795d594fSAndroid Build Coastguard Worker #include "driver/compiled_method_storage.h" 40*795d594fSAndroid Build Coastguard Worker #include "thread_pool.h" 41*795d594fSAndroid Build Coastguard Worker #include "utils/atomic_dex_ref_map.h" 42*795d594fSAndroid Build Coastguard Worker 43*795d594fSAndroid Build Coastguard Worker namespace art { 44*795d594fSAndroid Build Coastguard Worker 45*795d594fSAndroid Build Coastguard Worker namespace dex { 46*795d594fSAndroid Build Coastguard Worker struct CodeItem; 47*795d594fSAndroid Build Coastguard Worker } // namespace dex 48*795d594fSAndroid Build Coastguard Worker 49*795d594fSAndroid Build Coastguard Worker namespace mirror { 50*795d594fSAndroid Build Coastguard Worker class Class; 51*795d594fSAndroid Build Coastguard Worker class DexCache; 52*795d594fSAndroid Build Coastguard Worker } // namespace mirror 53*795d594fSAndroid Build Coastguard Worker 54*795d594fSAndroid Build Coastguard Worker namespace verifier { 55*795d594fSAndroid Build Coastguard Worker class MethodVerifier; 56*795d594fSAndroid Build Coastguard Worker class VerifierDepsTest; 57*795d594fSAndroid Build Coastguard Worker } // namespace verifier 58*795d594fSAndroid Build Coastguard Worker 59*795d594fSAndroid Build Coastguard Worker class ArtField; 60*795d594fSAndroid Build Coastguard Worker class BitVector; 61*795d594fSAndroid Build Coastguard Worker class CompiledMethod; 62*795d594fSAndroid Build Coastguard Worker class CompilerOptions; 63*795d594fSAndroid Build Coastguard Worker class DexCompilationUnit; 64*795d594fSAndroid Build Coastguard Worker class DexFile; 65*795d594fSAndroid Build Coastguard Worker template<class T> class Handle; 66*795d594fSAndroid Build Coastguard Worker struct InlineIGetIPutData; 67*795d594fSAndroid Build Coastguard Worker class InstructionSetFeatures; 68*795d594fSAndroid Build Coastguard Worker class InternTable; 69*795d594fSAndroid Build Coastguard Worker enum InvokeType : uint32_t; 70*795d594fSAndroid Build Coastguard Worker class MemberOffset; 71*795d594fSAndroid Build Coastguard Worker template<class MirrorType> class ObjPtr; 72*795d594fSAndroid Build Coastguard Worker class ParallelCompilationManager; 73*795d594fSAndroid Build Coastguard Worker class ProfileCompilationInfo; 74*795d594fSAndroid Build Coastguard Worker class ScopedObjectAccess; 75*795d594fSAndroid Build Coastguard Worker template <class Allocator> class SrcMap; 76*795d594fSAndroid Build Coastguard Worker class TimingLogger; 77*795d594fSAndroid Build Coastguard Worker class VdexFile; 78*795d594fSAndroid Build Coastguard Worker class VerificationResults; 79*795d594fSAndroid Build Coastguard Worker 80*795d594fSAndroid Build Coastguard Worker class CompilerDriver { 81*795d594fSAndroid Build Coastguard Worker public: 82*795d594fSAndroid Build Coastguard Worker // Create a compiler targeting the requested "instruction_set". 83*795d594fSAndroid Build Coastguard Worker // "image" should be true if image specific optimizations should be 84*795d594fSAndroid Build Coastguard Worker // enabled. "image_classes" lets the compiler know what classes it 85*795d594fSAndroid Build Coastguard Worker // can assume will be in the image, with null implying all available 86*795d594fSAndroid Build Coastguard Worker // classes. 87*795d594fSAndroid Build Coastguard Worker CompilerDriver(const CompilerOptions* compiler_options, 88*795d594fSAndroid Build Coastguard Worker const VerificationResults* verification_results, 89*795d594fSAndroid Build Coastguard Worker size_t thread_count, 90*795d594fSAndroid Build Coastguard Worker int swap_fd); 91*795d594fSAndroid Build Coastguard Worker 92*795d594fSAndroid Build Coastguard Worker ~CompilerDriver(); 93*795d594fSAndroid Build Coastguard Worker 94*795d594fSAndroid Build Coastguard Worker void PrepareDexFilesForOatFile(TimingLogger* timings); 95*795d594fSAndroid Build Coastguard Worker 96*795d594fSAndroid Build Coastguard Worker // Set dex files classpath. 97*795d594fSAndroid Build Coastguard Worker void SetClasspathDexFiles(const std::vector<const DexFile*>& dex_files); 98*795d594fSAndroid Build Coastguard Worker 99*795d594fSAndroid Build Coastguard Worker // Initialize and destroy thread pools. This is exposed because we do not want 100*795d594fSAndroid Build Coastguard Worker // to do this twice, for PreCompile() and CompileAll(). 101*795d594fSAndroid Build Coastguard Worker void InitializeThreadPools(); 102*795d594fSAndroid Build Coastguard Worker void FreeThreadPools(); 103*795d594fSAndroid Build Coastguard Worker 104*795d594fSAndroid Build Coastguard Worker void PreCompile(jobject class_loader, 105*795d594fSAndroid Build Coastguard Worker const std::vector<const DexFile*>& dex_files, 106*795d594fSAndroid Build Coastguard Worker TimingLogger* timings, 107*795d594fSAndroid Build Coastguard Worker /*inout*/ HashSet<std::string>* image_classes) 108*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 109*795d594fSAndroid Build Coastguard Worker void CompileAll(jobject class_loader, 110*795d594fSAndroid Build Coastguard Worker const std::vector<const DexFile*>& dex_files, 111*795d594fSAndroid Build Coastguard Worker TimingLogger* timings) 112*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 113*795d594fSAndroid Build Coastguard Worker GetCompilerOptions()114*795d594fSAndroid Build Coastguard Worker const CompilerOptions& GetCompilerOptions() const { 115*795d594fSAndroid Build Coastguard Worker return *compiler_options_; 116*795d594fSAndroid Build Coastguard Worker } 117*795d594fSAndroid Build Coastguard Worker GetVerificationResults()118*795d594fSAndroid Build Coastguard Worker const VerificationResults* GetVerificationResults() const { 119*795d594fSAndroid Build Coastguard Worker return verification_results_; 120*795d594fSAndroid Build Coastguard Worker } 121*795d594fSAndroid Build Coastguard Worker GetCompiler()122*795d594fSAndroid Build Coastguard Worker Compiler* GetCompiler() const { 123*795d594fSAndroid Build Coastguard Worker return compiler_.get(); 124*795d594fSAndroid Build Coastguard Worker } 125*795d594fSAndroid Build Coastguard Worker 126*795d594fSAndroid Build Coastguard Worker // Generate the trampolines that are invoked by unresolved direct methods. 127*795d594fSAndroid Build Coastguard Worker std::unique_ptr<const std::vector<uint8_t>> CreateJniDlsymLookupTrampoline() const; 128*795d594fSAndroid Build Coastguard Worker std::unique_ptr<const std::vector<uint8_t>> CreateJniDlsymLookupCriticalTrampoline() const; 129*795d594fSAndroid Build Coastguard Worker std::unique_ptr<const std::vector<uint8_t>> CreateQuickGenericJniTrampoline() const; 130*795d594fSAndroid Build Coastguard Worker std::unique_ptr<const std::vector<uint8_t>> CreateQuickImtConflictTrampoline() const; 131*795d594fSAndroid Build Coastguard Worker std::unique_ptr<const std::vector<uint8_t>> CreateQuickResolutionTrampoline() const; 132*795d594fSAndroid Build Coastguard Worker std::unique_ptr<const std::vector<uint8_t>> CreateQuickToInterpreterBridge() const; 133*795d594fSAndroid Build Coastguard Worker std::unique_ptr<const std::vector<uint8_t>> CreateNterpTrampoline() const; 134*795d594fSAndroid Build Coastguard Worker 135*795d594fSAndroid Build Coastguard Worker ClassStatus GetClassStatus(const ClassReference& ref) const; 136*795d594fSAndroid Build Coastguard Worker bool GetCompiledClass(const ClassReference& ref, ClassStatus* status) const; 137*795d594fSAndroid Build Coastguard Worker 138*795d594fSAndroid Build Coastguard Worker CompiledMethod* GetCompiledMethod(MethodReference ref) const; 139*795d594fSAndroid Build Coastguard Worker // Add a compiled method. 140*795d594fSAndroid Build Coastguard Worker void AddCompiledMethod(const MethodReference& method_ref, CompiledMethod* const compiled_method); 141*795d594fSAndroid Build Coastguard Worker CompiledMethod* RemoveCompiledMethod(const MethodReference& method_ref); 142*795d594fSAndroid Build Coastguard Worker 143*795d594fSAndroid Build Coastguard Worker // Resolve compiling method's class. Returns null on failure. 144*795d594fSAndroid Build Coastguard Worker ObjPtr<mirror::Class> ResolveCompilingMethodsClass(const ScopedObjectAccess& soa, 145*795d594fSAndroid Build Coastguard Worker Handle<mirror::DexCache> dex_cache, 146*795d594fSAndroid Build Coastguard Worker Handle<mirror::ClassLoader> class_loader, 147*795d594fSAndroid Build Coastguard Worker const DexCompilationUnit* mUnit) 148*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 149*795d594fSAndroid Build Coastguard Worker 150*795d594fSAndroid Build Coastguard Worker ObjPtr<mirror::Class> ResolveClass(const ScopedObjectAccess& soa, 151*795d594fSAndroid Build Coastguard Worker Handle<mirror::DexCache> dex_cache, 152*795d594fSAndroid Build Coastguard Worker Handle<mirror::ClassLoader> class_loader, 153*795d594fSAndroid Build Coastguard Worker dex::TypeIndex type_index, 154*795d594fSAndroid Build Coastguard Worker const DexCompilationUnit* mUnit) 155*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 156*795d594fSAndroid Build Coastguard Worker 157*795d594fSAndroid Build Coastguard Worker // Resolve a field. Returns null on failure, including incompatible class change. 158*795d594fSAndroid Build Coastguard Worker // NOTE: Unlike ClassLinker's ResolveField(), this method enforces is_static. 159*795d594fSAndroid Build Coastguard Worker ArtField* ResolveField(const ScopedObjectAccess& soa, 160*795d594fSAndroid Build Coastguard Worker Handle<mirror::DexCache> dex_cache, 161*795d594fSAndroid Build Coastguard Worker Handle<mirror::ClassLoader> class_loader, 162*795d594fSAndroid Build Coastguard Worker uint32_t field_idx, 163*795d594fSAndroid Build Coastguard Worker bool is_static) 164*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 165*795d594fSAndroid Build Coastguard Worker 166*795d594fSAndroid Build Coastguard Worker // Can we fast-path an IGET/IPUT access to an instance field? If yes, compute the field offset. 167*795d594fSAndroid Build Coastguard Worker std::pair<bool, bool> IsFastInstanceField(ObjPtr<mirror::DexCache> dex_cache, 168*795d594fSAndroid Build Coastguard Worker ObjPtr<mirror::Class> referrer_class, 169*795d594fSAndroid Build Coastguard Worker ArtField* resolved_field, 170*795d594fSAndroid Build Coastguard Worker uint16_t field_idx) 171*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 172*795d594fSAndroid Build Coastguard Worker 173*795d594fSAndroid Build Coastguard Worker void ProcessedInstanceField(bool resolved); 174*795d594fSAndroid Build Coastguard Worker void ProcessedStaticField(bool resolved, bool local); 175*795d594fSAndroid Build Coastguard Worker 176*795d594fSAndroid Build Coastguard Worker // Can we fast path instance field access? Computes field's offset and volatility. 177*795d594fSAndroid Build Coastguard Worker bool ComputeInstanceFieldInfo(uint32_t field_idx, const DexCompilationUnit* mUnit, bool is_put, 178*795d594fSAndroid Build Coastguard Worker MemberOffset* field_offset, bool* is_volatile) 179*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 180*795d594fSAndroid Build Coastguard Worker 181*795d594fSAndroid Build Coastguard Worker ArtField* ComputeInstanceFieldInfo(uint32_t field_idx, 182*795d594fSAndroid Build Coastguard Worker const DexCompilationUnit* mUnit, 183*795d594fSAndroid Build Coastguard Worker bool is_put, 184*795d594fSAndroid Build Coastguard Worker const ScopedObjectAccess& soa) 185*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 186*795d594fSAndroid Build Coastguard Worker 187*795d594fSAndroid Build Coastguard Worker GetThreadCount()188*795d594fSAndroid Build Coastguard Worker size_t GetThreadCount() const { 189*795d594fSAndroid Build Coastguard Worker return parallel_thread_count_; 190*795d594fSAndroid Build Coastguard Worker } 191*795d594fSAndroid Build Coastguard Worker SetDedupeEnabled(bool dedupe_enabled)192*795d594fSAndroid Build Coastguard Worker void SetDedupeEnabled(bool dedupe_enabled) { 193*795d594fSAndroid Build Coastguard Worker compiled_method_storage_.SetDedupeEnabled(dedupe_enabled); 194*795d594fSAndroid Build Coastguard Worker } 195*795d594fSAndroid Build Coastguard Worker DedupeEnabled()196*795d594fSAndroid Build Coastguard Worker bool DedupeEnabled() const { 197*795d594fSAndroid Build Coastguard Worker return compiled_method_storage_.DedupeEnabled(); 198*795d594fSAndroid Build Coastguard Worker } 199*795d594fSAndroid Build Coastguard Worker 200*795d594fSAndroid Build Coastguard Worker // Checks whether profile guided verification is enabled and if the method should be verified 201*795d594fSAndroid Build Coastguard Worker // according to the profile file. 202*795d594fSAndroid Build Coastguard Worker bool ShouldVerifyClassBasedOnProfile(const DexFile& dex_file, uint16_t class_idx) const; 203*795d594fSAndroid Build Coastguard Worker 204*795d594fSAndroid Build Coastguard Worker void RecordClassStatus(const ClassReference& ref, ClassStatus status); 205*795d594fSAndroid Build Coastguard Worker 206*795d594fSAndroid Build Coastguard Worker // Get memory usage during compilation. 207*795d594fSAndroid Build Coastguard Worker std::string GetMemoryUsageString(bool extended) const; 208*795d594fSAndroid Build Coastguard Worker SetHadHardVerifierFailure()209*795d594fSAndroid Build Coastguard Worker void SetHadHardVerifierFailure() { 210*795d594fSAndroid Build Coastguard Worker had_hard_verifier_failure_ = true; 211*795d594fSAndroid Build Coastguard Worker } AddSoftVerifierFailure()212*795d594fSAndroid Build Coastguard Worker void AddSoftVerifierFailure() { 213*795d594fSAndroid Build Coastguard Worker number_of_soft_verifier_failures_++; 214*795d594fSAndroid Build Coastguard Worker } 215*795d594fSAndroid Build Coastguard Worker GetCompiledMethodStorage()216*795d594fSAndroid Build Coastguard Worker CompiledMethodStorage* GetCompiledMethodStorage() { 217*795d594fSAndroid Build Coastguard Worker return &compiled_method_storage_; 218*795d594fSAndroid Build Coastguard Worker } 219*795d594fSAndroid Build Coastguard Worker GetCompiledMethodStorage()220*795d594fSAndroid Build Coastguard Worker const CompiledMethodStorage* GetCompiledMethodStorage() const { 221*795d594fSAndroid Build Coastguard Worker return &compiled_method_storage_; 222*795d594fSAndroid Build Coastguard Worker } 223*795d594fSAndroid Build Coastguard Worker 224*795d594fSAndroid Build Coastguard Worker private: 225*795d594fSAndroid Build Coastguard Worker void LoadImageClasses(TimingLogger* timings, 226*795d594fSAndroid Build Coastguard Worker jobject class_loader, 227*795d594fSAndroid Build Coastguard Worker /*inout*/ HashSet<std::string>* image_classes) 228*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 229*795d594fSAndroid Build Coastguard Worker 230*795d594fSAndroid Build Coastguard Worker // Attempt to resolve all type, methods, fields, and strings 231*795d594fSAndroid Build Coastguard Worker // referenced from code in the dex file following PathClassLoader 232*795d594fSAndroid Build Coastguard Worker // ordering semantics. 233*795d594fSAndroid Build Coastguard Worker void Resolve(jobject class_loader, 234*795d594fSAndroid Build Coastguard Worker const std::vector<const DexFile*>& dex_files, 235*795d594fSAndroid Build Coastguard Worker TimingLogger* timings) 236*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 237*795d594fSAndroid Build Coastguard Worker void ResolveDexFile(jobject class_loader, 238*795d594fSAndroid Build Coastguard Worker const DexFile& dex_file, 239*795d594fSAndroid Build Coastguard Worker ThreadPool* thread_pool, 240*795d594fSAndroid Build Coastguard Worker size_t thread_count, 241*795d594fSAndroid Build Coastguard Worker TimingLogger* timings) 242*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 243*795d594fSAndroid Build Coastguard Worker 244*795d594fSAndroid Build Coastguard Worker // Do fast verification through VerifierDeps if possible. Return whether 245*795d594fSAndroid Build Coastguard Worker // verification was successful. 246*795d594fSAndroid Build Coastguard Worker bool FastVerify(jobject class_loader, 247*795d594fSAndroid Build Coastguard Worker const std::vector<const DexFile*>& dex_files, 248*795d594fSAndroid Build Coastguard Worker TimingLogger* timings); 249*795d594fSAndroid Build Coastguard Worker 250*795d594fSAndroid Build Coastguard Worker void Verify(jobject class_loader, 251*795d594fSAndroid Build Coastguard Worker const std::vector<const DexFile*>& dex_files, 252*795d594fSAndroid Build Coastguard Worker TimingLogger* timings); 253*795d594fSAndroid Build Coastguard Worker 254*795d594fSAndroid Build Coastguard Worker void VerifyDexFile(jobject class_loader, 255*795d594fSAndroid Build Coastguard Worker const DexFile& dex_file, 256*795d594fSAndroid Build Coastguard Worker ThreadPool* thread_pool, 257*795d594fSAndroid Build Coastguard Worker size_t thread_count, 258*795d594fSAndroid Build Coastguard Worker TimingLogger* timings) 259*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 260*795d594fSAndroid Build Coastguard Worker 261*795d594fSAndroid Build Coastguard Worker void SetVerified(jobject class_loader, 262*795d594fSAndroid Build Coastguard Worker const std::vector<const DexFile*>& dex_files, 263*795d594fSAndroid Build Coastguard Worker TimingLogger* timings); 264*795d594fSAndroid Build Coastguard Worker void SetVerifiedDexFile(jobject class_loader, 265*795d594fSAndroid Build Coastguard Worker const DexFile& dex_file, 266*795d594fSAndroid Build Coastguard Worker ThreadPool* thread_pool, 267*795d594fSAndroid Build Coastguard Worker size_t thread_count, 268*795d594fSAndroid Build Coastguard Worker TimingLogger* timings) 269*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 270*795d594fSAndroid Build Coastguard Worker 271*795d594fSAndroid Build Coastguard Worker void InitializeClasses(jobject class_loader, 272*795d594fSAndroid Build Coastguard Worker const std::vector<const DexFile*>& dex_files, 273*795d594fSAndroid Build Coastguard Worker TimingLogger* timings) 274*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 275*795d594fSAndroid Build Coastguard Worker void InitializeClasses(jobject class_loader, 276*795d594fSAndroid Build Coastguard Worker const DexFile& dex_file, 277*795d594fSAndroid Build Coastguard Worker TimingLogger* timings) 278*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 279*795d594fSAndroid Build Coastguard Worker 280*795d594fSAndroid Build Coastguard Worker void UpdateImageClasses(TimingLogger* timings, /*inout*/ HashSet<std::string>* image_classes) 281*795d594fSAndroid Build Coastguard Worker REQUIRES(!Locks::mutator_lock_); 282*795d594fSAndroid Build Coastguard Worker 283*795d594fSAndroid Build Coastguard Worker void Compile(jobject class_loader, 284*795d594fSAndroid Build Coastguard Worker const std::vector<const DexFile*>& dex_files, 285*795d594fSAndroid Build Coastguard Worker TimingLogger* timings); 286*795d594fSAndroid Build Coastguard Worker 287*795d594fSAndroid Build Coastguard Worker void CheckThreadPools(); 288*795d594fSAndroid Build Coastguard Worker 289*795d594fSAndroid Build Coastguard Worker // Resolve const string literals that are loaded from dex code. If only_startup_strings is 290*795d594fSAndroid Build Coastguard Worker // specified, only methods that are marked startup in the profile are resolved. 291*795d594fSAndroid Build Coastguard Worker void ResolveConstStrings(const std::vector<const DexFile*>& dex_files, 292*795d594fSAndroid Build Coastguard Worker bool only_startup_strings, 293*795d594fSAndroid Build Coastguard Worker /*inout*/ TimingLogger* timings); 294*795d594fSAndroid Build Coastguard Worker 295*795d594fSAndroid Build Coastguard Worker const CompilerOptions* const compiler_options_; 296*795d594fSAndroid Build Coastguard Worker const VerificationResults* const verification_results_; 297*795d594fSAndroid Build Coastguard Worker 298*795d594fSAndroid Build Coastguard Worker std::unique_ptr<Compiler> compiler_; 299*795d594fSAndroid Build Coastguard Worker 300*795d594fSAndroid Build Coastguard Worker // All class references that this compiler has compiled. Indexed by class defs. 301*795d594fSAndroid Build Coastguard Worker using ClassStateTable = AtomicDexRefMap<ClassReference, ClassStatus>; 302*795d594fSAndroid Build Coastguard Worker ClassStateTable compiled_classes_; 303*795d594fSAndroid Build Coastguard Worker // All class references that are in the classpath. Indexed by class defs. 304*795d594fSAndroid Build Coastguard Worker ClassStateTable classpath_classes_; 305*795d594fSAndroid Build Coastguard Worker 306*795d594fSAndroid Build Coastguard Worker using MethodTable = AtomicDexRefMap<MethodReference, CompiledMethod*>; 307*795d594fSAndroid Build Coastguard Worker 308*795d594fSAndroid Build Coastguard Worker // All method references that this compiler has compiled. 309*795d594fSAndroid Build Coastguard Worker MethodTable compiled_methods_; 310*795d594fSAndroid Build Coastguard Worker 311*795d594fSAndroid Build Coastguard Worker std::atomic<uint32_t> number_of_soft_verifier_failures_; 312*795d594fSAndroid Build Coastguard Worker 313*795d594fSAndroid Build Coastguard Worker bool had_hard_verifier_failure_; 314*795d594fSAndroid Build Coastguard Worker 315*795d594fSAndroid Build Coastguard Worker // A thread pool that can (potentially) run tasks in parallel. 316*795d594fSAndroid Build Coastguard Worker size_t parallel_thread_count_; 317*795d594fSAndroid Build Coastguard Worker std::unique_ptr<ThreadPool> parallel_thread_pool_; 318*795d594fSAndroid Build Coastguard Worker 319*795d594fSAndroid Build Coastguard Worker // A thread pool that guarantees running single-threaded on the main thread. 320*795d594fSAndroid Build Coastguard Worker std::unique_ptr<ThreadPool> single_thread_pool_; 321*795d594fSAndroid Build Coastguard Worker 322*795d594fSAndroid Build Coastguard Worker class AOTCompilationStats; 323*795d594fSAndroid Build Coastguard Worker std::unique_ptr<AOTCompilationStats> stats_; 324*795d594fSAndroid Build Coastguard Worker 325*795d594fSAndroid Build Coastguard Worker CompiledMethodStorage compiled_method_storage_; 326*795d594fSAndroid Build Coastguard Worker 327*795d594fSAndroid Build Coastguard Worker size_t max_arena_alloc_; 328*795d594fSAndroid Build Coastguard Worker 329*795d594fSAndroid Build Coastguard Worker friend class CommonCompilerDriverTest; 330*795d594fSAndroid Build Coastguard Worker friend class CompileClassVisitor; 331*795d594fSAndroid Build Coastguard Worker friend class InitializeClassVisitor; 332*795d594fSAndroid Build Coastguard Worker friend class verifier::VerifierDepsTest; 333*795d594fSAndroid Build Coastguard Worker DISALLOW_COPY_AND_ASSIGN(CompilerDriver); 334*795d594fSAndroid Build Coastguard Worker }; 335*795d594fSAndroid Build Coastguard Worker 336*795d594fSAndroid Build Coastguard Worker } // namespace art 337*795d594fSAndroid Build Coastguard Worker 338*795d594fSAndroid Build Coastguard Worker #endif // ART_DEX2OAT_DRIVER_COMPILER_DRIVER_H_ 339