diff options
Diffstat (limited to 'src/compiler_llvm')
| -rw-r--r-- | src/compiler_llvm/compiler_llvm.cc | 11 | ||||
| -rw-r--r-- | src/compiler_llvm/jni_compiler.cc | 6 | ||||
| -rw-r--r-- | src/compiler_llvm/upcall_compiler.cc | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc index 443950df07..894521033d 100644 --- a/src/compiler_llvm/compiler_llvm.cc +++ b/src/compiler_llvm/compiler_llvm.cc @@ -318,8 +318,10 @@ extern "C" art::CompiledMethod* ArtCompileMethod(art::Compiler& compiler, art::OatCompilationUnit oat_compilation_unit( class_loader, class_linker, dex_file, *dex_cache, code_item, method_idx, access_flags); - - return ContextOf(compiler)->CompileDexMethod(&oat_compilation_unit); + art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(compiler); + art::CompiledMethod* result = compiler_llvm->CompileDexMethod(&oat_compilation_unit); + compiler_llvm->MaterializeIfThresholdReached(); + return result; } extern "C" art::CompiledMethod* ArtJniCompileMethod(art::Compiler& compiler, @@ -340,7 +342,10 @@ extern "C" art::CompiledMethod* ArtJniCompileMethod(art::Compiler& compiler, extern "C" art::CompiledInvokeStub* ArtCreateInvokeStub(art::Compiler& compiler, bool is_static, const char* shorty, uint32_t shorty_len) { - return ContextOf(compiler)->CreateInvokeStub(is_static, shorty); + art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(compiler); + art::CompiledInvokeStub* result = compiler_llvm->CreateInvokeStub(is_static, shorty); + compiler_llvm->MaterializeIfThresholdReached(); + return result; } extern "C" void compilerLLVMSetBitcodeFileName(art::Compiler& compiler, diff --git a/src/compiler_llvm/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc index 7855be09d9..198cd1a3f6 100644 --- a/src/compiler_llvm/jni_compiler.cc +++ b/src/compiler_llvm/jni_compiler.cc @@ -296,6 +296,12 @@ CompiledMethod* JniCompiler::Compile() { // Verify the generated bitcode llvm::verifyFunction(*func_, llvm::PrintMessageAction); + // 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. + CompiledMethod* compiled_method = new CompiledMethod(cunit_->GetInstructionSet(), cunit_->GetElfIndex(), diff --git a/src/compiler_llvm/upcall_compiler.cc b/src/compiler_llvm/upcall_compiler.cc index 691d7e5f44..4b99cf7ab8 100644 --- a/src/compiler_llvm/upcall_compiler.cc +++ b/src/compiler_llvm/upcall_compiler.cc @@ -184,7 +184,7 @@ CompiledInvokeStub* UpcallCompiler::CreateStub(bool is_static, llvm::verifyFunction(*func, llvm::PrintMessageAction); // Add the memory usage approximation of the compilation unit - cunit_->AddMemUsageApproximation((shorty_size * 3 + 8) * 500); + cunit_->AddMemUsageApproximation((shorty_size * 3 + 8) * 50); // NOTE: We will emit 3 LLVM instructions per shorty for the argument, // plus 3 for pointer arithmetic, and 5 for code_addr, retval, ret_addr, // store ret_addr, and ret_void. Beside, we guess that we have to use |