From 937105a220983351695bf4c8924171ba5d17a68c Mon Sep 17 00:00:00 2001 From: Logan Chien Date: Mon, 2 Apr 2012 02:37:37 +0800 Subject: Use ELF function index to distinguish generated functions. We replaced LLVMLongName and LLVMStubName with ElfFuncName, and we are using the simple name: Art0, Art1, ..., ArtN, as the function name of every generated functions. This gives us 3 benefits: 1. We can avoid the ambiguous function name returned by LLVMLongName() in some special situation. 2. We don't need to have the art::Method object during the executable linking procedure. Besides, this will make bootstrapping easier. 3. Reduce the size of the ELF executable, since we don't have to save a long function name, which usually contains more than 30 characters. Change-Id: Ib698062b272458e847ad5545d7acf33a4dc9eb85 --- src/compiler_llvm/method_compiler.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/compiler_llvm/method_compiler.cc') diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc index 8b1cef6a50..57dbf153a8 100644 --- a/src/compiler_llvm/method_compiler.cc +++ b/src/compiler_llvm/method_compiler.cc @@ -67,7 +67,7 @@ MethodCompiler::MethodCompiler(CompilationUnit* cunit, basic_blocks_(code_item_->insns_size_in_code_units_), basic_block_landing_pads_(code_item_->tries_size_, NULL), basic_block_unwind_(NULL), basic_block_unreachable_(NULL), - shadow_frame_(NULL) { + shadow_frame_(NULL), elf_func_idx_(cunit_->AcquireUniqueElfFuncIndex()) { } @@ -78,7 +78,7 @@ MethodCompiler::~MethodCompiler() { void MethodCompiler::CreateFunction() { // LLVM function name - std::string func_name(LLVMLongName(method_)); + std::string func_name(ElfFuncName(elf_func_idx_)); // Get function type llvm::FunctionType* func_type = @@ -3773,7 +3773,8 @@ CompiledMethod *MethodCompiler::Compile() { // Thus, we got our magic number 9. return new CompiledMethod(cunit_->GetInstructionSet(), - cunit_->GetElfIndex()); + cunit_->GetElfIndex(), + elf_func_idx_); } -- cgit v1.2.3-59-g8ed1b