diff options
41 files changed, 397 insertions, 383 deletions
diff --git a/build/Android.common.mk b/build/Android.common.mk index b9b52986c6..d2f86f5431 100644 --- a/build/Android.common.mk +++ b/build/Android.common.mk @@ -140,7 +140,7 @@ LIBART_COMMON_SRC_FILES := \ src/class_linker.cc \ src/common_throws.cc \ src/compiled_method.cc \ - src/compiler.cc \ + src/compiler/driver/compiler_driver.cc \ src/compiler_llvm/procedure_linkage_table.cc \ src/compiler_llvm/runtime_support_llvm.cc \ src/debugger.cc \ @@ -375,7 +375,7 @@ TEST_COMMON_SRC_FILES := \ src/base/unix_file/random_access_file_utils_test.cc \ src/base/unix_file/string_file_test.cc \ src/class_linker_test.cc \ - src/compiler_test.cc \ + src/compiler/driver/compiler_driver_test.cc \ src/dex_file_test.cc \ src/dex_instruction_visitor_test.cc \ src/elf_writer_test.cc \ diff --git a/src/common_test.h b/src/common_test.h index d78576c1e6..0d3795e1e6 100644 --- a/src/common_test.h +++ b/src/common_test.h @@ -26,7 +26,7 @@ #include "base/stringprintf.h" #include "base/unix_file/fd_file.h" #include "class_linker.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "dex_file.h" #include "gtest/gtest.h" #include "heap.h" @@ -210,7 +210,7 @@ class CommonTest : public testing::Test { MethodHelper mh(method); const CompiledInvokeStub* compiled_invoke_stub = - compiler_->FindInvokeStub(mh.IsStatic(), mh.GetShorty()); + compiler_driver_->FindInvokeStub(mh.IsStatic(), mh.GetShorty()); CHECK(compiled_invoke_stub != NULL) << PrettyMethod(method); const std::vector<uint8_t>& invoke_stub = compiled_invoke_stub->GetCode(); @@ -227,8 +227,8 @@ class CommonTest : public testing::Test { const mirror::DexCache* dex_cache = method->GetDeclaringClass()->GetDexCache(); const DexFile& dex_file = *dex_cache->GetDexFile(); const CompiledMethod* compiled_method = - compiler_->GetCompiledMethod(Compiler::MethodReference(&dex_file, - method->GetDexMethodIndex())); + compiler_driver_->GetCompiledMethod(CompilerDriver::MethodReference(&dex_file, + method->GetDexMethodIndex())); CHECK(compiled_method != NULL) << PrettyMethod(method); const std::vector<uint8_t>& code = compiled_method->GetCode(); @@ -364,13 +364,13 @@ class CommonTest : public testing::Test { CompilerBackend compiler_backend = kQuick; #endif - runtime_->SetJniDlsymLookupStub(Compiler::CreateJniDlsymLookupStub(instruction_set)); - runtime_->SetAbstractMethodErrorStubArray(Compiler::CreateAbstractMethodErrorStub(instruction_set)); + runtime_->SetJniDlsymLookupStub(CompilerDriver::CreateJniDlsymLookupStub(instruction_set)); + runtime_->SetAbstractMethodErrorStubArray(CompilerDriver::CreateAbstractMethodErrorStub(instruction_set)); for (int i = 0; i < Runtime::kLastTrampolineMethodType; i++) { Runtime::TrampolineType type = Runtime::TrampolineType(i); if (!runtime_->HasResolutionStubArray(type)) { runtime_->SetResolutionStubArray( - Compiler::CreateResolutionStub(instruction_set, type), type); + CompilerDriver::CreateResolutionStub(instruction_set, type), type); } } if (!runtime_->HasResolutionMethod()) { @@ -385,8 +385,8 @@ class CommonTest : public testing::Test { } class_linker_->FixupDexCaches(runtime_->GetResolutionMethod()); image_classes_.reset(new std::set<std::string>); - compiler_.reset(new Compiler(compiler_backend, instruction_set, true, 2, false, image_classes_.get(), - true, true)); + compiler_driver_.reset(new CompilerDriver(compiler_backend, instruction_set, true, 2, false, image_classes_.get(), + true, true)); // Create the heap thread pool so that the GC runs in parallel for tests. Normally, the thread // pool is created by the runtime. @@ -426,7 +426,7 @@ class CommonTest : public testing::Test { IcuCleanupFn icu_cleanup_fn = reinterpret_cast<IcuCleanupFn>(sym); (*icu_cleanup_fn)(); - compiler_.reset(); + compiler_driver_.reset(); image_classes_.reset(); STLDeleteElements(&opened_dex_files_); @@ -490,7 +490,7 @@ class CommonTest : public testing::Test { void CompileMethod(mirror::AbstractMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { CHECK(method != NULL); - compiler_->CompileOne(method); + compiler_driver_->CompileOne(method); MakeExecutable(method); MakeExecutable(runtime_->GetJniDlsymLookupStub()); @@ -543,7 +543,7 @@ class CommonTest : public testing::Test { UniquePtr<Runtime> runtime_; // Owned by the runtime ClassLinker* class_linker_; - UniquePtr<Compiler> compiler_; + UniquePtr<CompilerDriver> compiler_driver_; UniquePtr<std::set<std::string> > image_classes_; private: diff --git a/src/compiler/dex/compiler_internals.h b/src/compiler/dex/compiler_internals.h index c85700af1a..8a44bb8fd6 100644 --- a/src/compiler/dex/compiler_internals.h +++ b/src/compiler/dex/compiler_internals.h @@ -25,7 +25,7 @@ #include "base/logging.h" #include "class_linker.h" #include "quick/codegen.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "compiler_ir.h" #include "compiler_utility.h" #include "frontend.h" diff --git a/src/compiler/dex/compiler_ir.h b/src/compiler/dex/compiler_ir.h index c961d0baaf..04dee77b5a 100644 --- a/src/compiler/dex/compiler_ir.h +++ b/src/compiler/dex/compiler_ir.h @@ -19,7 +19,7 @@ #include <vector> #include "dex_instruction.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "compiler_utility.h" #include "oat_compilation_unit.h" #include "safe_map.h" @@ -274,7 +274,7 @@ class Codegen; struct CompilationUnit { CompilationUnit() : num_blocks(0), - compiler(NULL), + compiler_driver(NULL), class_linker(NULL), dex_file(NULL), class_loader(NULL), @@ -366,7 +366,7 @@ struct CompilationUnit { int num_blocks; GrowableList block_list; - Compiler* compiler; // Compiler driving this compiler. + CompilerDriver* compiler_driver; ClassLinker* class_linker; // Linker to resolve fields and methods. const DexFile* dex_file; // DexFile containing the method being compiled. jobject class_loader; // compiling method's class loader. diff --git a/src/compiler/dex/dataflow.cc b/src/compiler/dex/dataflow.cc index 2ce16a4aa0..0fa9ab1bef 100644 --- a/src/compiler/dex/dataflow.cc +++ b/src/compiler/dex/dataflow.cc @@ -2501,9 +2501,9 @@ static bool InvokeUsesMethodStar(CompilationUnit* cu, MIR* mir) uintptr_t direct_code; uintptr_t direct_method; bool fast_path = - cu->compiler->ComputeInvokeInfo(dex_method_idx, &m_unit, type, - vtable_idx, direct_code, - direct_method) && + cu->compiler_driver->ComputeInvokeInfo(dex_method_idx, &m_unit, type, + vtable_idx, direct_code, + direct_method) && !SLOW_INVOKE_PATH; return (((type == kDirect) || (type == kStatic)) && fast_path && ((direct_code == 0) || (direct_method == 0))); diff --git a/src/compiler/dex/frontend.cc b/src/compiler/dex/frontend.cc index 4619052f4b..510e08ac79 100644 --- a/src/compiler/dex/frontend.cc +++ b/src/compiler/dex/frontend.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "compiler_internals.h" #include "dataflow.h" #include "ssa_transformation.h" @@ -57,13 +57,13 @@ LLVMInfo::LLVMInfo() { LLVMInfo::~LLVMInfo() { } -extern "C" void ArtInitQuickCompilerContext(art::Compiler& compiler) { +extern "C" void ArtInitQuickCompilerContext(art::CompilerDriver& compiler) { CHECK(compiler.GetCompilerContext() == NULL); LLVMInfo* llvm_info = new LLVMInfo(); compiler.SetCompilerContext(llvm_info); } -extern "C" void ArtUnInitQuickCompilerContext(art::Compiler& compiler) { +extern "C" void ArtUnInitQuickCompilerContext(art::CompilerDriver& compiler) { delete reinterpret_cast<LLVMInfo*>(compiler.GetCompilerContext()); compiler.SetCompilerContext(NULL); } @@ -755,7 +755,7 @@ static BasicBlock* ProcessCanThrow(CompilationUnit* cu, BasicBlock* cur_block, return new_block; } -void CompilerInit(CompilationUnit* cu, const Compiler& compiler) { +void CompilerInit(CompilationUnit* cu, const CompilerDriver& compiler) { bool success = false; switch (compiler.GetInstructionSet()) { case kThumb2: @@ -777,7 +777,7 @@ void CompilerInit(CompilationUnit* cu, const Compiler& compiler) { } } -static CompiledMethod* CompileMethod(Compiler& compiler, +static CompiledMethod* CompileMethod(CompilerDriver& compiler, const CompilerBackend compiler_backend, const DexFile::CodeItem* code_item, uint32_t access_flags, InvokeType invoke_type, @@ -797,7 +797,7 @@ static CompiledMethod* CompileMethod(Compiler& compiler, CompilerInit(cu.get(), compiler); - cu->compiler = &compiler; + cu->compiler_driver = &compiler; cu->class_linker = class_linker; cu->dex_file = &dex_file; cu->class_def_idx = class_def_idx; @@ -1228,7 +1228,7 @@ static CompiledMethod* CompileMethod(Compiler& compiler, return result; } -CompiledMethod* CompileOneMethod(Compiler& compiler, +CompiledMethod* CompileOneMethod(CompilerDriver& compiler, const CompilerBackend backend, const DexFile::CodeItem* code_item, uint32_t access_flags, InvokeType invoke_type, @@ -1243,7 +1243,7 @@ CompiledMethod* CompileOneMethod(Compiler& compiler, } // namespace art extern "C" art::CompiledMethod* - ArtQuickCompileMethod(art::Compiler& compiler, + ArtQuickCompileMethod(art::CompilerDriver& compiler, const art::DexFile::CodeItem* code_item, uint32_t access_flags, art::InvokeType invoke_type, uint32_t class_def_idx, uint32_t method_idx, jobject class_loader, diff --git a/src/compiler/dex/frontend.h b/src/compiler/dex/frontend.h index f3e38c2246..4e65d12e50 100644 --- a/src/compiler/dex/frontend.h +++ b/src/compiler/dex/frontend.h @@ -141,7 +141,7 @@ void ReplaceSpecialChars(std::string& str); } // namespace art -extern "C" art::CompiledMethod* ArtCompileMethod(art::Compiler& compiler, +extern "C" art::CompiledMethod* ArtCompileMethod(art::CompilerDriver& driver, const art::DexFile::CodeItem* code_item, uint32_t access_flags, art::InvokeType invoke_type, diff --git a/src/compiler/dex/portable/mir_to_gbc.cc b/src/compiler/dex/portable/mir_to_gbc.cc index 66efd64740..18a87c3b26 100644 --- a/src/compiler/dex/portable/mir_to_gbc.cc +++ b/src/compiler/dex/portable/mir_to_gbc.cc @@ -196,7 +196,7 @@ static void InitIR(CompilationUnit* cu) { LLVMInfo* llvm_info = cu->llvm_info; if (llvm_info == NULL) { - CompilerTls* tls = cu->compiler->GetTls(); + CompilerTls* tls = cu->compiler_driver->GetTls(); CHECK(tls != NULL); llvm_info = static_cast<LLVMInfo*>(tls->GetLLVMInfo()); if (llvm_info == NULL) { @@ -1032,9 +1032,9 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, case Instruction::RETURN_VOID: { if (((cu->access_flags & kAccConstructor) != 0) && - cu->compiler->RequiresConstructorBarrier(Thread::Current(), - cu->dex_file, - cu->class_def_idx)) { + cu->compiler_driver->RequiresConstructorBarrier(Thread::Current(), + cu->dex_file, + cu->class_def_idx)) { EmitConstructorBarrier(cu); } if (!(cu->attrs & METHOD_IS_LEAF)) { diff --git a/src/compiler/dex/quick/codegen_util.cc b/src/compiler/dex/quick/codegen_util.cc index 06221f8a4b..a7ca77af37 100644 --- a/src/compiler/dex/quick/codegen_util.cc +++ b/src/compiler/dex/quick/codegen_util.cc @@ -58,7 +58,7 @@ bool FastInstance(CompilationUnit* cu, uint32_t field_idx, *cu->dex_file, cu->code_item, cu->class_def_idx, cu->method_idx, cu->access_flags); - return cu->compiler->ComputeInstanceFieldInfo(field_idx, &m_unit, + return cu->compiler_driver->ComputeInstanceFieldInfo(field_idx, &m_unit, field_offset, is_volatile, is_put); } @@ -562,12 +562,12 @@ static void InstallLiteralPools(CompilationUnit* cu) data_lir = cu->code_literal_list; while (data_lir != NULL) { uint32_t target = data_lir->operands[0]; - cu->compiler->AddCodePatch(cu->dex_file, - cu->method_idx, - cu->invoke_type, - target, - static_cast<InvokeType>(data_lir->operands[1]), - cu->code_buffer.size()); + cu->compiler_driver->AddCodePatch(cu->dex_file, + cu->method_idx, + cu->invoke_type, + target, + static_cast<InvokeType>(data_lir->operands[1]), + cu->code_buffer.size()); const DexFile::MethodId& id = cu->dex_file->GetMethodId(target); // unique based on target to ensure code deduplication works uint32_t unique_patch_value = reinterpret_cast<uint32_t>(&id); @@ -577,12 +577,12 @@ static void InstallLiteralPools(CompilationUnit* cu) data_lir = cu->method_literal_list; while (data_lir != NULL) { uint32_t target = data_lir->operands[0]; - cu->compiler->AddMethodPatch(cu->dex_file, - cu->method_idx, - cu->invoke_type, - target, - static_cast<InvokeType>(data_lir->operands[1]), - cu->code_buffer.size()); + cu->compiler_driver->AddMethodPatch(cu->dex_file, + cu->method_idx, + cu->invoke_type, + target, + static_cast<InvokeType>(data_lir->operands[1]), + cu->code_buffer.size()); const DexFile::MethodId& id = cu->dex_file->GetMethodId(target); // unique based on target to ensure code deduplication works uint32_t unique_patch_value = reinterpret_cast<uint32_t>(&id); @@ -821,7 +821,7 @@ static void CreateNativeGcMap(CompilationUnit* cu) { max_native_offset = native_offset; } } - Compiler::MethodReference method_ref(cu->dex_file, cu->method_idx); + CompilerDriver::MethodReference method_ref(cu->dex_file, cu->method_idx); const std::vector<uint8_t>* gc_map_raw = verifier::MethodVerifier::GetDexGcMap(method_ref); verifier::DexPcToReferenceMap dex_gc_map(&(*gc_map_raw)[4], gc_map_raw->size() - 4); // Compute native offset to references size. diff --git a/src/compiler/dex/quick/gen_common.cc b/src/compiler/dex/quick/gen_common.cc index bc022fc84e..e3791ce101 100644 --- a/src/compiler/dex/quick/gen_common.cc +++ b/src/compiler/dex/quick/gen_common.cc @@ -221,9 +221,9 @@ void Codegen::GenNewArray(CompilationUnit* cu, uint32_t type_idx, RegLocation rl { FlushAllRegs(cu); /* Everything to home location */ int func_offset; - if (cu->compiler->CanAccessTypeWithoutChecks(cu->method_idx, - *cu->dex_file, - type_idx)) { + if (cu->compiler_driver->CanAccessTypeWithoutChecks(cu->method_idx, + *cu->dex_file, + type_idx)) { func_offset = ENTRYPOINT_OFFSET(pAllocArrayFromCode); } else { func_offset= ENTRYPOINT_OFFSET(pAllocArrayFromCodeWithAccessCheck); @@ -245,9 +245,9 @@ void Codegen::GenFilledNewArray(CompilationUnit* cu, CallInfo* info) int type_idx = info->index; FlushAllRegs(cu); /* Everything to home location */ int func_offset; - if (cu->compiler->CanAccessTypeWithoutChecks(cu->method_idx, - *cu->dex_file, - type_idx)) { + if (cu->compiler_driver->CanAccessTypeWithoutChecks(cu->method_idx, + *cu->dex_file, + type_idx)) { func_offset = ENTRYPOINT_OFFSET(pCheckAndAllocArrayFromCode); } else { func_offset = ENTRYPOINT_OFFSET(pCheckAndAllocArrayFromCodeWithAccessCheck); @@ -358,10 +358,10 @@ void Codegen::GenSput(CompilationUnit* cu, uint32_t field_idx, RegLocation rl_sr cu->class_def_idx, cu->method_idx, cu->access_flags); bool fast_path = - cu->compiler->ComputeStaticFieldInfo(field_idx, &m_unit, - field_offset, ssb_index, - is_referrers_class, is_volatile, - true); + cu->compiler_driver->ComputeStaticFieldInfo(field_idx, &m_unit, + field_offset, ssb_index, + is_referrers_class, is_volatile, + true); if (fast_path && !SLOW_FIELD_PATH) { DCHECK_GE(field_offset, 0); int rBase; @@ -452,10 +452,10 @@ void Codegen::GenSget(CompilationUnit* cu, uint32_t field_idx, RegLocation rl_de cu->access_flags); bool fast_path = - cu->compiler->ComputeStaticFieldInfo(field_idx, &m_unit, - field_offset, ssb_index, - is_referrers_class, is_volatile, - false); + cu->compiler_driver->ComputeStaticFieldInfo(field_idx, &m_unit, + field_offset, ssb_index, + is_referrers_class, is_volatile, + false); if (fast_path && !SLOW_FIELD_PATH) { DCHECK_GE(field_offset, 0); int rBase; @@ -783,7 +783,7 @@ void Codegen::GenConstClass(CompilationUnit* cu, uint32_t type_idx, RegLocation RegLocation rl_method = LoadCurrMethod(cu); int res_reg = AllocTemp(cu); RegLocation rl_result = EvalLoc(cu, rl_dest, kCoreReg, true); - if (!cu->compiler->CanAccessTypeWithoutChecks(cu->method_idx, + if (!cu->compiler_driver->CanAccessTypeWithoutChecks(cu->method_idx, *cu->dex_file, type_idx)) { // Call out to helper which resolves type and verifies access. @@ -801,7 +801,7 @@ void Codegen::GenConstClass(CompilationUnit* cu, uint32_t type_idx, RegLocation mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*) * type_idx); LoadWordDisp(cu, res_reg, offset_of_type, rl_result.low_reg); - if (!cu->compiler->CanAssumeTypeIsPresentInDexCache(*cu->dex_file, + if (!cu->compiler_driver->CanAssumeTypeIsPresentInDexCache(*cu->dex_file, type_idx) || SLOW_TYPE_PATH) { // Slow path, at runtime test if type is null and if so initialize FlushAllRegs(cu); @@ -842,7 +842,7 @@ void Codegen::GenConstString(CompilationUnit* cu, uint32_t string_idx, RegLocati /* NOTE: Most strings should be available at compile time */ int32_t offset_of_string = mirror::Array::DataOffset(sizeof(mirror::String*)).Int32Value() + (sizeof(mirror::String*) * string_idx); - if (!cu->compiler->CanAssumeStringIsPresentInDexCache( + if (!cu->compiler_driver->CanAssumeStringIsPresentInDexCache( *cu->dex_file, string_idx) || SLOW_STRING_PATH) { // slow path, resolve string if not in dex cache FlushAllRegs(cu); @@ -900,7 +900,7 @@ void Codegen::GenNewInstance(CompilationUnit* cu, uint32_t type_idx, RegLocation // alloc will always check for resolution, do we also need to verify // access because the verifier was unable to? int func_offset; - if (cu->compiler->CanAccessInstantiableTypeWithoutChecks( + if (cu->compiler_driver->CanAccessInstantiableTypeWithoutChecks( cu->method_idx, *cu->dex_file, type_idx)) { func_offset = ENTRYPOINT_OFFSET(pAllocObjectFromCode); } else { @@ -925,7 +925,7 @@ void Codegen::GenInstanceof(CompilationUnit* cu, uint32_t type_idx, RegLocation LockCallTemps(cu); LoadCurrMethodDirect(cu, TargetReg(kArg1)); // kArg1 <= current Method* int class_reg = TargetReg(kArg2); // kArg2 will hold the Class* - if (!cu->compiler->CanAccessTypeWithoutChecks(cu->method_idx, + if (!cu->compiler_driver->CanAccessTypeWithoutChecks(cu->method_idx, *cu->dex_file, type_idx)) { // Check we have access to type_idx and if not throw IllegalAccessError, @@ -943,7 +943,7 @@ void Codegen::GenInstanceof(CompilationUnit* cu, uint32_t type_idx, RegLocation mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*) * type_idx); LoadWordDisp(cu, class_reg, offset_of_type, class_reg); - if (!cu->compiler->CanAssumeTypeIsPresentInDexCache( + if (!cu->compiler_driver->CanAssumeTypeIsPresentInDexCache( *cu->dex_file, type_idx)) { // Need to test presence of type in dex cache at runtime LIR* hop_branch = OpCmpImmBranch(cu, kCondNe, class_reg, 0, NULL); @@ -1010,7 +1010,7 @@ void Codegen::GenCheckCast(CompilationUnit* cu, uint32_t type_idx, RegLocation r LockCallTemps(cu); LoadCurrMethodDirect(cu, TargetReg(kArg1)); // kArg1 <= current Method* int class_reg = TargetReg(kArg2); // kArg2 will hold the Class* - if (!cu->compiler->CanAccessTypeWithoutChecks(cu->method_idx, + if (!cu->compiler_driver->CanAccessTypeWithoutChecks(cu->method_idx, *cu->dex_file, type_idx)) { // Check we have access to type_idx and if not throw IllegalAccessError, @@ -1027,7 +1027,7 @@ void Codegen::GenCheckCast(CompilationUnit* cu, uint32_t type_idx, RegLocation r mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*) * type_idx); LoadWordDisp(cu, class_reg, offset_of_type, class_reg); - if (!cu->compiler->CanAssumeTypeIsPresentInDexCache( + if (!cu->compiler_driver->CanAssumeTypeIsPresentInDexCache( *cu->dex_file, type_idx)) { // Need to test presence of type in dex cache at runtime LIR* hop_branch = OpCmpImmBranch(cu, kCondNe, class_reg, 0, NULL); diff --git a/src/compiler/dex/quick/gen_invoke.cc b/src/compiler/dex/quick/gen_invoke.cc index 9a1fa5c4bf..3fe797c58d 100644 --- a/src/compiler/dex/quick/gen_invoke.cc +++ b/src/compiler/dex/quick/gen_invoke.cc @@ -1346,9 +1346,9 @@ void Codegen::GenInvoke(CompilationUnit* cu, CallInfo* info) uintptr_t direct_method; bool skip_this; bool fast_path = - cu->compiler->ComputeInvokeInfo(dex_method_idx, &m_unit, info->type, - vtable_idx, direct_code, - direct_method) + cu->compiler_driver->ComputeInvokeInfo(dex_method_idx, &m_unit, info->type, + vtable_idx, direct_code, + direct_method) && !SLOW_INVOKE_PATH; if (info->type == kInterface) { if (fast_path) { diff --git a/src/compiler/dex/quick/mir_to_lir.cc b/src/compiler/dex/quick/mir_to_lir.cc index 267f61e2b5..3cce26efb3 100644 --- a/src/compiler/dex/quick/mir_to_lir.cc +++ b/src/compiler/dex/quick/mir_to_lir.cc @@ -87,8 +87,8 @@ static void CompileDalvikInstruction(CompilationUnit* cu, MIR* mir, BasicBlock* case Instruction::RETURN_VOID: if (((cu->access_flags & kAccConstructor) != 0) && - cu->compiler->RequiresConstructorBarrier(Thread::Current(), cu->dex_file, - cu->class_def_idx)) { + cu->compiler_driver->RequiresConstructorBarrier(Thread::Current(), cu->dex_file, + cu->class_def_idx)) { cg->GenMemBarrier(cu, kStoreStore); } if (!(cu->attrs & METHOD_IS_LEAF)) { diff --git a/src/compiler/dex/write_elf.cc b/src/compiler/dex/write_elf.cc index 1fd8a94926..a78d98e8cb 100644 --- a/src/compiler/dex/write_elf.cc +++ b/src/compiler/dex/write_elf.cc @@ -14,14 +14,17 @@ * limitations under the License. */ -#include "compiler.h" #include "elf_writer.h" #include "os.h" -extern "C" bool WriteElf(art::Compiler& compiler, +namespace art { +class CompilerDriver; +} // namespace art + +extern "C" bool WriteElf(art::CompilerDriver& driver, std::vector<uint8_t>& oat_contents, art::File* file) { - return art::ElfWriter::Create(file, oat_contents, compiler); + return art::ElfWriter::Create(file, oat_contents, driver); } extern "C" bool FixupElf(art::File* file, uintptr_t oat_data_begin) { return art::ElfWriter::Fixup(file, oat_data_begin); diff --git a/src/compiler.cc b/src/compiler/driver/compiler_driver.cc index af0bba36e3..d9cc6c8bd1 100644 --- a/src/compiler.cc +++ b/src/compiler/driver/compiler_driver.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "compiler.h" +#include "compiler_driver.h" #include <vector> @@ -282,9 +282,10 @@ static Fn FindFunction(const std::string& compiler_so_name, void* library, const return fn; } -Compiler::Compiler(CompilerBackend compiler_backend, InstructionSet instruction_set, bool image, - size_t thread_count, bool support_debugging, const std::set<std::string>* image_classes, - bool dump_stats, bool dump_timings) +CompilerDriver::CompilerDriver(CompilerBackend compiler_backend, InstructionSet instruction_set, + bool image, size_t thread_count, bool support_debugging, + const std::set<std::string>* image_classes, bool dump_stats, + bool dump_timings) : compiler_backend_(compiler_backend), instruction_set_(instruction_set), freezing_constructor_lock_("freezing constructor lock"), @@ -304,7 +305,9 @@ Compiler::Compiler(CompilerBackend compiler_backend, InstructionSet instruction_ compiler_(NULL), compiler_context_(NULL), jni_compiler_(NULL), - create_invoke_stub_(NULL) + create_invoke_stub_(NULL), + compiler_get_method_code_addr_(NULL), + compiler_get_method_invoke_stub_addr_(NULL) { std::string compiler_so_name(MakeCompilerSoName(compiler_backend_)); compiler_library_ = dlopen(compiler_so_name.c_str(), RTLD_LAZY); @@ -316,15 +319,15 @@ Compiler::Compiler(CompilerBackend compiler_backend, InstructionSet instruction_ CHECK_PTHREAD_CALL(pthread_key_create, (&tls_key_, NULL), "compiler tls key"); // TODO: more work needed to combine initializations and allow per-method backend selection - typedef void (*InitCompilerContextFn)(Compiler&); + typedef void (*InitCompilerContextFn)(CompilerDriver&); InitCompilerContextFn init_compiler_context; if (compiler_backend_ == kPortable){ // Initialize compiler_context_ - init_compiler_context = FindFunction<void (*)(Compiler&)>(compiler_so_name, + init_compiler_context = FindFunction<void (*)(CompilerDriver&)>(compiler_so_name, compiler_library_, "ArtInitCompilerContext"); compiler_ = FindFunction<CompilerFn>(compiler_so_name, compiler_library_, "ArtCompileMethod"); } else { - init_compiler_context = FindFunction<void (*)(Compiler&)>(compiler_so_name, + init_compiler_context = FindFunction<void (*)(CompilerDriver&)>(compiler_so_name, compiler_library_, "ArtInitQuickCompilerContext"); compiler_ = FindFunction<CompilerFn>(compiler_so_name, compiler_library_, "ArtQuickCompileMethod"); } @@ -371,7 +374,7 @@ Compiler::Compiler(CompilerBackend compiler_backend, InstructionSet instruction_ } } -Compiler::~Compiler() { +CompilerDriver::~CompilerDriver() { Thread* self = Thread::Current(); { MutexLock mu(self, compiled_classes_lock_); @@ -398,16 +401,16 @@ Compiler::~Compiler() { STLDeleteElements(&methods_to_patch_); } CHECK_PTHREAD_CALL(pthread_key_delete, (tls_key_), "delete tls key"); - typedef void (*UninitCompilerContextFn)(Compiler&); + typedef void (*UninitCompilerContextFn)(CompilerDriver&); std::string compiler_so_name(MakeCompilerSoName(compiler_backend_)); UninitCompilerContextFn uninit_compiler_context; // Uninitialize compiler_context_ // TODO: rework to combine initialization/uninitialization if (compiler_backend_ == kPortable) { - uninit_compiler_context = FindFunction<void (*)(Compiler&)>(compiler_so_name, + uninit_compiler_context = FindFunction<void (*)(CompilerDriver&)>(compiler_so_name, compiler_library_, "ArtUnInitCompilerContext"); } else { - uninit_compiler_context = FindFunction<void (*)(Compiler&)>(compiler_so_name, + uninit_compiler_context = FindFunction<void (*)(CompilerDriver&)>(compiler_so_name, compiler_library_, "ArtUnInitQuickCompilerContext"); } uninit_compiler_context(*this); @@ -428,7 +431,7 @@ Compiler::~Compiler() { } } -CompilerTls* Compiler::GetTls() { +CompilerTls* CompilerDriver::GetTls() { // Lazily create thread-local storage CompilerTls* res = static_cast<CompilerTls*>(pthread_getspecific(tls_key_)); if (res == NULL) { @@ -438,8 +441,8 @@ CompilerTls* Compiler::GetTls() { return res; } -mirror::ByteArray* Compiler::CreateResolutionStub(InstructionSet instruction_set, - Runtime::TrampolineType type) { +mirror::ByteArray* CompilerDriver::CreateResolutionStub(InstructionSet instruction_set, + Runtime::TrampolineType type) { switch (instruction_set) { case kArm: case kThumb2: @@ -454,7 +457,7 @@ mirror::ByteArray* Compiler::CreateResolutionStub(InstructionSet instruction_set } } -mirror::ByteArray* Compiler::CreateJniDlsymLookupStub(InstructionSet instruction_set) { +mirror::ByteArray* CompilerDriver::CreateJniDlsymLookupStub(InstructionSet instruction_set) { switch (instruction_set) { case kArm: case kThumb2: @@ -469,7 +472,7 @@ mirror::ByteArray* Compiler::CreateJniDlsymLookupStub(InstructionSet instruction } } -mirror::ByteArray* Compiler::CreateAbstractMethodErrorStub(InstructionSet instruction_set) { +mirror::ByteArray* CompilerDriver::CreateAbstractMethodErrorStub(InstructionSet instruction_set) { switch (instruction_set) { case kArm: case kThumb2: @@ -484,8 +487,8 @@ mirror::ByteArray* Compiler::CreateAbstractMethodErrorStub(InstructionSet instru } } -void Compiler::CompileAll(jobject class_loader, - const std::vector<const DexFile*>& dex_files) { +void CompilerDriver::CompileAll(jobject class_loader, + const std::vector<const DexFile*>& dex_files) { DCHECK(!Runtime::Current()->IsStarted()); UniquePtr<ThreadPool> thread_pool(new ThreadPool(thread_count_)); @@ -504,7 +507,7 @@ void Compiler::CompileAll(jobject class_loader, } } -void Compiler::CompileOne(const mirror::AbstractMethod* method) { +void CompilerDriver::CompileOne(const mirror::AbstractMethod* method) { DCHECK(!Runtime::Current()->IsStarted()); Thread* self = Thread::Current(); jobject class_loader; @@ -540,8 +543,8 @@ void Compiler::CompileOne(const mirror::AbstractMethod* method) { self->TransitionFromSuspendedToRunnable(); } -void Compiler::Resolve(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) { +void CompilerDriver::Resolve(jobject class_loader, const std::vector<const DexFile*>& dex_files, + ThreadPool& thread_pool, TimingLogger& timings) { for (size_t i = 0; i != dex_files.size(); ++i) { const DexFile* dex_file = dex_files[i]; CHECK(dex_file != NULL); @@ -549,8 +552,8 @@ void Compiler::Resolve(jobject class_loader, const std::vector<const DexFile*>& } } -void Compiler::PreCompile(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) { +void CompilerDriver::PreCompile(jobject class_loader, const std::vector<const DexFile*>& dex_files, + ThreadPool& thread_pool, TimingLogger& timings) { Resolve(class_loader, dex_files, thread_pool, timings); Verify(class_loader, dex_files, thread_pool, timings); @@ -558,20 +561,20 @@ void Compiler::PreCompile(jobject class_loader, const std::vector<const DexFile* InitializeClasses(class_loader, dex_files, thread_pool, timings); } -bool Compiler::IsImageClass(const std::string& descriptor) const { +bool CompilerDriver::IsImageClass(const std::string& descriptor) const { if (image_classes_ == NULL) { return true; } return image_classes_->find(descriptor) != image_classes_->end(); } -void Compiler::RecordClassStatus(ClassReference ref, CompiledClass* compiled_class) { - MutexLock mu(Thread::Current(), Compiler::compiled_classes_lock_); +void CompilerDriver::RecordClassStatus(ClassReference ref, CompiledClass* compiled_class) { + MutexLock mu(Thread::Current(), CompilerDriver::compiled_classes_lock_); compiled_classes_.Put(ref, compiled_class); } -bool Compiler::CanAssumeTypeIsPresentInDexCache(const DexFile& dex_file, - uint32_t type_idx) { +bool CompilerDriver::CanAssumeTypeIsPresentInDexCache(const DexFile& dex_file, + uint32_t type_idx) { ScopedObjectAccess soa(Thread::Current()); mirror::DexCache* dex_cache = Runtime::Current()->GetClassLinker()->FindDexCache(dex_file); if (!IsImage()) { @@ -592,8 +595,8 @@ bool Compiler::CanAssumeTypeIsPresentInDexCache(const DexFile& dex_file, return result; } -bool Compiler::CanAssumeStringIsPresentInDexCache(const DexFile& dex_file, - uint32_t string_idx) { +bool CompilerDriver::CanAssumeStringIsPresentInDexCache(const DexFile& dex_file, + uint32_t string_idx) { // See also Compiler::ResolveDexFile bool result = false; @@ -612,8 +615,8 @@ bool Compiler::CanAssumeStringIsPresentInDexCache(const DexFile& dex_file, return result; } -bool Compiler::CanAccessTypeWithoutChecks(uint32_t referrer_idx, const DexFile& dex_file, - uint32_t type_idx) { +bool CompilerDriver::CanAccessTypeWithoutChecks(uint32_t referrer_idx, const DexFile& dex_file, + uint32_t type_idx) { ScopedObjectAccess soa(Thread::Current()); mirror::DexCache* dex_cache = Runtime::Current()->GetClassLinker()->FindDexCache(dex_file); // Get type from dex cache assuming it was populated by the verifier @@ -639,9 +642,9 @@ bool Compiler::CanAccessTypeWithoutChecks(uint32_t referrer_idx, const DexFile& return result; } -bool Compiler::CanAccessInstantiableTypeWithoutChecks(uint32_t referrer_idx, - const DexFile& dex_file, - uint32_t type_idx) { +bool CompilerDriver::CanAccessInstantiableTypeWithoutChecks(uint32_t referrer_idx, + const DexFile& dex_file, + uint32_t type_idx) { ScopedObjectAccess soa(Thread::Current()); mirror::DexCache* dex_cache = Runtime::Current()->GetClassLinker()->FindDexCache(dex_file); // Get type from dex cache assuming it was populated by the verifier. @@ -698,8 +701,8 @@ static mirror::AbstractMethod* ComputeMethodReferencedFromCompilingMethod(Scoped class_loader, NULL, type); } -bool Compiler::ComputeInstanceFieldInfo(uint32_t field_idx, OatCompilationUnit* mUnit, - int& field_offset, bool& is_volatile, bool is_put) { +bool CompilerDriver::ComputeInstanceFieldInfo(uint32_t field_idx, OatCompilationUnit* mUnit, + int& field_offset, bool& is_volatile, bool is_put) { ScopedObjectAccess soa(Thread::Current()); // Conservative defaults. field_offset = -1; @@ -743,9 +746,10 @@ bool Compiler::ComputeInstanceFieldInfo(uint32_t field_idx, OatCompilationUnit* return false; // Incomplete knowledge needs slow path. } -bool Compiler::ComputeStaticFieldInfo(uint32_t field_idx, OatCompilationUnit* mUnit, - int& field_offset, int& ssb_index, - bool& is_referrers_class, bool& is_volatile, bool is_put) { +bool CompilerDriver::ComputeStaticFieldInfo(uint32_t field_idx, OatCompilationUnit* mUnit, + int& field_offset, int& ssb_index, + bool& is_referrers_class, bool& is_volatile, + bool is_put) { ScopedObjectAccess soa(Thread::Current()); // Conservative defaults. field_offset = -1; @@ -827,9 +831,10 @@ bool Compiler::ComputeStaticFieldInfo(uint32_t field_idx, OatCompilationUnit* mU return false; // Incomplete knowledge needs slow path. } -void Compiler::GetCodeAndMethodForDirectCall(InvokeType type, InvokeType sharp_type, - mirror::AbstractMethod* method, - uintptr_t& direct_code, uintptr_t& direct_method) { +void CompilerDriver::GetCodeAndMethodForDirectCall(InvokeType type, InvokeType sharp_type, + mirror::AbstractMethod* method, + uintptr_t& direct_code, + uintptr_t& direct_method) { // For direct and static methods compute possible direct_code and direct_method values, ie // an address for the Method* being invoked and an address of the code for that Method*. // For interface calls compute a value for direct_method that is the interface method being @@ -877,9 +882,9 @@ void Compiler::GetCodeAndMethodForDirectCall(InvokeType type, InvokeType sharp_t } } -bool Compiler::ComputeInvokeInfo(uint32_t method_idx, OatCompilationUnit* mUnit, InvokeType& type, - int& vtable_idx, uintptr_t& direct_code, - uintptr_t& direct_method) { +bool CompilerDriver::ComputeInvokeInfo(uint32_t method_idx, OatCompilationUnit* mUnit, + InvokeType& type, int& vtable_idx, uintptr_t& direct_code, + uintptr_t& direct_method) { ScopedObjectAccess soa(Thread::Current()); vtable_idx = -1; direct_code = 0; @@ -946,7 +951,7 @@ bool Compiler::ComputeInvokeInfo(uint32_t method_idx, OatCompilationUnit* mUnit, return false; // Incomplete knowledge needs slow path. } -void Compiler::AddCodePatch(const DexFile* dex_file, +void CompilerDriver::AddCodePatch(const DexFile* dex_file, uint32_t referrer_method_idx, InvokeType referrer_invoke_type, uint32_t target_method_idx, @@ -960,7 +965,7 @@ void Compiler::AddCodePatch(const DexFile* dex_file, target_invoke_type, literal_offset)); } -void Compiler::AddMethodPatch(const DexFile* dex_file, +void CompilerDriver::AddMethodPatch(const DexFile* dex_file, uint32_t referrer_method_idx, InvokeType referrer_invoke_type, uint32_t target_method_idx, @@ -981,7 +986,7 @@ class CompilationContext { CompilationContext(ClassLinker* class_linker, jobject class_loader, - Compiler* compiler, + CompilerDriver* compiler, const DexFile* dex_file, ThreadPool& thread_pool) : class_linker_(class_linker), @@ -999,7 +1004,7 @@ class CompilationContext { return class_loader_; } - Compiler* GetCompiler() const { + CompilerDriver* GetCompiler() const { CHECK(compiler_ != NULL); return compiler_; } @@ -1064,7 +1069,7 @@ class CompilationContext { ClassLinker* const class_linker_; const jobject class_loader_; - Compiler* const compiler_; + CompilerDriver* const compiler_; const DexFile* const dex_file_; ThreadPool* thread_pool_; }; @@ -1193,8 +1198,8 @@ static void ResolveType(const CompilationContext* context, size_t type_idx) } } -void Compiler::ResolveDexFile(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) { +void CompilerDriver::ResolveDexFile(jobject class_loader, const DexFile& dex_file, + ThreadPool& thread_pool, TimingLogger& timings) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); // TODO: we could resolve strings here, although the string table is largely filled with class @@ -1208,8 +1213,8 @@ void Compiler::ResolveDexFile(jobject class_loader, const DexFile& dex_file, timings.AddSplit("Resolve " + dex_file.GetLocation() + " MethodsAndFields"); } -void Compiler::Verify(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) { +void CompilerDriver::Verify(jobject class_loader, const std::vector<const DexFile*>& dex_files, + ThreadPool& thread_pool, TimingLogger& timings) { for (size_t i = 0; i != dex_files.size(); ++i) { const DexFile* dex_file = dex_files[i]; CHECK(dex_file != NULL); @@ -1263,8 +1268,8 @@ static void VerifyClass(const CompilationContext* context, size_t class_def_inde CHECK(!Thread::Current()->IsExceptionPending()) << PrettyTypeOf(Thread::Current()->GetException()); } -void Compiler::VerifyDexFile(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) { +void CompilerDriver::VerifyDexFile(jobject class_loader, const DexFile& dex_file, + ThreadPool& thread_pool, TimingLogger& timings) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); CompilationContext context(class_linker, class_loader, this, &dex_file, thread_pool); context.ForAll(0, dex_file.NumClassDefs(), VerifyClass, thread_count_); @@ -1506,7 +1511,7 @@ static void InitializeClass(const CompilationContext* context, size_t class_def_ } // Record the final class status if necessary. mirror::Class::Status status = klass->GetStatus(); - Compiler::ClassReference ref(context->GetDexFile(), class_def_index); + CompilerDriver::ClassReference ref(context->GetDexFile(), class_def_index); CompiledClass* compiled_class = context->GetCompiler()->GetCompiledClass(ref); if (compiled_class == NULL) { compiled_class = new CompiledClass(status); @@ -1519,8 +1524,8 @@ static void InitializeClass(const CompilationContext* context, size_t class_def_ self->ClearException(); } -void Compiler::InitializeClasses(jobject jni_class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) { +void CompilerDriver::InitializeClasses(jobject jni_class_loader, const DexFile& dex_file, + ThreadPool& thread_pool, TimingLogger& timings) { #ifndef NDEBUG for (size_t i = 0; i < arraysize(class_initializer_black_list); ++i) { const char* descriptor = class_initializer_black_list[i]; @@ -1533,9 +1538,9 @@ void Compiler::InitializeClasses(jobject jni_class_loader, const DexFile& dex_fi timings.AddSplit("InitializeNoClinit " + dex_file.GetLocation()); } -void Compiler::InitializeClasses(jobject class_loader, - const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) { +void CompilerDriver::InitializeClasses(jobject class_loader, + const std::vector<const DexFile*>& dex_files, + ThreadPool& thread_pool, TimingLogger& timings) { for (size_t i = 0; i != dex_files.size(); ++i) { const DexFile* dex_file = dex_files[i]; CHECK(dex_file != NULL); @@ -1543,7 +1548,7 @@ void Compiler::InitializeClasses(jobject class_loader, } } -void Compiler::Compile(jobject class_loader, const std::vector<const DexFile*>& dex_files, +void CompilerDriver::Compile(jobject class_loader, const std::vector<const DexFile*>& dex_files, ThreadPool& thread_pool, TimingLogger& timings) { for (size_t i = 0; i != dex_files.size(); ++i) { const DexFile* dex_file = dex_files[i]; @@ -1552,7 +1557,7 @@ void Compiler::Compile(jobject class_loader, const std::vector<const DexFile*>& } } -void Compiler::CompileClass(const CompilationContext* context, size_t class_def_index) { +void CompilerDriver::CompileClass(const CompilationContext* context, size_t class_def_index) { jobject class_loader = context->GetClassLoader(); const DexFile& dex_file = *context->GetDexFile(); const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index); @@ -1616,10 +1621,10 @@ void Compiler::CompileClass(const CompilationContext* context, size_t class_def_ DCHECK(!it.HasNext()); } -void Compiler::CompileDexFile(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) { +void CompilerDriver::CompileDexFile(jobject class_loader, const DexFile& dex_file, + ThreadPool& thread_pool, TimingLogger& timings) { CompilationContext context(NULL, class_loader, this, &dex_file, thread_pool); - context.ForAll(0, dex_file.NumClassDefs(), Compiler::CompileClass, thread_count_); + context.ForAll(0, dex_file.NumClassDefs(), CompilerDriver::CompileClass, thread_count_); timings.AddSplit("Compile " + dex_file.GetLocation()); } @@ -1631,9 +1636,10 @@ static std::string MakeInvokeStubKey(bool is_static, const char* shorty) { return key; } -void Compiler::CompileMethod(const DexFile::CodeItem* code_item, uint32_t access_flags, - InvokeType invoke_type, uint32_t class_def_idx, uint32_t method_idx, - jobject class_loader, const DexFile& dex_file) { +void CompilerDriver::CompileMethod(const DexFile::CodeItem* code_item, uint32_t access_flags, + InvokeType invoke_type, uint32_t class_def_idx, + uint32_t method_idx, jobject class_loader, + const DexFile& dex_file) { CompiledMethod* compiled_method = NULL; uint64_t start_ns = NanoTime(); @@ -1695,12 +1701,12 @@ void Compiler::CompileMethod(const DexFile::CodeItem* code_item, uint32_t access } } -const CompiledInvokeStub* Compiler::FindInvokeStub(bool is_static, const char* shorty) const { +const CompiledInvokeStub* CompilerDriver::FindInvokeStub(bool is_static, const char* shorty) const { const std::string key(MakeInvokeStubKey(is_static, shorty)); return FindInvokeStub(key); } -const CompiledInvokeStub* Compiler::FindInvokeStub(const std::string& key) const { +const CompiledInvokeStub* CompilerDriver::FindInvokeStub(const std::string& key) const { MutexLock mu(Thread::Current(), compiled_invoke_stubs_lock_); InvokeStubTable::const_iterator it = compiled_invoke_stubs_.find(key); if (it == compiled_invoke_stubs_.end()) { @@ -1711,8 +1717,8 @@ const CompiledInvokeStub* Compiler::FindInvokeStub(const std::string& key) const } } -void Compiler::InsertInvokeStub(const std::string& key, - const CompiledInvokeStub* compiled_invoke_stub) { +void CompilerDriver::InsertInvokeStub(const std::string& key, + const CompiledInvokeStub* compiled_invoke_stub) { MutexLock mu(Thread::Current(), compiled_invoke_stubs_lock_); InvokeStubTable::iterator it = compiled_invoke_stubs_.find(key); if (it != compiled_invoke_stubs_.end()) { @@ -1723,7 +1729,7 @@ void Compiler::InsertInvokeStub(const std::string& key, } } -const CompiledInvokeStub* Compiler::FindProxyStub(const char* shorty) const { +const CompiledInvokeStub* CompilerDriver::FindProxyStub(const char* shorty) const { MutexLock mu(Thread::Current(), compiled_proxy_stubs_lock_); ProxyStubTable::const_iterator it = compiled_proxy_stubs_.find(shorty); if (it == compiled_proxy_stubs_.end()) { @@ -1734,8 +1740,8 @@ const CompiledInvokeStub* Compiler::FindProxyStub(const char* shorty) const { } } -void Compiler::InsertProxyStub(const char* shorty, - const CompiledInvokeStub* compiled_proxy_stub) { +void CompilerDriver::InsertProxyStub(const char* shorty, + const CompiledInvokeStub* compiled_proxy_stub) { MutexLock mu(Thread::Current(), compiled_proxy_stubs_lock_); InvokeStubTable::iterator it = compiled_proxy_stubs_.find(shorty); if (it != compiled_proxy_stubs_.end()) { @@ -1746,7 +1752,7 @@ void Compiler::InsertProxyStub(const char* shorty, } } -CompiledClass* Compiler::GetCompiledClass(ClassReference ref) const { +CompiledClass* CompilerDriver::GetCompiledClass(ClassReference ref) const { MutexLock mu(Thread::Current(), compiled_classes_lock_); ClassTable::const_iterator it = compiled_classes_.find(ref); if (it == compiled_classes_.end()) { @@ -1756,7 +1762,7 @@ CompiledClass* Compiler::GetCompiledClass(ClassReference ref) const { return it->second; } -CompiledMethod* Compiler::GetCompiledMethod(MethodReference ref) const { +CompiledMethod* CompilerDriver::GetCompiledMethod(MethodReference ref) const { MutexLock mu(Thread::Current(), compiled_methods_lock_); MethodTable::const_iterator it = compiled_methods_.find(ref); if (it == compiled_methods_.end()) { @@ -1766,8 +1772,8 @@ CompiledMethod* Compiler::GetCompiledMethod(MethodReference ref) const { return it->second; } -void Compiler::SetBitcodeFileName(std::string const& filename) { - typedef void (*SetBitcodeFileNameFn)(Compiler&, std::string const&); +void CompilerDriver::SetBitcodeFileName(std::string const& filename) { + typedef void (*SetBitcodeFileNameFn)(CompilerDriver&, std::string const&); SetBitcodeFileNameFn set_bitcode_file_name = FindFunction<SetBitcodeFileNameFn>(MakeCompilerSoName(compiler_backend_), compiler_library_, @@ -1777,35 +1783,35 @@ void Compiler::SetBitcodeFileName(std::string const& filename) { } -void Compiler::AddRequiresConstructorBarrier(Thread* self, const DexFile* dex_file, +void CompilerDriver::AddRequiresConstructorBarrier(Thread* self, const DexFile* dex_file, size_t class_def_index) { MutexLock mu(self, freezing_constructor_lock_); freezing_constructor_classes_.insert(ClassReference(dex_file, class_def_index)); } -bool Compiler::RequiresConstructorBarrier(Thread* self, const DexFile* dex_file, +bool CompilerDriver::RequiresConstructorBarrier(Thread* self, const DexFile* dex_file, size_t class_def_index) { MutexLock mu(self, freezing_constructor_lock_); return freezing_constructor_classes_.count(ClassReference(dex_file, class_def_index)) != 0; } -bool Compiler::WriteElf(std::vector<uint8_t>& oat_contents, File* file) { - typedef bool (*WriteElfFn)(Compiler&, std::vector<uint8_t>&, File*); +bool CompilerDriver::WriteElf(std::vector<uint8_t>& oat_contents, File* file) { + typedef bool (*WriteElfFn)(CompilerDriver&, std::vector<uint8_t>&, File*); WriteElfFn WriteElf = FindFunction<WriteElfFn>(MakeCompilerSoName(compiler_backend_), compiler_library_, "WriteElf"); return WriteElf(*this, oat_contents, file); } -bool Compiler::FixupElf(File* file, uintptr_t oat_data_begin) const { +bool CompilerDriver::FixupElf(File* file, uintptr_t oat_data_begin) const { typedef bool (*FixupElfFn)(File*, uintptr_t oat_data_begin); FixupElfFn FixupElf = FindFunction<FixupElfFn>(MakeCompilerSoName(compiler_backend_), compiler_library_, "FixupElf"); return FixupElf(file, oat_data_begin); } -void Compiler::GetOatElfInformation(File* file, - size_t& oat_loaded_size, - size_t& oat_data_offset) const { +void CompilerDriver::GetOatElfInformation(File* file, + size_t& oat_loaded_size, + size_t& oat_data_offset) const { typedef bool (*GetOatElfInformationFn)(File*, size_t& oat_loaded_size, size_t& oat_data_offset); GetOatElfInformationFn GetOatElfInformation = FindFunction<GetOatElfInformationFn>(MakeCompilerSoName(compiler_backend_), compiler_library_, @@ -1813,10 +1819,10 @@ void Compiler::GetOatElfInformation(File* file, GetOatElfInformation(file, oat_loaded_size, oat_data_offset); } -void Compiler::InstructionSetToLLVMTarget(InstructionSet instruction_set, - std::string& target_triple, - std::string& target_cpu, - std::string& target_attr) { +void CompilerDriver::InstructionSetToLLVMTarget(InstructionSet instruction_set, + std::string& target_triple, + std::string& target_cpu, + std::string& target_attr) { switch (instruction_set) { case kThumb2: target_triple = "thumb-none-linux-gnueabi"; diff --git a/src/compiler.h b/src/compiler/driver/compiler_driver.h index 947564206d..2c1732044a 100644 --- a/src/compiler.h +++ b/src/compiler/driver/compiler_driver.h @@ -59,18 +59,19 @@ class CompilerTls { void* llvm_info_; }; -class Compiler { +class CompilerDriver { public: // Create a compiler targeting the requested "instruction_set". // "image" should be true if image specific optimizations should be // enabled. "image_classes" lets the compiler know what classes it // can assume will be in the image, with NULL implying all available // classes. - explicit Compiler(CompilerBackend compiler_backend, InstructionSet instruction_set, bool image, - size_t thread_count, bool support_debugging, - const std::set<std::string>* image_classes, bool dump_stats, bool dump_timings); + explicit CompilerDriver(CompilerBackend compiler_backend, InstructionSet instruction_set, bool image, + size_t thread_count, bool support_debugging, + const std::set<std::string>* image_classes, bool dump_stats, + bool dump_timings); - ~Compiler(); + ~CompilerDriver(); void CompileAll(jobject class_loader, const std::vector<const DexFile*>& dex_files) LOCKS_EXCLUDED(Locks::mutator_lock_); @@ -252,7 +253,7 @@ class Compiler { InvokeType target_invoke_type_; size_t literal_offset_; - friend class Compiler; + friend class CompilerDriver; DISALLOW_COPY_AND_ASSIGN(PatchInformation); }; @@ -363,12 +364,12 @@ class Compiler { const std::set<std::string>* image_classes_; - typedef void (*CompilerCallbackFn)(Compiler& compiler); - typedef MutexLock* (*CompilerMutexLockFn)(Compiler& compiler); + typedef void (*CompilerCallbackFn)(CompilerDriver& driver); + typedef MutexLock* (*CompilerMutexLockFn)(CompilerDriver& driver); void* compiler_library_; - typedef CompiledMethod* (*CompilerFn)(Compiler& compiler, + typedef CompiledMethod* (*CompilerFn)(CompilerDriver& driver, const DexFile::CodeItem* code_item, uint32_t access_flags, InvokeType invoke_type, uint32_t class_dex_idx, uint32_t method_idx, @@ -377,36 +378,36 @@ class Compiler { void* compiler_context_; - typedef CompiledMethod* (*JniCompilerFn)(Compiler& compiler, + typedef CompiledMethod* (*JniCompilerFn)(CompilerDriver& driver, uint32_t access_flags, uint32_t method_idx, const DexFile& dex_file); JniCompilerFn jni_compiler_; - typedef CompiledInvokeStub* (*CreateInvokeStubFn)(Compiler& compiler, bool is_static, + typedef CompiledInvokeStub* (*CreateInvokeStubFn)(CompilerDriver& driver, bool is_static, const char* shorty, uint32_t shorty_len); CreateInvokeStubFn create_invoke_stub_; pthread_key_t tls_key_; typedef CompiledInvokeStub* (*CreateProxyStubFn) - (Compiler& compiler, const char* shorty, uint32_t shorty_len); + (CompilerDriver& driver, const char* shorty, uint32_t shorty_len); CreateProxyStubFn create_proxy_stub_; - typedef void (*CompilerEnableAutoElfLoadingFn)(Compiler& compiler); + typedef void (*CompilerEnableAutoElfLoadingFn)(CompilerDriver& driver); CompilerEnableAutoElfLoadingFn compiler_enable_auto_elf_loading_; typedef const void* (*CompilerGetMethodCodeAddrFn) - (const Compiler& compiler, const CompiledMethod* cm, const mirror::AbstractMethod* method); + (const CompilerDriver& driver, const CompiledMethod* cm, const mirror::AbstractMethod* method); CompilerGetMethodCodeAddrFn compiler_get_method_code_addr_; typedef const mirror::AbstractMethod::InvokeStub* (*CompilerGetMethodInvokeStubAddrFn) - (const Compiler& compiler, const CompiledInvokeStub* cm, const mirror::AbstractMethod* method); + (const CompilerDriver& driver, const CompiledInvokeStub* cm, const mirror::AbstractMethod* method); CompilerGetMethodInvokeStubAddrFn compiler_get_method_invoke_stub_addr_; - DISALLOW_COPY_AND_ASSIGN(Compiler); + DISALLOW_COPY_AND_ASSIGN(CompilerDriver); }; -inline bool operator<(const Compiler::ClassReference& lhs, const Compiler::ClassReference& rhs) { +inline bool operator<(const CompilerDriver::ClassReference& lhs, const CompilerDriver::ClassReference& rhs) { if (lhs.second < rhs.second) { return true; } else if (lhs.second > rhs.second) { diff --git a/src/compiler_test.cc b/src/compiler/driver/compiler_driver_test.cc index bd25eb3a3c..19ccb358e8 100644 --- a/src/compiler_test.cc +++ b/src/compiler/driver/compiler_driver_test.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include <stdint.h> #include <stdio.h> @@ -32,10 +32,10 @@ namespace art { -class CompilerTest : public CommonTest { +class CompilerDriverTest : public CommonTest { protected: void CompileAll(jobject class_loader) LOCKS_EXCLUDED(Locks::mutator_lock_) { - compiler_->CompileAll(class_loader, Runtime::Current()->GetCompileTimeClassPath(class_loader)); + compiler_driver_->CompileAll(class_loader, Runtime::Current()->GetCompileTimeClassPath(class_loader)); MakeAllExecutable(class_loader); } @@ -89,7 +89,7 @@ class CompilerTest : public CommonTest { }; // Disabled due to 10 second runtime on host -TEST_F(CompilerTest, DISABLED_LARGE_CompileDexLibCore) { +TEST_F(CompilerDriverTest, DISABLED_LARGE_CompileDexLibCore) { CompileAll(NULL); // All libcore references should resolve @@ -131,7 +131,7 @@ TEST_F(CompilerTest, DISABLED_LARGE_CompileDexLibCore) { // TODO: check that all Method::GetCode() values are non-null } -TEST_F(CompilerTest, AbstractMethodErrorStub) { +TEST_F(CompilerDriverTest, AbstractMethodErrorStub) { jobject class_loader; { ScopedObjectAccess soa(Thread::Current()); diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc index db2a91b589..efa7d972e2 100644 --- a/src/compiler_llvm/compiler_llvm.cc +++ b/src/compiler_llvm/compiler_llvm.cc @@ -20,7 +20,7 @@ #include "backend_options.h" #include "class_linker.h" #include "compiled_method.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "ir_builder.h" #include "jni_compiler.h" #include "llvm_compilation_unit.h" @@ -37,7 +37,7 @@ #include <llvm/Support/Threading.h> namespace art { -void CompileOneMethod(Compiler& compiler, +void CompileOneMethod(CompilerDriver& driver, const CompilerBackend compilerBackend, const DexFile::CodeItem* code_item, uint32_t access_flags, InvokeType invoke_type, @@ -108,8 +108,8 @@ namespace compiler_llvm { llvm::Module* makeLLVMModuleContents(llvm::Module* module); -CompilerLLVM::CompilerLLVM(Compiler* compiler, InstructionSet insn_set) - : compiler_(compiler), insn_set_(insn_set), +CompilerLLVM::CompilerLLVM(CompilerDriver* driver, InstructionSet insn_set) + : compiler_driver_(driver), insn_set_(insn_set), num_cunits_lock_("compilation unit counter lock"), num_cunits_(0), plt_(insn_set) { @@ -139,7 +139,7 @@ CompileDexMethod(OatCompilationUnit* oat_compilation_unit, InvokeType invoke_typ std::string methodName(PrettyMethod(oat_compilation_unit->GetDexMethodIndex(), *oat_compilation_unit->GetDexFile())); // TODO: consolidate ArtCompileMethods - CompileOneMethod(*compiler_, + CompileOneMethod(*compiler_driver_, kPortable, oat_compilation_unit->GetCodeItem(), oat_compilation_unit->access_flags_, @@ -151,14 +151,14 @@ CompileDexMethod(OatCompilationUnit* oat_compilation_unit, InvokeType invoke_typ cunit->GetQuickContext() ); - cunit->SetCompiler(compiler_); + cunit->SetCompiler(compiler_driver_); cunit->SetOatCompilationUnit(oat_compilation_unit); cunit->Materialize(); - Compiler::MethodReference mref(oat_compilation_unit->GetDexFile(), - oat_compilation_unit->GetDexMethodIndex()); - return new CompiledMethod(compiler_->GetInstructionSet(), + CompilerDriver::MethodReference mref(oat_compilation_unit->GetDexFile(), + oat_compilation_unit->GetDexMethodIndex()); + return new CompiledMethod(compiler_driver_->GetInstructionSet(), cunit->GetCompiledCode(), *verifier::MethodVerifier::GetDexGcMap(mref)); } @@ -169,7 +169,7 @@ CompileNativeMethod(OatCompilationUnit* oat_compilation_unit) { UniquePtr<LlvmCompilationUnit> cunit(AllocateCompilationUnit()); UniquePtr<JniCompiler> jni_compiler( - new JniCompiler(cunit.get(), *compiler_, oat_compilation_unit)); + new JniCompiler(cunit.get(), *compiler_driver_, oat_compilation_unit)); return jni_compiler->Compile(); } @@ -180,7 +180,7 @@ CompiledInvokeStub* CompilerLLVM::CreateInvokeStub(bool is_static, UniquePtr<LlvmCompilationUnit> cunit(AllocateCompilationUnit()); UniquePtr<StubCompiler> stub_compiler( - new StubCompiler(cunit.get(), *compiler_)); + new StubCompiler(cunit.get(), *compiler_driver_)); return stub_compiler->CreateInvokeStub(is_static, shorty); } @@ -190,7 +190,7 @@ CompiledInvokeStub* CompilerLLVM::CreateProxyStub(char const *shorty) { UniquePtr<LlvmCompilationUnit> cunit(AllocateCompilationUnit()); UniquePtr<StubCompiler> stub_compiler( - new StubCompiler(cunit.get(), *compiler_)); + new StubCompiler(cunit.get(), *compiler_driver_)); return stub_compiler->CreateProxyStub(shorty); } @@ -198,33 +198,33 @@ CompiledInvokeStub* CompilerLLVM::CreateProxyStub(char const *shorty) { } // namespace compiler_llvm } // namespace art -inline static art::compiler_llvm::CompilerLLVM* ContextOf(art::Compiler& compiler) { - void *compiler_context = compiler.GetCompilerContext(); +inline static art::compiler_llvm::CompilerLLVM* ContextOf(art::CompilerDriver& driver) { + void *compiler_context = driver.GetCompilerContext(); CHECK(compiler_context != NULL); return reinterpret_cast<art::compiler_llvm::CompilerLLVM*>(compiler_context); } -inline static const art::compiler_llvm::CompilerLLVM* ContextOf(const art::Compiler& compiler) { - void *compiler_context = compiler.GetCompilerContext(); +inline static const art::compiler_llvm::CompilerLLVM* ContextOf(const art::CompilerDriver& driver) { + void *compiler_context = driver.GetCompilerContext(); CHECK(compiler_context != NULL); return reinterpret_cast<const art::compiler_llvm::CompilerLLVM*>(compiler_context); } -extern "C" void ArtInitCompilerContext(art::Compiler& compiler) { - CHECK(compiler.GetCompilerContext() == NULL); +extern "C" void ArtInitCompilerContext(art::CompilerDriver& driver) { + CHECK(driver.GetCompilerContext() == NULL); art::compiler_llvm::CompilerLLVM* compiler_llvm = - new art::compiler_llvm::CompilerLLVM(&compiler, - compiler.GetInstructionSet()); + new art::compiler_llvm::CompilerLLVM(&driver, + driver.GetInstructionSet()); - compiler.SetCompilerContext(compiler_llvm); + driver.SetCompilerContext(compiler_llvm); } -extern "C" void ArtUnInitCompilerContext(art::Compiler& compiler) { - delete ContextOf(compiler); - compiler.SetCompilerContext(NULL); +extern "C" void ArtUnInitCompilerContext(art::CompilerDriver& driver) { + delete ContextOf(driver); + driver.SetCompilerContext(NULL); } -extern "C" art::CompiledMethod* ArtCompileMethod(art::Compiler& compiler, +extern "C" art::CompiledMethod* ArtCompileMethod(art::CompilerDriver& driver, const art::DexFile::CodeItem* code_item, uint32_t access_flags, art::InvokeType invoke_type, @@ -238,12 +238,12 @@ extern "C" art::CompiledMethod* ArtCompileMethod(art::Compiler& compiler, art::OatCompilationUnit oat_compilation_unit( class_loader, class_linker, dex_file, code_item, class_def_idx, method_idx, access_flags); - art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(compiler); + art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(driver); art::CompiledMethod* result = compiler_llvm->CompileDexMethod(&oat_compilation_unit, invoke_type); return result; } -extern "C" art::CompiledMethod* ArtLLVMJniCompileMethod(art::Compiler& compiler, +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(); @@ -252,29 +252,29 @@ extern "C" art::CompiledMethod* ArtLLVMJniCompileMethod(art::Compiler& compiler, NULL, class_linker, dex_file, NULL, 0, method_idx, access_flags); - art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(compiler); + art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(driver); art::CompiledMethod* result = compiler_llvm->CompileNativeMethod(&oat_compilation_unit); return result; } -extern "C" art::CompiledInvokeStub* ArtCreateLLVMInvokeStub(art::Compiler& compiler, +extern "C" art::CompiledInvokeStub* ArtCreateLLVMInvokeStub(art::CompilerDriver& driver, bool is_static, const char* shorty, uint32_t shorty_len) { - art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(compiler); + art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(driver); art::CompiledInvokeStub* result = compiler_llvm->CreateInvokeStub(is_static, shorty); return result; } -extern "C" art::CompiledInvokeStub* ArtCreateProxyStub(art::Compiler& compiler, +extern "C" art::CompiledInvokeStub* ArtCreateProxyStub(art::CompilerDriver& driver, const char* shorty, uint32_t shorty_len) { - art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(compiler); + art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(driver); art::CompiledInvokeStub* result = compiler_llvm->CreateProxyStub(shorty); return result; } -extern "C" void compilerLLVMSetBitcodeFileName(art::Compiler& compiler, +extern "C" void compilerLLVMSetBitcodeFileName(art::CompilerDriver& driver, std::string const& filename) { - ContextOf(compiler)->SetBitcodeFileName(filename); + ContextOf(driver)->SetBitcodeFileName(filename); } diff --git a/src/compiler_llvm/compiler_llvm.h b/src/compiler_llvm/compiler_llvm.h index 0cd08a7a39..0995a55edd 100644 --- a/src/compiler_llvm/compiler_llvm.h +++ b/src/compiler_llvm/compiler_llvm.h @@ -18,7 +18,7 @@ #define ART_SRC_COMPILER_LLVM_COMPILER_LLVM_H_ #include "base/macros.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "dex_file.h" #include "instruction_set.h" #include "mirror/object.h" @@ -33,7 +33,7 @@ namespace art { class CompiledInvokeStub; class CompiledMethod; - class Compiler; + class CompilerDriver; class OatCompilationUnit; namespace mirror { class AbstractMethod; @@ -60,12 +60,12 @@ class IRBuilder; class CompilerLLVM { public: - CompilerLLVM(Compiler* compiler, InstructionSet insn_set); + CompilerLLVM(CompilerDriver* driver, InstructionSet insn_set); ~CompilerLLVM(); - Compiler* GetCompiler() const { - return compiler_; + CompilerDriver* GetCompiler() const { + return compiler_driver_; } InstructionSet GetInstructionSet() const { @@ -94,7 +94,7 @@ class CompilerLLVM { private: LlvmCompilationUnit* AllocateCompilationUnit(); - Compiler* compiler_; + CompilerDriver* compiler_driver_; InstructionSet insn_set_; diff --git a/src/compiler_llvm/gbc_expander.cc b/src/compiler_llvm/gbc_expander.cc index 4a5d5b04d4..f0d38306c8 100644 --- a/src/compiler_llvm/gbc_expander.cc +++ b/src/compiler_llvm/gbc_expander.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "intrinsic_helper.h" #include "ir_builder.h" #include "mirror/abstract_method.h" @@ -63,7 +63,7 @@ class GBCExpanderPass : public llvm::FunctionPass { llvm::Value* old_shadow_frame_; private: - art::Compiler* compiler_; + art::CompilerDriver* const driver_; art::OatCompilationUnit* oat_compilation_unit_; @@ -326,11 +326,11 @@ class GBCExpanderPass : public llvm::FunctionPass { static char ID; GBCExpanderPass(const IntrinsicHelper& intrinsic_helper, IRBuilder& irb, - art::Compiler* compiler, art::OatCompilationUnit* oat_compilation_unit) + art::CompilerDriver* compiler, art::OatCompilationUnit* oat_compilation_unit) : llvm::FunctionPass(ID), intrinsic_helper_(intrinsic_helper), irb_(irb), context_(irb.getContext()), rtb_(irb.Runtime()), shadow_frame_(NULL), old_shadow_frame_(NULL), - compiler_(compiler), + driver_(compiler), oat_compilation_unit_(oat_compilation_unit), func_(NULL), current_bb_(NULL), basic_block_unwind_(NULL), changed_(false) {} @@ -1392,7 +1392,7 @@ llvm::Value* GBCExpanderPass::Expand_HLIGet(llvm::CallInst& call_inst, int field_offset; bool is_volatile; - bool is_fast_path = compiler_->ComputeInstanceFieldInfo( + bool is_fast_path = driver_->ComputeInstanceFieldInfo( field_idx, oat_compilation_unit_, field_offset, is_volatile, false); if (!is_fast_path) { @@ -1452,7 +1452,7 @@ void GBCExpanderPass::Expand_HLIPut(llvm::CallInst& call_inst, int field_offset; bool is_volatile; - bool is_fast_path = compiler_->ComputeInstanceFieldInfo( + bool is_fast_path = driver_->ComputeInstanceFieldInfo( field_idx, oat_compilation_unit_, field_offset, is_volatile, true); if (!is_fast_path) { @@ -1509,7 +1509,7 @@ void GBCExpanderPass::Expand_HLIPut(llvm::CallInst& call_inst, llvm::Value* GBCExpanderPass::EmitLoadConstantClass(uint32_t dex_pc, uint32_t type_idx) { - if (!compiler_->CanAccessTypeWithoutChecks(oat_compilation_unit_->method_idx_, + if (!driver_->CanAccessTypeWithoutChecks(oat_compilation_unit_->method_idx_, *oat_compilation_unit_->dex_file_, type_idx)) { llvm::Value* type_idx_value = irb_.getInt32(type_idx); @@ -1536,7 +1536,7 @@ llvm::Value* GBCExpanderPass::EmitLoadConstantClass(uint32_t dex_pc, llvm::Value* type_object_addr = irb_.CreateLoad(type_field_addr, kTBAARuntimeInfo); - if (compiler_->CanAssumeTypeIsPresentInDexCache(*oat_compilation_unit_->dex_file_, type_idx)) { + if (driver_->CanAssumeTypeIsPresentInDexCache(*oat_compilation_unit_->dex_file_, type_idx)) { return type_object_addr; } @@ -1652,7 +1652,7 @@ llvm::Value* GBCExpanderPass::Expand_HLSget(llvm::CallInst& call_inst, bool is_referrers_class; bool is_volatile; - bool is_fast_path = compiler_->ComputeStaticFieldInfo( + bool is_fast_path = driver_->ComputeStaticFieldInfo( field_idx, oat_compilation_unit_, field_offset, ssb_index, is_referrers_class, is_volatile, false); @@ -1734,7 +1734,7 @@ void GBCExpanderPass::Expand_HLSput(llvm::CallInst& call_inst, bool is_referrers_class; bool is_volatile; - bool is_fast_path = compiler_->ComputeStaticFieldInfo( + bool is_fast_path = driver_->ComputeStaticFieldInfo( field_idx, oat_compilation_unit_, field_offset, ssb_index, is_referrers_class, is_volatile, true); @@ -1814,7 +1814,7 @@ llvm::Value* GBCExpanderPass::Expand_ConstString(llvm::CallInst& call_inst) { llvm::Value* string_addr = irb_.CreateLoad(string_field_addr, kTBAARuntimeInfo); - if (!compiler_->CanAssumeStringIsPresentInDexCache(*oat_compilation_unit_->dex_file_, + if (!driver_->CanAssumeStringIsPresentInDexCache(*oat_compilation_unit_->dex_file_, string_idx)) { llvm::BasicBlock* block_str_exist = CreateBasicBlockWithDexPC(dex_pc, "str_exist"); @@ -2037,7 +2037,7 @@ llvm::Value* GBCExpanderPass::Expand_NewInstance(llvm::CallInst& call_inst) { uint32_t type_idx = LV2UInt(call_inst.getArgOperand(0)); llvm::Function* runtime_func; - if (compiler_->CanAccessInstantiableTypeWithoutChecks(oat_compilation_unit_->method_idx_, + if (driver_->CanAccessInstantiableTypeWithoutChecks(oat_compilation_unit_->method_idx_, *oat_compilation_unit_->dex_file_, type_idx)) { runtime_func = irb_.GetRuntime(runtime_support::AllocObject); @@ -2072,7 +2072,7 @@ llvm::Value* GBCExpanderPass::Expand_HLInvoke(llvm::CallInst& call_inst) { int vtable_idx = -1; uintptr_t direct_code = 0; uintptr_t direct_method = 0; - bool is_fast_path = compiler_-> + bool is_fast_path = driver_-> ComputeInvokeInfo(callee_method_idx, oat_compilation_unit_, invoke_type, vtable_idx, direct_code, direct_method); @@ -2289,7 +2289,7 @@ llvm::Value* GBCExpanderPass::EmitAllocNewArray(uint32_t dex_pc, llvm::Function* runtime_func; bool skip_access_check = - compiler_->CanAccessTypeWithoutChecks(oat_compilation_unit_->method_idx_, + driver_->CanAccessTypeWithoutChecks(oat_compilation_unit_->method_idx_, *oat_compilation_unit_->dex_file_, type_idx); @@ -3634,8 +3634,8 @@ namespace compiler_llvm { llvm::FunctionPass* CreateGBCExpanderPass(const IntrinsicHelper& intrinsic_helper, IRBuilder& irb, - Compiler* compiler, OatCompilationUnit* oat_compilation_unit) { - return new GBCExpanderPass(intrinsic_helper, irb, compiler, oat_compilation_unit); + CompilerDriver* driver, OatCompilationUnit* oat_compilation_unit) { + return new GBCExpanderPass(intrinsic_helper, irb, driver, oat_compilation_unit); } } // namespace compiler_llvm diff --git a/src/compiler_llvm/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc index c23c5e20da..8b5f1be8c3 100644 --- a/src/compiler_llvm/jni_compiler.cc +++ b/src/compiler_llvm/jni_compiler.cc @@ -19,7 +19,7 @@ #include "base/logging.h" #include "class_linker.h" #include "compiled_method.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "compiler_llvm.h" #include "ir_builder.h" #include "llvm_compilation_unit.h" @@ -43,14 +43,15 @@ namespace compiler_llvm { using namespace runtime_support; JniCompiler::JniCompiler(LlvmCompilationUnit* cunit, - Compiler const& compiler, + const CompilerDriver& driver, OatCompilationUnit* oat_compilation_unit) -: cunit_(cunit), compiler_(&compiler), module_(cunit_->GetModule()), +: cunit_(cunit), driver_(&driver), module_(cunit_->GetModule()), context_(cunit_->GetLLVMContext()), irb_(*cunit_->GetIRBuilder()), oat_compilation_unit_(oat_compilation_unit), access_flags_(oat_compilation_unit->access_flags_), method_idx_(oat_compilation_unit->method_idx_), - dex_file_(oat_compilation_unit->dex_file_) { + dex_file_(oat_compilation_unit->dex_file_), + func_(NULL), elf_func_idx_(0) { // Check: Ensure that JNI compiler will only get "native" method CHECK((access_flags_ & kAccNative) != 0); diff --git a/src/compiler_llvm/jni_compiler.h b/src/compiler_llvm/jni_compiler.h index 46481802b5..071229c051 100644 --- a/src/compiler_llvm/jni_compiler.h +++ b/src/compiler_llvm/jni_compiler.h @@ -22,7 +22,7 @@ namespace art { class ClassLinker; class CompiledMethod; - class Compiler; + class CompilerDriver; class DexFile; class OatCompilationUnit; namespace mirror { @@ -52,7 +52,7 @@ class IRBuilder; class JniCompiler { public: JniCompiler(LlvmCompilationUnit* cunit, - Compiler const& compiler, + const CompilerDriver& driver, OatCompilationUnit* oat_compilation_unit); CompiledMethod* Compile(); @@ -65,7 +65,7 @@ class JniCompiler { private: LlvmCompilationUnit* cunit_; - const Compiler* compiler_; + const CompilerDriver* const driver_; llvm::Module* module_; llvm::LLVMContext* context_; diff --git a/src/compiler_llvm/llvm_compilation_unit.cc b/src/compiler_llvm/llvm_compilation_unit.cc index 1c0218f0e3..3f13c185cf 100644 --- a/src/compiler_llvm/llvm_compilation_unit.cc +++ b/src/compiler_llvm/llvm_compilation_unit.cc @@ -82,7 +82,7 @@ namespace compiler_llvm { llvm::FunctionPass* CreateGBCExpanderPass(const IntrinsicHelper& intrinsic_helper, IRBuilder& irb, - Compiler* compiler, OatCompilationUnit* oat_compilation_unit); + CompilerDriver* compiler, OatCompilationUnit* oat_compilation_unit); llvm::Module* makeLLVMModuleContents(llvm::Module* module); @@ -90,7 +90,7 @@ llvm::Module* makeLLVMModuleContents(llvm::Module* module); LlvmCompilationUnit::LlvmCompilationUnit(const CompilerLLVM* compiler_llvm, size_t cunit_idx) : compiler_llvm_(compiler_llvm), cunit_idx_(cunit_idx) { - compiler_ = NULL; + driver_ = NULL; oat_compilation_unit_ = NULL; llvm_info_.reset(new LLVMInfo()); context_.reset(llvm_info_->GetLLVMContext()); @@ -175,7 +175,7 @@ bool LlvmCompilationUnit::MaterializeToRawOStream(llvm::raw_ostream& out_stream) std::string target_triple; std::string target_cpu; std::string target_attr; - Compiler::InstructionSetToLLVMTarget(GetInstructionSet(), target_triple, target_cpu, target_attr); + CompilerDriver::InstructionSetToLLVMTarget(GetInstructionSet(), target_triple, target_cpu, target_attr); std::string errmsg; const llvm::Target* target = @@ -214,11 +214,11 @@ bool LlvmCompilationUnit::MaterializeToRawOStream(llvm::raw_ostream& out_stream) // If we don't need write the bitcode to file, add the AddSuspendCheckToLoopLatchPass to the // regular FunctionPass. fpm.add(CreateGBCExpanderPass(*llvm_info_->GetIntrinsicHelper(), *irb_.get(), - compiler_, oat_compilation_unit_)); + driver_, oat_compilation_unit_)); } else { llvm::FunctionPassManager fpm2(module_); fpm2.add(CreateGBCExpanderPass(*llvm_info_->GetIntrinsicHelper(), *irb_.get(), - compiler_, oat_compilation_unit_)); + driver_, oat_compilation_unit_)); fpm2.doInitialization(); for (llvm::Module::iterator F = module_->begin(), E = module_->end(); F != E; ++F) { diff --git a/src/compiler_llvm/llvm_compilation_unit.h b/src/compiler_llvm/llvm_compilation_unit.h index 8ea4ea2445..801bbef8ea 100644 --- a/src/compiler_llvm/llvm_compilation_unit.h +++ b/src/compiler_llvm/llvm_compilation_unit.h @@ -20,7 +20,7 @@ #include "base/logging.h" #include "base/mutex.h" #include "compiler/dex/compiler_internals.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "globals.h" #include "instruction_set.h" #include "oat_compilation_unit.h" @@ -78,8 +78,8 @@ class LlvmCompilationUnit { LLVMInfo* GetQuickContext() const { return llvm_info_.get(); } - void SetCompiler(Compiler* compiler) { - compiler_ = compiler; + void SetCompiler(CompilerDriver* driver) { + driver_ = driver; } void SetOatCompilationUnit(OatCompilationUnit* oat_compilation_unit) { oat_compilation_unit_ = oat_compilation_unit; @@ -109,7 +109,7 @@ class LlvmCompilationUnit { llvm::Module* module_; // Managed by context_ UniquePtr<IntrinsicHelper> intrinsic_helper_; UniquePtr<LLVMInfo> llvm_info_; - Compiler* compiler_; + CompilerDriver* driver_; OatCompilationUnit* oat_compilation_unit_; std::string bitcode_filename_; diff --git a/src/compiler_llvm/stub_compiler.cc b/src/compiler_llvm/stub_compiler.cc index e0a3b3c8a3..6639ca7c87 100644 --- a/src/compiler_llvm/stub_compiler.cc +++ b/src/compiler_llvm/stub_compiler.cc @@ -18,7 +18,7 @@ #include "base/logging.h" #include "compiled_method.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "compiler_llvm.h" #include "ir_builder.h" #include "llvm_compilation_unit.h" @@ -40,8 +40,8 @@ namespace compiler_llvm { using namespace runtime_support; -StubCompiler::StubCompiler(LlvmCompilationUnit* cunit, Compiler& compiler) -: cunit_(cunit), compiler_(&compiler), module_(cunit_->GetModule()), +StubCompiler::StubCompiler(LlvmCompilationUnit* cunit, const CompilerDriver& driver) +: cunit_(cunit), driver_(&driver), module_(cunit_->GetModule()), context_(cunit_->GetLLVMContext()), irb_(*cunit_->GetIRBuilder()) { } diff --git a/src/compiler_llvm/stub_compiler.h b/src/compiler_llvm/stub_compiler.h index 312b3af275..63b283dd3f 100644 --- a/src/compiler_llvm/stub_compiler.h +++ b/src/compiler_llvm/stub_compiler.h @@ -22,7 +22,7 @@ namespace art { class CompiledInvokeStub; class CompiledProxyStub; - class Compiler; + class CompilerDriver; } namespace llvm { @@ -39,14 +39,14 @@ class IRBuilder; class StubCompiler { public: - StubCompiler(LlvmCompilationUnit* cunit, Compiler& compiler); + StubCompiler(LlvmCompilationUnit* cunit, const CompilerDriver& compiler); CompiledInvokeStub* CreateInvokeStub(bool is_static, const char* shorty); CompiledInvokeStub* CreateProxyStub(const char* shorty); private: LlvmCompilationUnit* cunit_; - const Compiler* compiler_; + const CompilerDriver* const driver_; llvm::Module* module_; llvm::LLVMContext* context_; IRBuilder& irb_; diff --git a/src/dex2oat.cc b/src/dex2oat.cc index 703a5a11d5..6b94dc01d4 100644 --- a/src/dex2oat.cc +++ b/src/dex2oat.cc @@ -28,7 +28,7 @@ #include "base/timing_logger.h" #include "base/unix_file/fd_file.h" #include "class_linker.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "image_writer.h" #include "leb128.h" #include "mirror/abstract_method-inl.h" @@ -213,7 +213,7 @@ class Dex2Oat { return image_classes.release(); } - const Compiler* CreateOatFile(const std::string& boot_image_option, + const CompilerDriver* CreateOatFile(const std::string& boot_image_option, const std::string* host_prefix, const std::vector<const DexFile*>& dex_files, File* oat_file, @@ -240,22 +240,22 @@ class Dex2Oat { Runtime::Current()->SetCompileTimeClassPath(class_loader, class_path_files); } - UniquePtr<Compiler> compiler(new Compiler(compiler_backend_, - instruction_set_, - image, - thread_count_, - support_debugging_, - image_classes, - dump_stats, - dump_timings)); + UniquePtr<CompilerDriver> driver(new CompilerDriver(compiler_backend_, + instruction_set_, + image, + thread_count_, + support_debugging_, + image_classes, + dump_stats, + dump_timings)); if (compiler_backend_ == kPortable) { - compiler->SetBitcodeFileName(bitcode_filename); + driver->SetBitcodeFileName(bitcode_filename); } Thread::Current()->TransitionFromRunnableToSuspended(kNative); - compiler->CompileAll(class_loader, dex_files); + driver->CompileAll(class_loader, dex_files); Thread::Current()->TransitionFromSuspendedToRunnable(); @@ -280,17 +280,17 @@ class Dex2Oat { image_file_location_oat_checksum, image_file_location_oat_data_begin, image_file_location, - *compiler.get())) { + *driver.get())) { LOG(ERROR) << "Failed to create oat file " << oat_file->GetPath(); return NULL; } - if (!compiler->WriteElf(oat_contents, oat_file)) { + if (!driver->WriteElf(oat_contents, oat_file)) { LOG(ERROR) << "Failed to write ELF file " << oat_file->GetPath(); return NULL; } - return compiler.release(); + return driver.release(); } bool CreateImageFile(const std::string& image_filename, @@ -298,7 +298,7 @@ class Dex2Oat { const std::set<std::string>* image_classes, const std::string& oat_filename, const std::string& oat_location, - const Compiler& compiler) + const CompilerDriver& compiler) LOCKS_EXCLUDED(Locks::mutator_lock_) { uintptr_t oat_data_begin; { @@ -346,15 +346,15 @@ class Dex2Oat { Runtime* runtime = Runtime::Current(); // if we loaded an existing image, we will reuse values from the image roots. if (!runtime->HasJniDlsymLookupStub()) { - runtime->SetJniDlsymLookupStub(Compiler::CreateJniDlsymLookupStub(instruction_set)); + runtime->SetJniDlsymLookupStub(CompilerDriver::CreateJniDlsymLookupStub(instruction_set)); } if (!runtime->HasAbstractMethodErrorStubArray()) { - runtime->SetAbstractMethodErrorStubArray(Compiler::CreateAbstractMethodErrorStub(instruction_set)); + runtime->SetAbstractMethodErrorStubArray(CompilerDriver::CreateAbstractMethodErrorStub(instruction_set)); } for (int i = 0; i < Runtime::kLastTrampolineMethodType; i++) { Runtime::TrampolineType type = Runtime::TrampolineType(i); if (!runtime->HasResolutionStubArray(type)) { - runtime->SetResolutionStubArray(Compiler::CreateResolutionStub(instruction_set, type), type); + runtime->SetResolutionStubArray(CompilerDriver::CreateResolutionStub(instruction_set, type), type); } } if (!runtime->HasResolutionMethod()) { @@ -919,15 +919,15 @@ static int dex2oat(int argc, char** argv) { } } - UniquePtr<const Compiler> compiler(dex2oat->CreateOatFile(boot_image_option, - host_prefix.get(), - dex_files, - oat_file.get(), - bitcode_filename, - image, - image_classes.get(), - dump_stats, - dump_timings)); + UniquePtr<const CompilerDriver> compiler(dex2oat->CreateOatFile(boot_image_option, + host_prefix.get(), + dex_files, + oat_file.get(), + bitcode_filename, + image, + image_classes.get(), + dump_stats, + dump_timings)); if (compiler.get() == NULL) { LOG(ERROR) << "Failed to create oat file: " << oat_location; diff --git a/src/elf_writer.cc b/src/elf_writer.cc index 19bd232a5e..3fdb8e44ba 100644 --- a/src/elf_writer.cc +++ b/src/elf_writer.cc @@ -17,6 +17,7 @@ #include "elf_writer.h" #include "base/unix_file/fd_file.h" +#include "compiler/driver/compiler_driver.h" #include "elf_file.h" #include "oat.h" #include "oat_file.h" @@ -34,12 +35,12 @@ namespace art { -bool ElfWriter::Create(File* file, std::vector<uint8_t>& oat_contents, const Compiler& compiler) { - ElfWriter elf_writer(compiler); +bool ElfWriter::Create(File* file, std::vector<uint8_t>& oat_contents, const CompilerDriver& compiler) { + ElfWriter elf_writer(&compiler); return elf_writer.Write(oat_contents, file); } -ElfWriter::ElfWriter(const Compiler& compiler) : compiler_(&compiler) {} +ElfWriter::ElfWriter(const CompilerDriver* driver) : compiler_driver_(driver) {} ElfWriter::~ElfWriter() {} @@ -59,7 +60,7 @@ bool ElfWriter::Write(std::vector<uint8_t>& oat_contents, File* elf_file) { std::string target_triple; std::string target_cpu; std::string target_attr; - Compiler::InstructionSetToLLVMTarget(compiler_->GetInstructionSet(), + CompilerDriver::InstructionSetToLLVMTarget(compiler_driver_->GetInstructionSet(), target_triple, target_cpu, target_attr); @@ -80,7 +81,7 @@ bool ElfWriter::Write(std::vector<uint8_t>& oat_contents, File* elf_file) { UniquePtr<mcld::LinkerConfig> linker_config(new mcld::LinkerConfig(target_triple)); CHECK(linker_config.get() != NULL); linker_config->setCodeGenType(mcld::LinkerConfig::DynObj); - if (compiler_->GetInstructionSet() == kMips) { + if (compiler_driver_->GetInstructionSet() == kMips) { // MCLinker defaults MIPS section alignment to 0x10000, not 0x1000 mcld::ZOption z_option; z_option.setKind(mcld::ZOption::MaxPageSize); diff --git a/src/elf_writer.h b/src/elf_writer.h index 0402c400a8..f55003f36e 100644 --- a/src/elf_writer.h +++ b/src/elf_writer.h @@ -17,15 +17,18 @@ #ifndef ART_SRC_ELF_WRITER_H_ #define ART_SRC_ELF_WRITER_H_ -#include "compiler.h" +#include "elf_file.h" #include "os.h" +#include <vector> + namespace art { +class CompilerDriver; class ElfWriter { public: // Write an ELF file. Returns true on success, false on failure. - static bool Create(File* file, std::vector<uint8_t>& oat_contents, const Compiler& compiler); + static bool Create(File* file, std::vector<uint8_t>& oat_contents, const CompilerDriver& compiler); // Fixup an ELF file so that that oat header will be loaded at oat_begin. // Returns true on success, false on failure. @@ -38,7 +41,7 @@ class ElfWriter { size_t& oat_data_offset); private: - ElfWriter(const Compiler& compiler); + ElfWriter(const CompilerDriver* driver); ~ElfWriter(); bool Write(std::vector<uint8_t>& oat_contents, File* elf_file); @@ -55,7 +58,7 @@ class ElfWriter { // Fixup symbol table static bool FixupSymbols(ElfFile& elf_file, uintptr_t base_address, bool dynamic); - const Compiler* compiler_; + const CompilerDriver* const compiler_driver_; }; } // namespace art diff --git a/src/image_test.cc b/src/image_test.cc index ed6426b7b1..6d22cada4c 100644 --- a/src/image_test.cc +++ b/src/image_test.cc @@ -47,7 +47,7 @@ TEST_F(ImageTest, WriteRead) { std::vector<const DexFile*> dex_files; dex_files.push_back(java_lang_dex_file_); VectorOutputStream output_stream(tmp_elf.GetFilename(), oat_contents); - bool success_oat = OatWriter::Create(output_stream, dex_files, 0, 0, "", *compiler_.get()); + bool success_oat = OatWriter::Create(output_stream, dex_files, 0, 0, "", *compiler_driver_.get()); ASSERT_TRUE(success_oat); // Force all system classes into memory @@ -58,7 +58,7 @@ TEST_F(ImageTest, WriteRead) { EXPECT_TRUE(klass != NULL) << descriptor; } } - bool success_elf = compiler_->WriteElf(oat_contents, tmp_elf.GetFile()); + bool success_elf = compiler_driver_->WriteElf(oat_contents, tmp_elf.GetFile()); ASSERT_TRUE(success_elf); } // Workound bug that mcld::Linker::emit closes tmp_elf by reopening as tmp_oat. @@ -71,9 +71,9 @@ TEST_F(ImageTest, WriteRead) { ImageWriter writer(NULL); bool success_image = writer.Write(tmp_image.GetFilename(), requested_image_base, tmp_oat->GetPath(), tmp_oat->GetPath(), - *compiler_.get()); + *compiler_driver_.get()); ASSERT_TRUE(success_image); - bool success_fixup = compiler_->FixupElf(tmp_oat.get(), writer.GetOatDataBegin()); + bool success_fixup = compiler_driver_->FixupElf(tmp_oat.get(), writer.GetOatDataBegin()); ASSERT_TRUE(success_fixup); } @@ -94,7 +94,7 @@ TEST_F(ImageTest, WriteRead) { } // Need to delete the compiler since it has worker threads which are attached to runtime. - compiler_.reset(); + compiler_driver_.reset(); // Tear down old runtime before making a new one, clearing out misc state. runtime_.reset(); diff --git a/src/image_writer.cc b/src/image_writer.cc index e21ff72d57..d9ac61b112 100644 --- a/src/image_writer.cc +++ b/src/image_writer.cc @@ -24,7 +24,7 @@ #include "base/unix_file/fd_file.h" #include "class_linker.h" #include "compiled_method.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "gc/card_table-inl.h" #include "gc/large_object_space.h" #include "gc/space.h" @@ -57,7 +57,7 @@ bool ImageWriter::Write(const std::string& image_filename, uintptr_t image_begin, const std::string& oat_filename, const std::string& oat_location, - const Compiler& compiler) { + const CompilerDriver& compiler_driver) { CHECK(!image_filename.empty()); CHECK_NE(image_begin, 0U); @@ -109,10 +109,10 @@ bool ImageWriter::Write(const std::string& image_filename, Thread::Current()->TransitionFromSuspendedToRunnable(); size_t oat_loaded_size = 0; size_t oat_data_offset = 0; - compiler.GetOatElfInformation(oat_file.get(), oat_loaded_size, oat_data_offset); + compiler_driver.GetOatElfInformation(oat_file.get(), oat_loaded_size, oat_data_offset); CalculateNewObjectOffsets(oat_loaded_size, oat_data_offset); CopyAndFixupObjects(); - PatchOatCodeAndMethods(compiler); + PatchOatCodeAndMethods(compiler_driver); Thread::Current()->TransitionFromRunnableToSuspended(kNative); UniquePtr<File> image_file(OS::OpenFile(image_filename.c_str(), true)); @@ -616,7 +616,7 @@ void ImageWriter::FixupFields(const Object* orig, } } -static AbstractMethod* GetTargetMethod(const Compiler::PatchInformation* patch) +static AbstractMethod* GetTargetMethod(const CompilerDriver::PatchInformation* patch) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); DexCache* dex_cache = class_linker->FindDexCache(patch->GetDexFile()); @@ -637,15 +637,15 @@ static AbstractMethod* GetTargetMethod(const Compiler::PatchInformation* patch) return method; } -void ImageWriter::PatchOatCodeAndMethods(const Compiler& compiler) { +void ImageWriter::PatchOatCodeAndMethods(const CompilerDriver& compiler) { Thread* self = Thread::Current(); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); const char* old_cause = self->StartAssertNoThreadSuspension("ImageWriter"); - typedef std::vector<const Compiler::PatchInformation*> Patches; + typedef std::vector<const CompilerDriver::PatchInformation*> Patches; const Patches& code_to_patch = compiler.GetCodeToPatch(); for (size_t i = 0; i < code_to_patch.size(); i++) { - const Compiler::PatchInformation* patch = code_to_patch[i]; + const CompilerDriver::PatchInformation* patch = code_to_patch[i]; AbstractMethod* target = GetTargetMethod(patch); uint32_t code = reinterpret_cast<uint32_t>(class_linker->GetOatCodeFor(target)); uint32_t code_base = reinterpret_cast<uint32_t>(&oat_file_->GetOatHeader()); @@ -655,7 +655,7 @@ void ImageWriter::PatchOatCodeAndMethods(const Compiler& compiler) { const Patches& methods_to_patch = compiler.GetMethodsToPatch(); for (size_t i = 0; i < methods_to_patch.size(); i++) { - const Compiler::PatchInformation* patch = methods_to_patch[i]; + const CompilerDriver::PatchInformation* patch = methods_to_patch[i]; AbstractMethod* target = GetTargetMethod(patch); SetPatchLocation(patch, reinterpret_cast<uint32_t>(GetImageAddress(target))); } @@ -666,7 +666,7 @@ void ImageWriter::PatchOatCodeAndMethods(const Compiler& compiler) { self->EndAssertNoThreadSuspension(old_cause); } -void ImageWriter::SetPatchLocation(const Compiler::PatchInformation* patch, uint32_t value) { +void ImageWriter::SetPatchLocation(const CompilerDriver::PatchInformation* patch, uint32_t value) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); const void* oat_code = class_linker->GetOatCodeFor(patch->GetDexFile(), patch->GetReferrerMethodIdx()); diff --git a/src/image_writer.h b/src/image_writer.h index eff9ffb3de..ee02ec43f0 100644 --- a/src/image_writer.h +++ b/src/image_writer.h @@ -23,7 +23,7 @@ #include <set> #include <string> -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "mem_map.h" #include "oat_file.h" #include "mirror/dex_cache.h" @@ -47,7 +47,7 @@ class ImageWriter { uintptr_t image_begin, const std::string& oat_filename, const std::string& oat_location, - const Compiler& compiler) + const CompilerDriver& compiler_driver) LOCKS_EXCLUDED(Locks::mutator_lock_); uintptr_t GetOatDataBegin() { @@ -153,9 +153,9 @@ class ImageWriter { bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void PatchOatCodeAndMethods(const Compiler& compiler) + void PatchOatCodeAndMethods(const CompilerDriver& compiler) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetPatchLocation(const Compiler::PatchInformation* patch, uint32_t value) + void SetPatchLocation(const CompilerDriver::PatchInformation* patch, uint32_t value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); SafeMap<const mirror::Object*, size_t> offsets_; diff --git a/src/oat/jni/arm/jni_internal_arm.cc b/src/oat/jni/arm/jni_internal_arm.cc index 4af4f528f5..1cbe5d92e9 100644 --- a/src/oat/jni/arm/jni_internal_arm.cc +++ b/src/oat/jni/arm/jni_internal_arm.cc @@ -20,7 +20,7 @@ #include "asm_support.h" #include "compiled_method.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "invoke_arg_array_builder.h" #include "jni_internal.h" #include "mirror/abstract_method.h" @@ -160,7 +160,7 @@ CompiledInvokeStub* CreateInvokeStub(bool is_static, const char* shorty, uint32_ } // namespace arm } // namespace art -extern "C" art::CompiledInvokeStub* ArtCreateArmInvokeStub(art::Compiler& /*compiler*/, bool is_static, +extern "C" art::CompiledInvokeStub* ArtCreateArmInvokeStub(art::CompilerDriver& /*compiler*/, bool is_static, const char* shorty, uint32_t shorty_len) { return art::arm::CreateInvokeStub(is_static, shorty, shorty_len); } diff --git a/src/oat/jni/jni_compiler.cc b/src/oat/jni/jni_compiler.cc index ae5bce4821..c4919fbc6f 100644 --- a/src/oat/jni/jni_compiler.cc +++ b/src/oat/jni/jni_compiler.cc @@ -22,7 +22,7 @@ #include "calling_convention.h" #include "class_linker.h" #include "compiled_method.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "disassembler.h" #include "jni_internal.h" #include "oat/runtime/oat_support_entrypoints.h" @@ -51,7 +51,7 @@ static void SetNativeParameter(Assembler* jni_asm, // registers, a reference to the method object is supplied as part of this // convention. // -CompiledMethod* ArtJniCompileMethodInternal(Compiler& compiler, +CompiledMethod* ArtJniCompileMethodInternal(CompilerDriver& compiler, uint32_t access_flags, uint32_t method_idx, const DexFile& dex_file) { const bool is_native = (access_flags & kAccNative) != 0; @@ -481,7 +481,7 @@ static void SetNativeParameter(Assembler* jni_asm, } // namespace art -extern "C" art::CompiledMethod* ArtQuickJniCompileMethod(art::Compiler& compiler, +extern "C" art::CompiledMethod* ArtQuickJniCompileMethod(art::CompilerDriver& compiler, uint32_t access_flags, uint32_t method_idx, const art::DexFile& dex_file) { return ArtJniCompileMethodInternal(compiler, access_flags, method_idx, dex_file); diff --git a/src/oat/jni/mips/jni_internal_mips.cc b/src/oat/jni/mips/jni_internal_mips.cc index 69e86c357c..133052d07b 100644 --- a/src/oat/jni/mips/jni_internal_mips.cc +++ b/src/oat/jni/mips/jni_internal_mips.cc @@ -20,7 +20,7 @@ #include "asm_support.h" #include "compiled_method.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "invoke_arg_array_builder.h" #include "jni_internal.h" #include "mirror/abstract_method.h" @@ -171,7 +171,7 @@ CompiledInvokeStub* CreateInvokeStub(bool is_static, const char* shorty, uint32_ } // namespace mips } // namespace art -extern "C" art::CompiledInvokeStub* ArtCreateMipsInvokeStub(art::Compiler& /*compiler*/, bool is_static, +extern "C" art::CompiledInvokeStub* ArtCreateMipsInvokeStub(art::CompilerDriver& /*compiler*/, bool is_static, const char* shorty, uint32_t shorty_len) { return art::mips::CreateInvokeStub(is_static, shorty, shorty_len); } diff --git a/src/oat/jni/x86/jni_internal_x86.cc b/src/oat/jni/x86/jni_internal_x86.cc index fabd283a3d..58d0664173 100644 --- a/src/oat/jni/x86/jni_internal_x86.cc +++ b/src/oat/jni/x86/jni_internal_x86.cc @@ -15,7 +15,7 @@ */ #include "compiled_method.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "invoke_arg_array_builder.h" #include "jni_internal.h" #include "mirror/abstract_method.h" @@ -165,7 +165,7 @@ CompiledInvokeStub* CreateInvokeStub(bool is_static, const char* shorty, uint32_ } // namespace x86 } // namespace art -extern "C" art::CompiledInvokeStub* ArtCreateX86InvokeStub(art::Compiler& /*compiler*/, bool is_static, +extern "C" art::CompiledInvokeStub* ArtCreateX86InvokeStub(art::CompilerDriver& /*compiler*/, bool is_static, const char* shorty, uint32_t shorty_len) { return art::x86::CreateInvokeStub(is_static, shorty, shorty_len); } diff --git a/src/oat_test.cc b/src/oat_test.cc index 3d1e19b9ef..69ce48bab9 100644 --- a/src/oat_test.cc +++ b/src/oat_test.cc @@ -32,7 +32,7 @@ class OatTest : public CommonTest { const DexFile* dex_file) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { const CompiledMethod* compiled_method = - compiler_->GetCompiledMethod(Compiler::MethodReference(dex_file, + compiler_driver_->GetCompiledMethod(CompilerDriver::MethodReference(dex_file, method->GetDexMethodIndex())); if (compiled_method == NULL) { @@ -75,8 +75,8 @@ TEST_F(OatTest, WriteRead) { #else CompilerBackend compiler_backend = kQuick; #endif - compiler_.reset(new Compiler(compiler_backend, kThumb2, false, 2, false, NULL, true, true)); - compiler_->CompileAll(class_loader, class_linker->GetBootClassPath()); + compiler_driver_.reset(new CompilerDriver(compiler_backend, kThumb2, false, 2, false, NULL, true, true)); + compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath()); } ScopedObjectAccess soa(Thread::Current()); @@ -88,13 +88,13 @@ TEST_F(OatTest, WriteRead) { 42U, 4096U, "lue.art", - *compiler_.get()); + *compiler_driver_.get()); ASSERT_TRUE(success_oat); - bool success_elf = compiler_->WriteElf(oat_contents, tmp.GetFile()); + bool success_elf = compiler_driver_->WriteElf(oat_contents, tmp.GetFile()); ASSERT_TRUE(success_elf); if (compile) { // OatWriter strips the code, regenerate to compare - compiler_->CompileAll(class_loader, class_linker->GetBootClassPath()); + compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath()); } UniquePtr<OatFile> oat_file(OatFile::Open(tmp.GetFilename(), tmp.GetFilename(), NULL)); ASSERT_TRUE(oat_file.get() != NULL); diff --git a/src/oat_writer.cc b/src/oat_writer.cc index 5e2b30c67f..1a269e98a6 100644 --- a/src/oat_writer.cc +++ b/src/oat_writer.cc @@ -38,12 +38,12 @@ bool OatWriter::Create(OutputStream& output_stream, uint32_t image_file_location_oat_checksum, uint32_t image_file_location_oat_begin, const std::string& image_file_location, - const Compiler& compiler) { + const CompilerDriver& driver) { OatWriter oat_writer(dex_files, image_file_location_oat_checksum, image_file_location_oat_begin, image_file_location, - compiler); + &driver); return oat_writer.Write(output_stream); } @@ -51,8 +51,8 @@ OatWriter::OatWriter(const std::vector<const DexFile*>& dex_files, uint32_t image_file_location_oat_checksum, uint32_t image_file_location_oat_begin, const std::string& image_file_location, - const Compiler& compiler) { - compiler_ = &compiler; + const CompilerDriver* compiler) + : compiler_driver_(compiler) { image_file_location_oat_checksum_ = image_file_location_oat_checksum; image_file_location_oat_begin_ = image_file_location_oat_begin; image_file_location_ = image_file_location; @@ -78,7 +78,7 @@ OatWriter::~OatWriter() { size_t OatWriter::InitOatHeader() { // create the OatHeader - oat_header_ = new OatHeader(compiler_->GetInstructionSet(), + oat_header_ = new OatHeader(compiler_driver_->GetInstructionSet(), dex_files_, image_file_location_oat_checksum_, image_file_location_oat_begin_, @@ -134,8 +134,8 @@ size_t OatWriter::InitOatClasses(size_t offset) { num_methods = num_direct_methods + num_virtual_methods; } - Compiler::ClassReference class_ref = Compiler::ClassReference(dex_file, class_def_index); - CompiledClass* compiled_class = compiler_->GetCompiledClass(class_ref); + CompilerDriver::ClassReference class_ref = CompilerDriver::ClassReference(dex_file, class_def_index); + CompiledClass* compiled_class = compiler_driver_->GetCompiledClass(class_ref); mirror::Class::Status status; if (compiled_class != NULL) { status = compiled_class->GetStatus(); @@ -249,7 +249,7 @@ size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index, #endif CompiledMethod* compiled_method = - compiler_->GetCompiledMethod(Compiler::MethodReference(dex_file, method_idx)); + compiler_driver_->GetCompiledMethod(CompilerDriver::MethodReference(dex_file, method_idx)); if (compiled_method != NULL) { offset = compiled_method->AlignCode(offset); DCHECK_ALIGNED(offset, kArmAlignment); @@ -307,8 +307,8 @@ size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index, #if !defined(NDEBUG) // We expect GC maps except when the class hasn't been verified or the method is native - Compiler::ClassReference class_ref = Compiler::ClassReference(dex_file, class_def_index); - CompiledClass* compiled_class = compiler_->GetCompiledClass(class_ref); + CompilerDriver::ClassReference class_ref = CompilerDriver::ClassReference(dex_file, class_def_index); + CompiledClass* compiled_class = compiler_driver_->GetCompiledClass(class_ref); mirror::Class::Status status; if (compiled_class != NULL) { status = compiled_class->GetStatus(); @@ -335,10 +335,10 @@ size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index, } const char* shorty = dex_file->GetMethodShorty(dex_file->GetMethodId(method_idx)); - const CompiledInvokeStub* compiled_invoke_stub = compiler_->FindInvokeStub(type == kStatic, + const CompiledInvokeStub* compiled_invoke_stub = compiler_driver_->FindInvokeStub(type == kStatic, shorty); if (compiled_invoke_stub != NULL) { - offset = CompiledMethod::AlignCode(offset, compiler_->GetInstructionSet()); + offset = CompiledMethod::AlignCode(offset, compiler_driver_->GetInstructionSet()); DCHECK_ALIGNED(offset, kArmAlignment); const std::vector<uint8_t>& invoke_stub = compiled_invoke_stub->GetCode(); uint32_t invoke_stub_size = invoke_stub.size() * sizeof(invoke_stub[0]); @@ -360,9 +360,9 @@ size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index, #if defined(ART_USE_PORTABLE_COMPILER) if (type != kStatic) { - const CompiledInvokeStub* compiled_proxy_stub = compiler_->FindProxyStub(shorty); + const CompiledInvokeStub* compiled_proxy_stub = compiler_driver_->FindProxyStub(shorty); if (compiled_proxy_stub != NULL) { - offset = CompiledMethod::AlignCode(offset, compiler_->GetInstructionSet()); + offset = CompiledMethod::AlignCode(offset, compiler_driver_->GetInstructionSet()); DCHECK_ALIGNED(offset, kArmAlignment); const std::vector<uint8_t>& proxy_stub = compiled_proxy_stub->GetCode(); uint32_t proxy_stub_size = proxy_stub.size() * sizeof(proxy_stub[0]); @@ -398,7 +398,7 @@ size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index, #endif ); - if (compiler_->IsImage()) { + if (compiler_driver_->IsImage()) { ClassLinker* linker = Runtime::Current()->GetClassLinker(); mirror::DexCache* dex_cache = linker->FindDexCache(*dex_file); // Unchecked as we hold mutator_lock_ on entry. @@ -579,7 +579,7 @@ size_t OatWriter::WriteCodeMethod(OutputStream& out, size_t code_offset, size_t size_t class_def_method_index, bool is_static, uint32_t method_idx, const DexFile& dex_file) { const CompiledMethod* compiled_method = - compiler_->GetCompiledMethod(Compiler::MethodReference(&dex_file, method_idx)); + compiler_driver_->GetCompiledMethod(CompilerDriver::MethodReference(&dex_file, method_idx)); OatMethodOffsets method_offsets = oat_classes_[oat_class_index]->method_offsets_[class_def_method_index]; @@ -694,10 +694,10 @@ size_t OatWriter::WriteCodeMethod(OutputStream& out, size_t code_offset, size_t DCHECK_CODE_OFFSET(); } const char* shorty = dex_file.GetMethodShorty(dex_file.GetMethodId(method_idx)); - const CompiledInvokeStub* compiled_invoke_stub = compiler_->FindInvokeStub(is_static, shorty); + const CompiledInvokeStub* compiled_invoke_stub = compiler_driver_->FindInvokeStub(is_static, shorty); if (compiled_invoke_stub != NULL) { uint32_t aligned_code_offset = CompiledMethod::AlignCode(code_offset, - compiler_->GetInstructionSet()); + compiler_driver_->GetInstructionSet()); uint32_t aligned_code_delta = aligned_code_offset - code_offset; if (aligned_code_delta != 0) { off_t new_offset = out.Seek(aligned_code_delta, kSeekCurrent); @@ -739,10 +739,10 @@ size_t OatWriter::WriteCodeMethod(OutputStream& out, size_t code_offset, size_t #if defined(ART_USE_PORTABLE_COMPILER) if (!is_static) { - const CompiledInvokeStub* compiled_proxy_stub = compiler_->FindProxyStub(shorty); + const CompiledInvokeStub* compiled_proxy_stub = compiler_driver_->FindProxyStub(shorty); if (compiled_proxy_stub != NULL) { uint32_t aligned_code_offset = CompiledMethod::AlignCode(code_offset, - compiler_->GetInstructionSet()); + compiler_driver_->GetInstructionSet()); uint32_t aligned_code_delta = aligned_code_offset - code_offset; CHECK(aligned_code_delta < 48u); if (aligned_code_delta != 0) { diff --git a/src/oat_writer.h b/src/oat_writer.h index e1638d0fc6..f67a3b029a 100644 --- a/src/oat_writer.h +++ b/src/oat_writer.h @@ -21,7 +21,7 @@ #include <cstddef> -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "mem_map.h" #include "oat.h" #include "mirror/class.h" @@ -68,7 +68,7 @@ class OatWriter { uint32_t image_file_location_oat_checksum, uint32_t image_file_location_oat_begin, const std::string& image_file_location, - const Compiler& compiler) + const CompilerDriver& compiler) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); private: @@ -76,7 +76,7 @@ class OatWriter { uint32_t image_file_location_oat_checksum, uint32_t image_file_location_oat_begin, const std::string& image_file_location, - const Compiler& compiler) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + const CompilerDriver* compiler) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); ~OatWriter(); size_t InitOatHeader(); @@ -148,7 +148,7 @@ class OatWriter { DISALLOW_COPY_AND_ASSIGN(OatClass); }; - const Compiler* compiler_; + const CompilerDriver* const compiler_driver_; // note OatFile does not take ownership of the DexFiles const std::vector<const DexFile*>* dex_files_; diff --git a/src/stack.cc b/src/stack.cc index c998f2a4dd..914e7ec403 100644 --- a/src/stack.cc +++ b/src/stack.cc @@ -16,7 +16,6 @@ #include "stack.h" -#include "compiler.h" #include "oat/runtime/context.h" #include "mirror/abstract_method-inl.h" #include "mirror/object.h" diff --git a/src/verifier/method_verifier.cc b/src/verifier/method_verifier.cc index 46ce441226..fb60c904a1 100644 --- a/src/verifier/method_verifier.cc +++ b/src/verifier/method_verifier.cc @@ -21,7 +21,7 @@ #include "base/logging.h" #include "base/stringpiece.h" #include "class_linker.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "dex_file.h" #include "dex_instruction.h" #include "dex_instruction_visitor.h" @@ -363,7 +363,7 @@ std::ostream& MethodVerifier::Fail(VerifyError error) { // marked as rejected to prevent it from being compiled. case VERIFY_ERROR_BAD_CLASS_HARD: { if (Runtime::Current()->IsCompiler()) { - Compiler::ClassReference ref(dex_file_, class_def_idx_); + CompilerDriver::ClassReference ref(dex_file_, class_def_idx_); AddRejectedClass(ref); } have_pending_hard_failure_ = true; @@ -934,7 +934,7 @@ bool MethodVerifier::VerifyCodeFlow() { return false; } - Compiler::MethodReference ref(dex_file_, dex_method_idx_); + CompilerDriver::MethodReference ref(dex_file_, dex_method_idx_); /* Generate a register map and add it to the method. */ @@ -3238,7 +3238,7 @@ void MethodVerifier::VerifyGcMap(const std::vector<uint8_t>& data) { } } -void MethodVerifier::SetDexGcMap(Compiler::MethodReference ref, const std::vector<uint8_t>& gc_map) { +void MethodVerifier::SetDexGcMap(CompilerDriver::MethodReference ref, const std::vector<uint8_t>& gc_map) { { MutexLock mu(Thread::Current(), *dex_gc_maps_lock_); DexGcMapTable::iterator it = dex_gc_maps_->find(ref); @@ -3251,7 +3251,7 @@ void MethodVerifier::SetDexGcMap(Compiler::MethodReference ref, const std::vecto CHECK(GetDexGcMap(ref) != NULL); } -const std::vector<uint8_t>* MethodVerifier::GetDexGcMap(Compiler::MethodReference ref) { +const std::vector<uint8_t>* MethodVerifier::GetDexGcMap(CompilerDriver::MethodReference ref) { MutexLock mu(Thread::Current(), *dex_gc_maps_lock_); DexGcMapTable::const_iterator it = dex_gc_maps_->find(ref); if (it == dex_gc_maps_->end()) { @@ -3347,7 +3347,7 @@ void MethodVerifier::Shutdown() { rejected_classes_lock_ = NULL; } -void MethodVerifier::AddRejectedClass(Compiler::ClassReference ref) { +void MethodVerifier::AddRejectedClass(CompilerDriver::ClassReference ref) { { MutexLock mu(Thread::Current(), *rejected_classes_lock_); rejected_classes_->insert(ref); @@ -3355,7 +3355,7 @@ void MethodVerifier::AddRejectedClass(Compiler::ClassReference ref) { CHECK(IsClassRejected(ref)); } -bool MethodVerifier::IsClassRejected(Compiler::ClassReference ref) { +bool MethodVerifier::IsClassRejected(CompilerDriver::ClassReference ref) { MutexLock mu(Thread::Current(), *rejected_classes_lock_); return (rejected_classes_->find(ref) != rejected_classes_->end()); } diff --git a/src/verifier/method_verifier.h b/src/verifier/method_verifier.h index ba9b7b89c5..49bc808f0d 100644 --- a/src/verifier/method_verifier.h +++ b/src/verifier/method_verifier.h @@ -23,7 +23,7 @@ #include "base/casts.h" #include "base/macros.h" #include "base/stl_util.h" -#include "compiler.h" +#include "compiler/driver/compiler_driver.h" #include "dex_file.h" #include "dex_instruction.h" #include "instruction_flags.h" @@ -183,7 +183,7 @@ class MethodVerifier { // information void Dump(std::ostream& os) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - static const std::vector<uint8_t>* GetDexGcMap(Compiler::MethodReference ref) + static const std::vector<uint8_t>* GetDexGcMap(CompilerDriver::MethodReference ref) LOCKS_EXCLUDED(dex_gc_maps_lock_); // Fills 'monitor_enter_dex_pcs' with the dex pcs of the monitor-enter instructions corresponding @@ -195,7 +195,7 @@ class MethodVerifier { static void Init(); static void Shutdown(); - static bool IsClassRejected(Compiler::ClassReference ref) + static bool IsClassRejected(CompilerDriver::ClassReference ref) LOCKS_EXCLUDED(rejected_classes_lock_); bool CanLoadClasses() const { @@ -569,17 +569,17 @@ class MethodVerifier { InstructionFlags* CurrentInsnFlags(); // All the GC maps that the verifier has created - typedef SafeMap<const Compiler::MethodReference, const std::vector<uint8_t>*> DexGcMapTable; + typedef SafeMap<const CompilerDriver::MethodReference, const std::vector<uint8_t>*> DexGcMapTable; static Mutex* dex_gc_maps_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; static DexGcMapTable* dex_gc_maps_ GUARDED_BY(dex_gc_maps_lock_); - static void SetDexGcMap(Compiler::MethodReference ref, const std::vector<uint8_t>& dex_gc_map) + static void SetDexGcMap(CompilerDriver::MethodReference ref, const std::vector<uint8_t>& dex_gc_map) LOCKS_EXCLUDED(dex_gc_maps_lock_); - typedef std::set<Compiler::ClassReference> RejectedClassesTable; + typedef std::set<CompilerDriver::ClassReference> RejectedClassesTable; static Mutex* rejected_classes_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; static RejectedClassesTable* rejected_classes_; - static void AddRejectedClass(Compiler::ClassReference ref) + static void AddRejectedClass(CompilerDriver::ClassReference ref) LOCKS_EXCLUDED(rejected_classes_lock_); RegTypeCache reg_types_; |