Support for exception throwing from JNI.
This change modifies the exception throwing JNI unit test to be
realistic and implements the missing exception throwing pieces on X86.
It also corrects some issues on ARM including methods with arguments
LJII (such as compareAndSwapInt).
Change-Id: I375f6efe2edeebb8007d7aa12c10b49742a8f119
diff --git a/src/assembler_arm.cc b/src/assembler_arm.cc
index c4dbbba..93d08b2 100644
--- a/src/assembler_arm.cc
+++ b/src/assembler_arm.cc
@@ -1810,28 +1810,27 @@
void ArmAssembler::ExceptionPoll(ManagedRegister mscratch) {
ArmManagedRegister scratch = mscratch.AsArm();
- ArmExceptionSlowPath* slow = new ArmExceptionSlowPath();
+ ArmExceptionSlowPath* slow = new ArmExceptionSlowPath(scratch);
buffer_.EnqueueSlowPath(slow);
LoadFromOffset(kLoadWord, scratch.AsCoreRegister(),
TR, Thread::ExceptionOffset().Int32Value());
cmp(scratch.AsCoreRegister(), ShifterOperand(0));
b(slow->Entry(), NE);
- Bind(slow->Continuation());
}
void ArmExceptionSlowPath::Emit(Assembler* sasm) {
ArmAssembler* sp_asm = down_cast<ArmAssembler*>(sasm);
#define __ sp_asm->
__ Bind(&entry_);
- // Pass top of stack as argument
- __ mov(R0, ShifterOperand(SP));
- __ LoadFromOffset(kLoadWord, R12, TR,
- Thread::ExceptionEntryPointOffset().Int32Value());
- // Note: assume that link register will be spilled/filled on method entry/exit
+
+ // Pass exception object as argument
+ // Don't care about preserving R0 as this call won't return
+ __ mov(R0, ShifterOperand(scratch_.AsCoreRegister()));
+ // Set up call to Thread::Current()->pDeliverException
+ __ LoadFromOffset(kLoadWord, R12, TR, OFFSETOF_MEMBER(Thread, pDeliverException));
__ blx(R12);
- // TODO: this call should never return as it should make a long jump to
- // the appropriate catch block
- __ b(&continuation_);
+ // Call never returns
+ __ bkpt(0);
#undef __
}