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
diff --git a/src/compiler_llvm/utils_llvm.h b/src/compiler_llvm/utils_llvm.h
index fb4da34..fb9f0cb 100644
--- a/src/compiler_llvm/utils_llvm.h
+++ b/src/compiler_llvm/utils_llvm.h
@@ -17,26 +17,17 @@
#ifndef ART_SRC_UTILS_LLVM_H_
#define ART_SRC_UTILS_LLVM_H_
-#include "object.h"
+#include "stringprintf.h"
+#include <stdint.h>
#include <string>
namespace art {
-// Performs LLVM name mangling (similar to MangleForJni with additional '<' and
-// '>' being mangled).
-std::string MangleForLLVM(const std::string& s);
+inline static std::string ElfFuncName(uint16_t elf_func_idx) {
+ return StringPrintf("Art%u", static_cast<unsigned int>(elf_func_idx));
+}
-// Returns the LLVM function name for the non-overloaded method 'm'.
-std::string LLVMShortName(const Method* m);
-
-// Returns the LLVM function name for the overloaded method 'm'.
-std::string LLVMLongName(const Method* m);
-
-// Returns the LLVM stub function name for the overloaded method 'm'.
-std::string LLVMStubName(const Method* m);
-
-void LLVMLinkLoadMethod(const std::string& file_name, Method* method);
} // namespace art
#endif // ART_SRC_UTILS_LLVM_H_