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/compiled_method.h | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/compiled_method.h') diff --git a/src/compiled_method.h b/src/compiled_method.h index b98df39271..29202564a2 100644 --- a/src/compiled_method.h +++ b/src/compiled_method.h @@ -50,7 +50,9 @@ class CompiledMethod { const uint32_t fp_spill_mask); // Constructs a CompiledMethod for the LLVM compiler. - CompiledMethod(InstructionSet instruction_set, size_t elf_idx); + CompiledMethod(InstructionSet instruction_set, + const uint16_t elf_idx, + const uint16_t elf_func_idx); ~CompiledMethod(); @@ -79,12 +81,18 @@ class CompiledMethod { static const void* CodePointer(const void* code_pointer, InstructionSet instruction_set); - size_t GetElfIndex() const { + uint16_t GetElfIndex() const { + DCHECK(IsExecutableInElf()); return elf_idx_; } + uint16_t GetElfFuncIndex() const { + DCHECK(IsExecutableInElf()); + return elf_func_idx_; + } + bool IsExecutableInElf() const { - return (elf_idx_ != static_cast(-1)); + return (elf_idx_ != static_cast(-1u)); } private: @@ -98,30 +106,38 @@ class CompiledMethod { std::vector vmap_table_; std::vector gc_map_; // For LLVM - size_t elf_idx_; + uint16_t elf_idx_; + uint16_t elf_func_idx_; }; class CompiledInvokeStub { public: explicit CompiledInvokeStub(std::vector& code); #if defined(ART_USE_LLVM_COMPILER) - explicit CompiledInvokeStub(size_t elf_idx); + explicit CompiledInvokeStub(uint16_t elf_idx, uint16_t elf_func_idx); #endif ~CompiledInvokeStub(); const std::vector& GetCode() const; - size_t GetElfIndex() const { + uint16_t GetElfIndex() const { + DCHECK(IsExecutableInElf()); return elf_idx_; } + uint16_t GetElfFuncIndex() const { + DCHECK(IsExecutableInElf()); + return elf_func_idx_; + } + bool IsExecutableInElf() const { - return (elf_idx_ != static_cast(-1)); + return (elf_idx_ != static_cast(-1u)); } private: std::vector code_; - size_t elf_idx_; + uint16_t elf_idx_; + uint16_t elf_func_idx_; }; } // namespace art -- cgit v1.2.3-59-g8ed1b