diff options
author | 2012-05-01 15:47:55 +0800 | |
---|---|---|
committer | 2012-06-27 03:47:58 -0700 | |
commit | 971bf3f9184010d68b9a3ad30b396fa401af91a3 (patch) | |
tree | 493e80309ce41fd21359da8093fbebfd21b7936c /src/compiler_llvm/jni_compiler.cc | |
parent | 468a7b1fcb2114ec973e31b5276daea0be62c198 (diff) |
Compile method one-by-one.
Change-Id: Ic56fb397f3bd6dee32372eb875261a3383eaf30c
Diffstat (limited to 'src/compiler_llvm/jni_compiler.cc')
-rw-r--r-- | src/compiler_llvm/jni_compiler.cc | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/compiler_llvm/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc index 37ca82f2ff..f4f5be56c3 100644 --- a/src/compiler_llvm/jni_compiler.cc +++ b/src/compiler_llvm/jni_compiler.cc @@ -51,8 +51,7 @@ JniCompiler::JniCompiler(CompilationUnit* cunit, class_loader_(oat_compilation_unit->class_loader_), dex_cache_(oat_compilation_unit->dex_cache_), dex_file_(oat_compilation_unit->dex_file_), - method_(dex_cache_->GetResolvedMethod(method_idx_)), - elf_func_idx_(cunit_->AcquireUniqueElfFuncIndex()) { + method_(dex_cache_->GetResolvedMethod(method_idx_)) { // Check: Ensure that the method is resolved CHECK_NE(method_, static_cast<art::Method*>(NULL)); @@ -262,26 +261,16 @@ CompiledMethod* JniCompiler::Compile() { // Verify the generated bitcode VERIFY_LLVM_FUNCTION(*func_); - // Add the memory usage approximation of the compilation unit - cunit_->AddMemUsageApproximation((sirt_size * 4 + 50) * 50); - // NOTE: We will emit 4 LLVM instructions per object argument, - // And about 50 instructions for other operations. (Some runtime support will be inlined.) - // Beside, we guess that we have to use 50 bytes to represent one LLVM instruction. + cunit_->Materialize(); - CompiledMethod* compiled_method = - new CompiledMethod(cunit_->GetInstructionSet(), - cunit_->GetElfIndex(), - elf_func_idx_); - - cunit_->RegisterCompiledMethod(func_, compiled_method); - - return compiled_method; + return new CompiledMethod(cunit_->GetInstructionSet(), + cunit_->GetCompiledCode()); } void JniCompiler::CreateFunction() { // LLVM function name - std::string func_name(ElfFuncName(elf_func_idx_)); + std::string func_name(ElfFuncName(cunit_->GetIndex())); // Get function type llvm::FunctionType* func_type = |