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/llvm/compiler_llvm.cc | |
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/llvm/compiler_llvm.cc')
-rw-r--r-- | compiler/llvm/compiler_llvm.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/compiler/llvm/compiler_llvm.cc b/compiler/llvm/compiler_llvm.cc index 2812700fa3..df895ee07d 100644 --- a/compiler/llvm/compiler_llvm.cc +++ b/compiler/llvm/compiler_llvm.cc @@ -175,8 +175,8 @@ CompileNativeMethod(DexCompilationUnit* dex_compilation_unit) { } // namespace llvm } // namespace art -static art::llvm::CompilerLLVM* ContextOf(art::CompilerDriver& driver) { - void *compiler_context = driver.GetCompilerContext(); +static art::llvm::CompilerLLVM* ContextOf(art::CompilerDriver* driver) { + void *compiler_context = driver->GetCompilerContext(); CHECK(compiler_context != NULL); return reinterpret_cast<art::llvm::CompilerLLVM*>(compiler_context); } @@ -187,20 +187,20 @@ static art::llvm::CompilerLLVM* ContextOf(const art::CompilerDriver& driver) { return reinterpret_cast<art::llvm::CompilerLLVM*>(compiler_context); } -extern "C" void ArtInitCompilerContext(art::CompilerDriver& driver) { - CHECK(driver.GetCompilerContext() == NULL); +extern "C" void ArtInitCompilerContext(art::CompilerDriver* driver) { + CHECK(driver->GetCompilerContext() == nullptr); - art::llvm::CompilerLLVM* compiler_llvm = new art::llvm::CompilerLLVM(&driver, - driver.GetInstructionSet()); + art::llvm::CompilerLLVM* compiler_llvm = new art::llvm::CompilerLLVM(driver, + driver->GetInstructionSet()); - driver.SetCompilerContext(compiler_llvm); + driver->SetCompilerContext(compiler_llvm); } -extern "C" void ArtUnInitCompilerContext(art::CompilerDriver& driver) { +extern "C" void ArtUnInitCompilerContext(art::CompilerDriver* driver) { delete ContextOf(driver); - driver.SetCompilerContext(NULL); + driver->SetCompilerContext(nullptr); } -extern "C" art::CompiledMethod* ArtCompileMethod(art::CompilerDriver& driver, +extern "C" art::CompiledMethod* ArtCompileMethod(art::CompilerDriver* driver, const art::DexFile::CodeItem* code_item, uint32_t access_flags, art::InvokeType invoke_type, @@ -213,13 +213,13 @@ extern "C" art::CompiledMethod* ArtCompileMethod(art::CompilerDriver& driver, art::DexCompilationUnit dex_compilation_unit( NULL, class_loader, class_linker, dex_file, code_item, - class_def_idx, method_idx, access_flags, driver.GetVerifiedMethod(&dex_file, method_idx)); + class_def_idx, method_idx, access_flags, driver->GetVerifiedMethod(&dex_file, method_idx)); art::llvm::CompilerLLVM* compiler_llvm = ContextOf(driver); art::CompiledMethod* result = compiler_llvm->CompileDexMethod(&dex_compilation_unit, invoke_type); return result; } -extern "C" art::CompiledMethod* ArtLLVMJniCompileMethod(art::CompilerDriver& driver, +extern "C" art::CompiledMethod* ArtLLVMJniCompileMethod(art::CompilerDriver* driver, uint32_t access_flags, uint32_t method_idx, const art::DexFile& dex_file) { art::ClassLinker *class_linker = art::Runtime::Current()->GetClassLinker(); |