Fix link bug in LLVM.
Passing 4 run tests.
Change-Id: I01e0fc37a1662174891a88b4304a528378fe65fe
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 4a38493..08792eb 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1353,7 +1353,6 @@
}
const OatFile::OatMethod ClassLinker::GetOatMethodFor(const Method* method) {
- CHECK(Runtime::Current()->IsCompiler() || method->GetDeclaringClass()->IsInitializing());
// Although we overwrite the trampoline of non-static methods, we may get here via the resolution
// method for direct methods (or virtual methods made direct).
Class* declaring_class = method->GetDeclaringClass();
@@ -1384,6 +1383,7 @@
// Special case to get oat code without overwriting a trampoline.
const void* ClassLinker::GetOatCodeFor(const Method* method) {
+ CHECK(Runtime::Current()->IsCompiler() || method->GetDeclaringClass()->IsInitializing());
return GetOatMethodFor(method).GetCode();
}
diff --git a/src/compiler_llvm/runtime_support_llvm.cc b/src/compiler_llvm/runtime_support_llvm.cc
index 36343f7..e7e2d86 100644
--- a/src/compiler_llvm/runtime_support_llvm.cc
+++ b/src/compiler_llvm/runtime_support_llvm.cc
@@ -604,7 +604,7 @@
}
void art_ensure_link_from_code(Method* method) {
- if (method->GetInvokeStub() == NULL && method->GetCode() == NULL) {
+ if (method->GetInvokeStub() == NULL || method->GetCode() == NULL) {
Runtime::Current()->GetClassLinker()->LinkOatCodeFor(method);
}
}
diff --git a/src/object.cc b/src/object.cc
index 74195f8..7fdff31 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -573,7 +573,7 @@
bool have_executable_code = (GetCode() != NULL);
#if defined(ART_USE_LLVM_COMPILER)
- if (stub == NULL && !have_executable_code) {
+ if (stub == NULL || !have_executable_code) {
art_ensure_link_from_code(const_cast<Method*>(this));
stub = GetInvokeStub();
have_executable_code = (GetCode() != NULL);