Just use getPtrEquiveInt to load method.
Change-Id: I8cbf155a0bfc4ea0f0d61dbf981e0ace43ef2c2b
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 8d6b251..b6711b6 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -36,12 +36,9 @@
#include <iomanip>
#include <llvm/BasicBlock.h>
-#include <llvm/DerivedTypes.h>
#include <llvm/Function.h>
#include <llvm/GlobalVariable.h>
#include <llvm/Intrinsics.h>
-#include <llvm/Module.h>
-#include <llvm/Type.h>
namespace art {
namespace compiler_llvm {
@@ -2840,8 +2837,8 @@
if (direct_method != 0u &&
direct_method != static_cast<uintptr_t>(-1)) {
callee_method_object_addr =
- EmitLoadSDCalleeDirectMethodObjectAddr(callee_method_idx,
- direct_method);
+ irb_.CreateIntToPtr(irb_.getPtrEquivInt(direct_method),
+ irb_.getJObjectTy());
} else {
callee_method_object_addr =
EmitLoadSDCalleeMethodObjectAddr(callee_method_idx);
@@ -2992,27 +2989,6 @@
llvm::Value* MethodCompiler::
-EmitLoadSDCalleeDirectMethodObjectAddr(uint32_t callee_method_idx,
- uintptr_t direct_method) {
- std::string direct_method_name(
- StringPrintf("ArtMethodObject_%08lx",
- static_cast<unsigned long>(direct_method)));
-
- llvm::GlobalVariable* direct_method_addr =
- module_->getGlobalVariable(direct_method_name);
-
- if (direct_method_addr == NULL) {
- direct_method_addr =
- new llvm::GlobalVariable(*module_, irb_.getJObjectTy()->getElementType(),
- false, llvm::GlobalVariable::ExternalLinkage,
- NULL, direct_method_name);
- }
-
- return direct_method_addr;
-}
-
-
-llvm::Value* MethodCompiler::
EmitLoadSDCalleeMethodObjectAddr(uint32_t callee_method_idx) {
llvm::Value* callee_method_object_field_addr =
EmitLoadDexCacheResolvedMethodFieldAddr(callee_method_idx);
diff --git a/src/compiler_llvm/method_compiler.h b/src/compiler_llvm/method_compiler.h
index 84c55d6..7dded33 100644
--- a/src/compiler_llvm/method_compiler.h
+++ b/src/compiler_llvm/method_compiler.h
@@ -215,9 +215,6 @@
llvm::Value* EmitLoadSDCalleeMethodObjectAddr(uint32_t callee_method_idx);
- llvm::Value* EmitLoadSDCalleeDirectMethodObjectAddr(uint32_t callee_method_idx,
- uintptr_t direct_method);
-
llvm::Value* EmitLoadVirtualCalleeMethodObjectAddr(int vtable_idx,
llvm::Value* this_addr);
diff --git a/src/compiler_llvm/runtime_support_llvm.cc b/src/compiler_llvm/runtime_support_llvm.cc
index 1ebbef9..fce0f41 100644
--- a/src/compiler_llvm/runtime_support_llvm.cc
+++ b/src/compiler_llvm/runtime_support_llvm.cc
@@ -797,15 +797,6 @@
}
}
- // Fixed method object address
- const char method_object_prefix[] = "ArtMethodObject_";
- const size_t method_object_prefix_len = sizeof(method_object_prefix) - 1;
- if (strncmp(name, method_object_prefix, method_object_prefix_len) == 0) {
- const char* addr_str = name + method_object_prefix_len;
- unsigned long addr_int = strtoul(addr_str, NULL, 16);
- return reinterpret_cast<void*>(addr_int);
- }
-
LOG(FATAL) << "Error: Can't find symbol " << name;
return 0;
}