Changes to LLVM to support deoptimization.
Added a magic exception value (-1) and a handler to transition
to the interpreter. This is currently untested.
Change-Id: I2f53135e7505c54355ecf7c579897f68bbdcbda3
diff --git a/src/mirror/abstract_method.cc b/src/mirror/abstract_method.cc
index 4641941..84b8809 100644
--- a/src/mirror/abstract_method.cc
+++ b/src/mirror/abstract_method.cc
@@ -304,6 +304,16 @@
PrettyMethod(this).c_str(), GetCode(), stub);
}
(*stub)(this, receiver, self, args, result);
+ if (UNLIKELY(reinterpret_cast<int32_t>(self->GetException()) == -1)) {
+ // Unusual case where we were running LLVM generated code and an
+ // exception was thrown to force the activations to be removed from the
+ // stack. Continue execution in the interpreter.
+ JValue value;
+ self->ClearException();
+ ShadowFrame* shadow_frame = self->GetAndClearDeoptimizationShadowFrame(&value);
+ self->SetTopOfShadowStack(shadow_frame);
+ interpreter::EnterInterpreterFromLLVM(self, shadow_frame, result);
+ }
if (kLogInvocationStartAndReturn) {
LOG(INFO) << StringPrintf("Returned '%s' code=%p stub=%p",
PrettyMethod(this).c_str(), GetCode(), stub);