Implement for AME for the LLVM version. Fix the compiler_test.
AME (Abstract Method Error) processing is different for LLVM version,
because we uses return-style exception handling. We have our LLVM version
of runtime support in runtime_support_llvm.cc, but we have to share this
one: ThrowAbstractMethodErrorFromCode() because it's called from the
stub/assembly code for AME exception. Those tricky assembly code
shouldn't be duplicated to 2 versions. Instead, we try to just limit
to return processing. Only differ in the DeliverException case in
ThrowAbstractMethodErrorFromCode().
I.e., LLVM is using return-style and no need for long-jump delivery.
Compiler_test passes now.
(cherry picked from commit c33262b21ece4072cc229511ba9d878981fc5d3c)
Change-Id: If959d100a9e157cbc3618770f6ff1118dce066f5
diff --git a/src/runtime_support.cc b/src/runtime_support.cc
index a1c1be4..a55c55c 100644
--- a/src/runtime_support.cc
+++ b/src/runtime_support.cc
@@ -203,10 +203,14 @@
// Called by the AbstractMethodError stub (not runtime support)
extern void ThrowAbstractMethodErrorFromCode(Method* method, Thread* thread, Method** sp) {
+#if !defined(ART_USE_LLVM_COMPILER)
FinishCalleeSaveFrameSetup(thread, sp, Runtime::kSaveAll);
+#endif
thread->ThrowNewExceptionF("Ljava/lang/AbstractMethodError;",
"abstract method \"%s\"", PrettyMethod(method).c_str());
+#if !defined(ART_USE_LLVM_COMPILER)
thread->DeliverException();
+#endif
}
extern "C" void artThrowStackOverflowFromCode(Method* /*method*/, Thread* thread, Method** sp) {
diff --git a/src/stub_x86.cc b/src/stub_x86.cc
index 845c179..d7b071b 100644
--- a/src/stub_x86.cc
+++ b/src/stub_x86.cc
@@ -62,8 +62,19 @@
// Call to throw AbstractMethodError.
__ Call(ThreadOffset(OFFSETOF_MEMBER(Thread, pThrowAbstractMethodErrorFromCode)),
X86ManagedRegister::FromCpuRegister(ECX));
+
+#if defined(ART_USE_LLVM_COMPILER)
+ // Return to caller who will handle pending exception.
+ __ addl(ESP, Immediate(28));
+ __ popl(EBX);
+ __ popl(EBP);
+ __ popl(ESI);
+ __ popl(EDI);
+ __ ret();
+#else
// Call never returns.
__ int3();
+#endif
assembler->EmitSlowPaths();