diff options
author | 2012-06-06 11:01:00 +0800 | |
---|---|---|
committer | 2012-06-06 21:22:11 -0700 | |
commit | 7a2a23a44d27f769718e28327af671f4e486c49a (patch) | |
tree | 345a05da812927dafe13af82a4926257c3b368e9 /src/compiler_llvm/compiler_llvm.cc | |
parent | 95dfa6a8c522ad84a492d88666ea69fe7a3852c5 (diff) |
Cleanup proxy stub compiler code.
Change-Id: I2a5815cc2a38f5cea9e9c36e5e6db92c1a861eaa
Diffstat (limited to 'src/compiler_llvm/compiler_llvm.cc')
-rw-r--r-- | src/compiler_llvm/compiler_llvm.cc | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc index 95e9803f68..6c8188ef6f 100644 --- a/src/compiler_llvm/compiler_llvm.cc +++ b/src/compiler_llvm/compiler_llvm.cc @@ -225,8 +225,8 @@ const void* CompilerLLVM::GetMethodCodeAddr(const CompiledMethod* cm) const { const Method::InvokeStub* CompilerLLVM:: GetMethodInvokeStubAddr(const CompiledInvokeStub* cm) const { - return elf_loader_->GetMethodInvokeStubAddr(cm->GetStubElfIndex(), - cm->GetInvokeStubElfFuncIndex()); + return elf_loader_->GetMethodInvokeStubAddr(cm->GetElfIndex(), + cm->GetElfFuncIndex()); } @@ -282,12 +282,21 @@ CompiledInvokeStub* CompilerLLVM::CreateInvokeStub(bool is_static, UniquePtr<StubCompiler> stub_compiler( new StubCompiler(curr_cunit_, *compiler_)); - CompiledInvokeStub* compiled_stub = new CompiledInvokeStub(curr_cunit_->GetElfIndex()); + return stub_compiler->CreateInvokeStub(is_static, shorty); +} + + +CompiledInvokeStub* CompilerLLVM::CreateProxyStub(char const *shorty) { + MutexLock GUARD(compiler_lock_); - compiled_stub->SetInvokeStub(stub_compiler->CreateInvokeStub(is_static, shorty)); - compiled_stub->SetProxyStub(stub_compiler->CreateProxyStub(is_static, shorty)); + EnsureCompilationUnit(); + + MutexLock GUARD_CUNIT(curr_cunit_->cunit_lock_); - return compiled_stub; + UniquePtr<StubCompiler> stub_compiler( + new StubCompiler(curr_cunit_, *compiler_)); + + return stub_compiler->CreateProxyStub(shorty); } } // namespace compiler_llvm @@ -349,14 +358,25 @@ extern "C" art::CompiledMethod* ArtJniCompileMethod(art::Compiler& compiler, return result; } -extern "C" art::CompiledInvokeStub* ArtCreateInvokeStub(art::Compiler& compiler, bool is_static, - const char* shorty, uint32_t shorty_len) { +extern "C" art::CompiledInvokeStub* ArtCreateInvokeStub(art::Compiler& compiler, + bool is_static, + const char* shorty, + uint32_t shorty_len) { art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(compiler); art::CompiledInvokeStub* result = compiler_llvm->CreateInvokeStub(is_static, shorty); compiler_llvm->MaterializeIfThresholdReached(); return result; } +extern "C" art::CompiledInvokeStub* ArtCreateProxyStub(art::Compiler& compiler, + const char* shorty, + uint32_t shorty_len) { + art::compiler_llvm::CompilerLLVM* compiler_llvm = ContextOf(compiler); + art::CompiledInvokeStub* result = compiler_llvm->CreateProxyStub(shorty); + compiler_llvm->MaterializeIfThresholdReached(); + return result; +} + extern "C" void compilerLLVMSetBitcodeFileName(art::Compiler& compiler, std::string const& filename) { ContextOf(compiler)->SetBitcodeFileName(filename); |