summaryrefslogtreecommitdiff
path: root/runtime/quick_exception_handler.cc
diff options
context:
space:
mode:
author Mythri Alle <mythria@google.com> 2022-01-19 16:44:59 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-01-24 14:35:40 +0000
commite1f9638b491eddfdd939a8705da74aba5ca78401 (patch)
treefda711b2f0424a732dae2d9b3951756e3a9cb3f7 /runtime/quick_exception_handler.cc
parent4b34d5c3c6cbfeff849c5359427882f7c15716fb (diff)
On partial fragment deopts, update return PC only when necessary
JITed code in debuggable apps don't have instrumentation stubs installed and hence don't have an entry in the instrumentation stack. In the case of a deopt the last frame that is popped from instrumentation stack could be different from that of the actual stack. Hence we shouldn't update the return PC unconditionally incase of a partial fragment deopt. Test: art/test.py -t 989-method-trace-throw Bug: 214001306 Change-Id: I10cf74b3a1481429502b46e9d69b5274cce0f000
Diffstat (limited to 'runtime/quick_exception_handler.cc')
-rw-r--r--runtime/quick_exception_handler.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index c3722484ca..2a6929a523 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -616,11 +616,15 @@ void QuickExceptionHandler::DeoptimizeSingleFrame(DeoptimizationKind kind) {
void QuickExceptionHandler::DeoptimizePartialFragmentFixup(uintptr_t return_pc) {
// At this point, the instrumentation stack has been updated. We need to install
// the real return pc on stack, in case instrumentation stub is stored there,
- // so that the interpreter bridge code can return to the right place.
- if (return_pc != 0) {
- uintptr_t* pc_addr = reinterpret_cast<uintptr_t*>(handler_quick_frame_);
- CHECK(pc_addr != nullptr);
- pc_addr--;
+ // so that the interpreter bridge code can return to the right place. JITed
+ // frames in Java debuggable runtimes may not have an instrumentation stub, so
+ // update the PC only when required.
+ uintptr_t* pc_addr = reinterpret_cast<uintptr_t*>(handler_quick_frame_);
+ CHECK(pc_addr != nullptr);
+ pc_addr--;
+ if (return_pc != 0 &&
+ (*reinterpret_cast<uintptr_t*>(pc_addr)) ==
+ reinterpret_cast<uintptr_t>(GetQuickInstrumentationExitPc())) {
*reinterpret_cast<uintptr_t*>(pc_addr) = return_pc;
}