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
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 9438890..b2c3c2d 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -50,8 +50,7 @@
};
-CompiledMethod* OptimizingCompiler::TryCompile(CompilerDriver& driver,
- const DexFile::CodeItem* code_item,
+CompiledMethod* OptimizingCompiler::TryCompile(const DexFile::CodeItem* code_item,
uint32_t access_flags,
InvokeType invoke_type,
uint16_t class_def_idx,
@@ -60,7 +59,8 @@
const DexFile& dex_file) const {
DexCompilationUnit dex_compilation_unit(
nullptr, class_loader, art::Runtime::Current()->GetClassLinker(), dex_file, code_item,
- class_def_idx, method_idx, access_flags, driver.GetVerifiedMethod(&dex_file, method_idx));
+ class_def_idx, method_idx, access_flags,
+ GetCompilerDriver()->GetVerifiedMethod(&dex_file, method_idx));
// For testing purposes, we put a special marker on method names that should be compiled
// with this compiler. This makes sure we're not regressing.
@@ -77,7 +77,7 @@
return nullptr;
}
- InstructionSet instruction_set = driver.GetInstructionSet();
+ InstructionSet instruction_set = GetCompilerDriver()->GetInstructionSet();
// The optimizing compiler currently does not have a Thumb2 assembler.
if (instruction_set == kThumb2) {
instruction_set = kArm;
@@ -104,7 +104,7 @@
graph->BuildDominatorTree();
graph->TransformToSSA();
- return new CompiledMethod(driver,
+ return new CompiledMethod(GetCompilerDriver(),
instruction_set,
allocator.GetMemory(),
codegen->GetFrameSize(),