Make JIT inliner work under single-stepping mode.
Bug: 2936661
Change-Id: Id85530db5281e0ea28ffb31e8769f3bfec8be54a
diff --git a/vm/compiler/Frontend.c b/vm/compiler/Frontend.c
index 8e5a5e2..525ec72 100644
--- a/vm/compiler/Frontend.c
+++ b/vm/compiler/Frontend.c
@@ -206,18 +206,19 @@
int offset)
{
int flags = dexGetInstrFlags(gDvm.instrFlags, dalvikInsn->opCode);
+ int dalvikOpCode = dalvikInsn->opCode;
if ((flags & kInstrInvoke) &&
- (dalvikInsn->opCode != OP_INVOKE_DIRECT_EMPTY)) {
+ (dalvikOpCode != OP_INVOKE_DIRECT_EMPTY)) {
attributes &= ~METHOD_IS_LEAF;
}
if (!(flags & kInstrCanReturn)) {
- if (!(dvmCompilerDataFlowAttributes[dalvikInsn->opCode] &
+ if (!(dvmCompilerDataFlowAttributes[dalvikOpCode] &
DF_IS_GETTER)) {
attributes &= ~METHOD_IS_GETTER;
}
- if (!(dvmCompilerDataFlowAttributes[dalvikInsn->opCode] &
+ if (!(dvmCompilerDataFlowAttributes[dalvikOpCode] &
DF_IS_SETTER)) {
attributes &= ~METHOD_IS_SETTER;
}
@@ -229,7 +230,7 @@
* otherwise.
*/
if (flags & kInstrCanReturn) {
- if (dalvikInsn->opCode == OP_RETURN_VOID) {
+ if (dalvikOpCode == OP_RETURN_VOID) {
attributes &= ~METHOD_IS_GETTER;
}
else {
@@ -241,10 +242,19 @@
attributes &= ~METHOD_IS_THROW_FREE;
}
- if (offset == 0 && dalvikInsn->opCode == OP_RETURN_VOID) {
+ if (offset == 0 && dalvikOpCode == OP_RETURN_VOID) {
attributes |= METHOD_IS_EMPTY;
}
+ /*
+ * Check if this opcode is selected for single stepping.
+ * If so, don't inline the callee as there is no stack frame for the
+ * interpreter to single-step through the instruction.
+ */
+ if (SINGLE_STEP_OP(dalvikOpCode)) {
+ attributes &= ~(METHOD_IS_GETTER | METHOD_IS_SETTER);
+ }
+
return attributes;
}
@@ -956,7 +966,7 @@
* with the callee is properly initialized. If not, we punt on this inline
* target.
*
- * TODO: volatile instructions will handled later.
+ * TODO: volatile instructions will be handled later.
*/
bool dvmCompilerCanIncludeThisInstruction(const Method *method,
const DecodedInstruction *insn)