diff options
Diffstat (limited to 'runtime/interpreter/interpreter_switch_impl.cc')
-rw-r--r-- | runtime/interpreter/interpreter_switch_impl.cc | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc index c9831e67aa..bab0d40000 100644 --- a/runtime/interpreter/interpreter_switch_impl.cc +++ b/runtime/interpreter/interpreter_switch_impl.cc @@ -35,6 +35,9 @@ namespace interpreter { /* Structured locking is to be enforced for abnormal termination, too. */ \ shadow_frame.GetLockCountData(). \ CheckAllMonitorsReleasedOrThrow<do_assignability_check>(self); \ + if (interpret_one_instruction) { \ + shadow_frame.SetDexPC(DexFile::kDexNoIndex); \ + } \ return JValue(); /* Handled in caller. */ \ } else { \ int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc); \ @@ -78,7 +81,8 @@ static bool IsExperimentalInstructionEnabled(const Instruction *inst) { template<bool do_access_check, bool transaction_active> JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register) { + ShadowFrame& shadow_frame, JValue result_register, + bool interpret_one_instruction) { constexpr bool do_assignability_check = do_access_check; if (UNLIKELY(!shadow_frame.HasReferenceArray())) { LOG(FATAL) << "Invalid shadow frame for interpreter use"; @@ -105,7 +109,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, // to keep this live for the scope of the entire function call. std::unique_ptr<lambda::ClosureBuilder> lambda_closure_builder; size_t lambda_captured_variable_index = 0; - while (true) { + do { dex_pc = inst->GetDexPc(insns); shadow_frame.SetDexPC(dex_pc); TraceExecution(shadow_frame, inst, dex_pc); @@ -203,6 +207,9 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, shadow_frame.GetMethod(), inst->GetDexPc(insns), result); } + if (interpret_one_instruction) { + shadow_frame.SetDexPC(DexFile::kDexNoIndex); + } return result; } case Instruction::RETURN_VOID: { @@ -216,6 +223,9 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, shadow_frame.GetMethod(), inst->GetDexPc(insns), result); } + if (interpret_one_instruction) { + shadow_frame.SetDexPC(DexFile::kDexNoIndex); + } return result; } case Instruction::RETURN: { @@ -230,6 +240,9 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, shadow_frame.GetMethod(), inst->GetDexPc(insns), result); } + if (interpret_one_instruction) { + shadow_frame.SetDexPC(DexFile::kDexNoIndex); + } return result; } case Instruction::RETURN_WIDE: { @@ -243,6 +256,9 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, shadow_frame.GetMethod(), inst->GetDexPc(insns), result); } + if (interpret_one_instruction) { + shadow_frame.SetDexPC(DexFile::kDexNoIndex); + } return result; } case Instruction::RETURN_OBJECT: { @@ -278,6 +294,9 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, shadow_frame.GetMethod(), inst->GetDexPc(insns), result); } + if (interpret_one_instruction) { + shadow_frame.SetDexPC(DexFile::kDexNoIndex); + } return result; } case Instruction::CONST_4: { @@ -2370,22 +2389,29 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, case Instruction::UNUSED_7A: UnexpectedOpcode(inst, shadow_frame); } - } + } while (!interpret_one_instruction); + // Record where we stopped. + shadow_frame.SetDexPC(inst->GetDexPc(insns)); + return JValue(); } // NOLINT(readability/fn_size) // Explicit definitions of ExecuteSwitchImpl. template SHARED_REQUIRES(Locks::mutator_lock_) HOT_ATTR JValue ExecuteSwitchImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); + ShadowFrame& shadow_frame, JValue result_register, + bool interpret_one_instruction); template SHARED_REQUIRES(Locks::mutator_lock_) HOT_ATTR JValue ExecuteSwitchImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); + ShadowFrame& shadow_frame, JValue result_register, + bool interpret_one_instruction); template SHARED_REQUIRES(Locks::mutator_lock_) JValue ExecuteSwitchImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); + ShadowFrame& shadow_frame, JValue result_register, + bool interpret_one_instruction); template SHARED_REQUIRES(Locks::mutator_lock_) JValue ExecuteSwitchImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); + ShadowFrame& shadow_frame, JValue result_register, + bool interpret_one_instruction); } // namespace interpreter } // namespace art |