diff options
author | Ian Rogers <irogers@google.com> | 2014-05-06 16:20:11 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2014-05-06 16:23:19 -0700 |
commit | 72d32629303f8f39362a4099481f48646aed042f (patch) | |
tree | 0ff613168c3bf2e12799594c9211f9a1694119e2 /compiler/compiler.h | |
parent | 47ebd77a6d249403a34d242908749b7446da2a82 (diff) | |
download | android_art-72d32629303f8f39362a4099481f48646aed042f.tar.gz android_art-72d32629303f8f39362a4099481f48646aed042f.tar.bz2 android_art-72d32629303f8f39362a4099481f48646aed042f.zip |
Give Compiler a back reference to the driver.
The compiler driver is a single object delegating work to the compiler, rather
than passing it through to every Compiler call make it a member of Compiler so
that it maybe queried. This simplifies the Compiler API and makes the
relationship to CompilerDriver more explicit.
Remove reference arguments that contravene code style.
Change-Id: Iba47f2e3cbda679a7ec7588f26188d77643aa2c6
Diffstat (limited to 'compiler/compiler.h')
-rw-r--r-- | compiler/compiler.h | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/compiler/compiler.h b/compiler/compiler.h index 2357297b1d..4caebf32cd 100644 --- a/compiler/compiler.h +++ b/compiler/compiler.h @@ -41,18 +41,13 @@ class Compiler { kPortable }; - explicit Compiler(uint64_t warning) - : maximum_compilation_time_before_warning_(warning) { - } - - static Compiler* Create(Kind kind); + static Compiler* Create(CompilerDriver* driver, Kind kind); - virtual void Init(CompilerDriver& driver) const = 0; + virtual void Init() const = 0; - virtual void UnInit(CompilerDriver& driver) const = 0; + virtual void UnInit() const = 0; - virtual CompiledMethod* Compile(CompilerDriver& driver, - const DexFile::CodeItem* code_item, + virtual CompiledMethod* Compile(const DexFile::CodeItem* code_item, uint32_t access_flags, InvokeType invoke_type, uint16_t class_def_idx, @@ -60,8 +55,7 @@ class Compiler { jobject class_loader, const DexFile& dex_file) const = 0; - static CompiledMethod* TryCompileWithSeaIR(art::CompilerDriver& driver, - const art::DexFile::CodeItem* code_item, + static CompiledMethod* TryCompileWithSeaIR(const art::DexFile::CodeItem* code_item, uint32_t access_flags, art::InvokeType invoke_type, uint16_t class_def_idx, @@ -69,8 +63,7 @@ class Compiler { jobject class_loader, const art::DexFile& dex_file); - virtual CompiledMethod* JniCompile(CompilerDriver& driver, - uint32_t access_flags, + virtual CompiledMethod* JniCompile(uint32_t access_flags, uint32_t method_idx, const DexFile& dex_file) const = 0; @@ -81,11 +74,10 @@ class Compiler { OatWriter* oat_writer, const std::vector<const art::DexFile*>& dex_files, const std::string& android_root, - bool is_host, const CompilerDriver& driver) const + bool is_host) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0; - virtual Backend* GetCodeGenerator(CompilationUnit* cu, - void* compilation_unit) const = 0; + virtual Backend* GetCodeGenerator(CompilationUnit* cu, void* compilation_unit) const = 0; uint64_t GetMaximumCompilationTimeBeforeWarning() const { return maximum_compilation_time_before_warning_; @@ -117,7 +109,17 @@ class Compiler { return nullptr; } + protected: + explicit Compiler(CompilerDriver* driver, uint64_t warning) : + driver_(driver), maximum_compilation_time_before_warning_(warning) { + } + + CompilerDriver* GetCompilerDriver() const { + return driver_; + } + private: + CompilerDriver* const driver_; const uint64_t maximum_compilation_time_before_warning_; DISALLOW_COPY_AND_ASSIGN(Compiler); |