diff options
Diffstat (limited to 'src/compiler')
| -rw-r--r-- | src/compiler/codegen/mir_to_lir.cc | 5 | ||||
| -rw-r--r-- | src/compiler/compiler_ir.h | 3 | ||||
| -rw-r--r-- | src/compiler/frontend.cc | 16 |
3 files changed, 17 insertions, 7 deletions
diff --git a/src/compiler/codegen/mir_to_lir.cc b/src/compiler/codegen/mir_to_lir.cc index acdeafe32c..1d64661c5d 100644 --- a/src/compiler/codegen/mir_to_lir.cc +++ b/src/compiler/codegen/mir_to_lir.cc @@ -86,6 +86,11 @@ static bool CompileDalvikInstruction(CompilationUnit* cu, MIR* mir, BasicBlock* cg->GenMoveException(cu, rl_dest); break; case Instruction::RETURN_VOID: + if (((cu->access_flags & kAccConstructor) != 0) && + cu->compiler->RequiresConstructorBarrier(Thread::Current(), cu->dex_file, + cu->class_def_idx)) { + cg->GenMemBarrier(cu, kStoreStore); + } if (!(cu->attrs & METHOD_IS_LEAF)) { cg->GenSuspendTest(cu, opt_flags); } diff --git a/src/compiler/compiler_ir.h b/src/compiler/compiler_ir.h index 9c67cd567c..c5f5107eed 100644 --- a/src/compiler/compiler_ir.h +++ b/src/compiler/compiler_ir.h @@ -277,6 +277,7 @@ struct CompilationUnit { class_linker(NULL), dex_file(NULL), class_loader(NULL), + class_def_idx(0), method_idx(0), code_item(NULL), access_flags(0), @@ -345,6 +346,7 @@ struct CompilationUnit { mstats(NULL), checkstats(NULL), gen_bitcode(false), + llvm_info(NULL), context(NULL), module(NULL), func(NULL), @@ -368,6 +370,7 @@ struct CompilationUnit { 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. + uint32_t class_def_idx; // compiling method's defining class definition index. uint32_t method_idx; // compiling method's index into method_ids of DexFile. const DexFile::CodeItem* code_item; // compiling method's DexFile code_item. uint32_t access_flags; // compiling method's access flags. diff --git a/src/compiler/frontend.cc b/src/compiler/frontend.cc index 9d30b6ad0b..e6f29ef465 100644 --- a/src/compiler/frontend.cc +++ b/src/compiler/frontend.cc @@ -773,8 +773,8 @@ static CompiledMethod* CompileMethod(Compiler& compiler, const CompilerBackend compiler_backend, const DexFile::CodeItem* code_item, uint32_t access_flags, InvokeType invoke_type, - uint32_t method_idx, jobject class_loader, - const DexFile& dex_file, + uint32_t class_def_idx, uint32_t method_idx, + jobject class_loader, const DexFile& dex_file, LLVMInfo* llvm_info) { VLOG(compiler) << "Compiling " << PrettyMethod(method_idx, dex_file) << "..."; @@ -792,6 +792,7 @@ static CompiledMethod* CompileMethod(Compiler& compiler, cu->compiler = &compiler; cu->class_linker = class_linker; cu->dex_file = &dex_file; + cu->class_def_idx = class_def_idx; cu->method_idx = method_idx; cu->code_item = code_item; cu->access_flags = access_flags; @@ -1219,12 +1220,12 @@ CompiledMethod* CompileOneMethod(Compiler& compiler, const CompilerBackend backend, const DexFile::CodeItem* code_item, uint32_t access_flags, InvokeType invoke_type, - uint32_t method_idx, jobject class_loader, + uint32_t class_def_idx, uint32_t method_idx, jobject class_loader, const DexFile& dex_file, LLVMInfo* llvm_info) { - return CompileMethod(compiler, backend, code_item, access_flags, invoke_type, method_idx, class_loader, - dex_file, llvm_info); + return CompileMethod(compiler, backend, code_item, access_flags, invoke_type, class_def_idx, + method_idx, class_loader, dex_file, llvm_info); } } // namespace art @@ -1233,11 +1234,12 @@ extern "C" art::CompiledMethod* ArtQuickCompileMethod(art::Compiler& compiler, const art::DexFile::CodeItem* code_item, uint32_t access_flags, art::InvokeType invoke_type, - uint32_t method_idx, jobject class_loader, + uint32_t class_def_idx, uint32_t method_idx, jobject class_loader, const art::DexFile& dex_file) { // TODO: check method fingerprint here to determine appropriate backend type. Until then, use build default art::CompilerBackend backend = compiler.GetCompilerBackend(); return art::CompileOneMethod(compiler, backend, code_item, access_flags, invoke_type, - method_idx, class_loader, dex_file, NULL /* use thread llvm_info */); + class_def_idx, method_idx, class_loader, dex_file, + NULL /* use thread llvm_info */); } |