From 7a2a23a44d27f769718e28327af671f4e486c49a Mon Sep 17 00:00:00 2001 From: Logan Chien Date: Wed, 6 Jun 2012 11:01:00 +0800 Subject: Cleanup proxy stub compiler code. Change-Id: I2a5815cc2a38f5cea9e9c36e5e6db92c1a861eaa --- src/compiler_llvm/compiler_llvm.cc | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src/compiler_llvm/compiler_llvm.cc') 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 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 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); -- cgit v1.2.3-59-g8ed1b