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/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 65729c9..bd63c30 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -1880,6 +1880,21 @@
return Execute(self, mh, code_item, shadow_frame, ret_val);
}
+void EnterInterpreterFromLLVM(Thread* self, ShadowFrame* shadow_frame, JValue* ret_val)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ JValue value;
+ MethodHelper mh(shadow_frame->GetMethod());
+ const DexFile::CodeItem* code_item = mh.GetCodeItem();
+ while (shadow_frame != NULL) {
+ value = Execute(self, mh, code_item, *shadow_frame, value);
+ ShadowFrame* old_frame = shadow_frame;
+ shadow_frame = shadow_frame->GetLink();
+ mh.ChangeMethod(shadow_frame->GetMethod());
+ delete old_frame;
+ }
+ ret_val->SetJ(value.GetJ());
+}
+
JValue EnterInterpreterFromStub(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
ShadowFrame& shadow_frame)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
diff --git a/src/interpreter/interpreter.h b/src/interpreter/interpreter.h
index eee13dc..12da736 100644
--- a/src/interpreter/interpreter.h
+++ b/src/interpreter/interpreter.h
@@ -41,6 +41,9 @@
JValue ret_val)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+void EnterInterpreterFromLLVM(Thread* self, ShadowFrame* shadow_frame, JValue* result)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
extern JValue EnterInterpreterFromStub(Thread* self, MethodHelper& mh,
const DexFile::CodeItem* code_item,
ShadowFrame& shadow_frame)