blob: 8b99b9f9c8544f1ba7cfceb204fc82a802a83a14 [file] [log] [blame]
Sebastien Hertzd45a1f52014-01-09 14:56:54 +01001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Sebastien Hertzfd3077e2014-04-23 10:32:43 +020017#include "quick_exception_handler.h"
18
Ian Rogerse63db272014-07-15 15:36:11 -070019#include "arch/context.h"
Mathieu Chartiere401d142015-04-22 13:56:20 -070020#include "art_method-inl.h"
Andreas Gampe542451c2016-07-26 09:02:02 -070021#include "base/enums.h"
Andreas Gampe170331f2017-12-07 18:41:03 -080022#include "base/logging.h" // For VLOG_IS_ON.
David Sehr9e734c72018-01-04 17:56:19 -080023#include "dex/dex_file_types.h"
24#include "dex/dex_instruction.h"
Sebastien Hertzfd3077e2014-04-23 10:32:43 +020025#include "entrypoints/entrypoint_utils.h"
Andreas Gampe639bdd12015-06-03 11:22:45 -070026#include "entrypoints/quick/quick_entrypoints_enum.h"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070027#include "entrypoints/runtime_asm_entrypoints.h"
Mathieu Chartiereb8167a2014-05-07 15:43:14 -070028#include "handle_scope-inl.h"
Vladimir Marko6ec2a1b2018-05-22 15:33:48 +010029#include "interpreter/shadow_frame-inl.h"
Nicolas Geoffrayb88d59e2016-02-17 11:31:49 +000030#include "jit/jit.h"
31#include "jit/jit_code_cache.h"
Mingyao Yang98d1cc82014-05-15 17:02:16 -070032#include "mirror/class-inl.h"
33#include "mirror/class_loader.h"
34#include "mirror/throwable.h"
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +010035#include "oat_quick_method_header.h"
Vladimir Marko3a21e382016-09-02 12:38:38 +010036#include "stack.h"
Nicolas Geoffray6bc43742015-10-12 18:11:10 +010037#include "stack_map.h"
Sebastien Hertzd45a1f52014-01-09 14:56:54 +010038
39namespace art {
40
Ian Rogers5cf98192014-05-29 21:31:50 -070041static constexpr bool kDebugExceptionDelivery = false;
Hiroshi Yamauchi649278c2014-08-13 11:12:22 -070042static constexpr size_t kInvalidFrameDepth = 0xffffffff;
Ian Rogers5cf98192014-05-29 21:31:50 -070043
Sebastien Hertzfd3077e2014-04-23 10:32:43 +020044QuickExceptionHandler::QuickExceptionHandler(Thread* self, bool is_deoptimization)
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +010045 : self_(self),
46 context_(self->GetLongJumpContext()),
47 is_deoptimization_(is_deoptimization),
48 method_tracing_active_(is_deoptimization ||
49 Runtime::Current()->GetInstrumentation()->AreExitStubsInstalled()),
50 handler_quick_frame_(nullptr),
51 handler_quick_frame_pc_(0),
52 handler_method_header_(nullptr),
53 handler_quick_arg0_(0),
54 handler_method_(nullptr),
55 handler_dex_pc_(0),
56 clear_exception_(false),
Mingyao Yangf711f2c2016-05-23 12:29:39 -070057 handler_frame_depth_(kInvalidFrameDepth),
58 full_fragment_done_(false) {}
Sebastien Hertzd45a1f52014-01-09 14:56:54 +010059
Sebastien Hertz520633b2015-09-08 17:03:36 +020060// Finds catch handler.
Ian Rogers5cf98192014-05-29 21:31:50 -070061class CatchBlockStackVisitor FINAL : public StackVisitor {
62 public:
63 CatchBlockStackVisitor(Thread* self, Context* context, Handle<mirror::Throwable>* exception,
64 QuickExceptionHandler* exception_handler)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070065 REQUIRES_SHARED(Locks::mutator_lock_)
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +010066 : StackVisitor(self, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +010067 exception_(exception),
Ian Rogers5cf98192014-05-29 21:31:50 -070068 exception_handler_(exception_handler) {
69 }
70
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070071 bool VisitFrame() OVERRIDE REQUIRES_SHARED(Locks::mutator_lock_) {
Mathieu Chartiere401d142015-04-22 13:56:20 -070072 ArtMethod* method = GetMethod();
Hiroshi Yamauchi649278c2014-08-13 11:12:22 -070073 exception_handler_->SetHandlerFrameDepth(GetFrameDepth());
Ian Rogers5cf98192014-05-29 21:31:50 -070074 if (method == nullptr) {
75 // This is the upcall, we remember the frame and last pc so that we may long jump to them.
76 exception_handler_->SetHandlerQuickFramePc(GetCurrentQuickFramePc());
77 exception_handler_->SetHandlerQuickFrame(GetCurrentQuickFrame());
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +010078 exception_handler_->SetHandlerMethodHeader(GetCurrentOatQuickMethodHeader());
Ian Rogers5cf98192014-05-29 21:31:50 -070079 uint32_t next_dex_pc;
Mathieu Chartiere401d142015-04-22 13:56:20 -070080 ArtMethod* next_art_method;
Ian Rogers5cf98192014-05-29 21:31:50 -070081 bool has_next = GetNextMethodAndDexPc(&next_art_method, &next_dex_pc);
82 // Report the method that did the down call as the handler.
83 exception_handler_->SetHandlerDexPc(next_dex_pc);
84 exception_handler_->SetHandlerMethod(next_art_method);
85 if (!has_next) {
86 // No next method? Check exception handler is set up for the unhandled exception handler
87 // case.
88 DCHECK_EQ(0U, exception_handler_->GetHandlerDexPc());
89 DCHECK(nullptr == exception_handler_->GetHandlerMethod());
90 }
91 return false; // End stack walk.
92 }
93 if (method->IsRuntimeMethod()) {
94 // Ignore callee save method.
95 DCHECK(method->IsCalleeSaveMethod());
96 return true;
97 }
Mathieu Chartiere401d142015-04-22 13:56:20 -070098 return HandleTryItems(method);
Ian Rogers5cf98192014-05-29 21:31:50 -070099 }
100
101 private:
Mathieu Chartiere401d142015-04-22 13:56:20 -0700102 bool HandleTryItems(ArtMethod* method)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700103 REQUIRES_SHARED(Locks::mutator_lock_) {
Andreas Gampee2abbc62017-09-15 11:59:26 -0700104 uint32_t dex_pc = dex::kDexNoIndex;
Ian Rogers5cf98192014-05-29 21:31:50 -0700105 if (!method->IsNative()) {
106 dex_pc = GetDexPc();
107 }
Andreas Gampee2abbc62017-09-15 11:59:26 -0700108 if (dex_pc != dex::kDexNoIndex) {
Ian Rogers5cf98192014-05-29 21:31:50 -0700109 bool clear_exception = false;
Sebastien Hertz26f72862015-09-15 09:52:07 +0200110 StackHandleScope<1> hs(GetThread());
Ian Rogers5cf98192014-05-29 21:31:50 -0700111 Handle<mirror::Class> to_find(hs.NewHandle((*exception_)->GetClass()));
Mathieu Chartiere401d142015-04-22 13:56:20 -0700112 uint32_t found_dex_pc = method->FindCatchBlock(to_find, dex_pc, &clear_exception);
Ian Rogers5cf98192014-05-29 21:31:50 -0700113 exception_handler_->SetClearException(clear_exception);
Andreas Gampee2abbc62017-09-15 11:59:26 -0700114 if (found_dex_pc != dex::kDexNoIndex) {
Mathieu Chartiere401d142015-04-22 13:56:20 -0700115 exception_handler_->SetHandlerMethod(method);
Ian Rogers5cf98192014-05-29 21:31:50 -0700116 exception_handler_->SetHandlerDexPc(found_dex_pc);
David Brazdil72f7b882015-09-15 17:00:52 +0100117 exception_handler_->SetHandlerQuickFramePc(
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100118 GetCurrentOatQuickMethodHeader()->ToNativeQuickPc(
119 method, found_dex_pc, /* is_catch_handler */ true));
Ian Rogers5cf98192014-05-29 21:31:50 -0700120 exception_handler_->SetHandlerQuickFrame(GetCurrentQuickFrame());
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100121 exception_handler_->SetHandlerMethodHeader(GetCurrentOatQuickMethodHeader());
Ian Rogers5cf98192014-05-29 21:31:50 -0700122 return false; // End stack walk.
Mingyao Yang99170c62015-07-06 11:10:37 -0700123 } else if (UNLIKELY(GetThread()->HasDebuggerShadowFrames())) {
124 // We are going to unwind this frame. Did we prepare a shadow frame for debugging?
125 size_t frame_id = GetFrameId();
126 ShadowFrame* frame = GetThread()->FindDebuggerShadowFrame(frame_id);
127 if (frame != nullptr) {
128 // We will not execute this shadow frame so we can safely deallocate it.
129 GetThread()->RemoveDebuggerShadowFrameMapping(frame_id);
130 ShadowFrame::DeleteDeoptimizedFrame(frame);
131 }
Ian Rogers5cf98192014-05-29 21:31:50 -0700132 }
133 }
134 return true; // Continue stack walk.
135 }
136
Ian Rogers5cf98192014-05-29 21:31:50 -0700137 // The exception we're looking for the catch block of.
138 Handle<mirror::Throwable>* exception_;
139 // The quick exception handler we're visiting for.
140 QuickExceptionHandler* const exception_handler_;
141
142 DISALLOW_COPY_AND_ASSIGN(CatchBlockStackVisitor);
143};
144
Mathieu Chartierf5769e12017-01-10 15:54:41 -0800145void QuickExceptionHandler::FindCatch(ObjPtr<mirror::Throwable> exception) {
Sebastien Hertzfd3077e2014-04-23 10:32:43 +0200146 DCHECK(!is_deoptimization_);
Mathieu Chartiereb8167a2014-05-07 15:43:14 -0700147 StackHandleScope<1> hs(self_);
148 Handle<mirror::Throwable> exception_ref(hs.NewHandle(exception));
Vladimir Markofac21782018-03-13 17:01:09 +0000149 if (kDebugExceptionDelivery) {
150 ObjPtr<mirror::String> msg = exception_ref->GetDetailMessage();
151 std::string str_msg(msg != nullptr ? msg->ToModifiedUtf8() : "");
152 self_->DumpStack(LOG_STREAM(INFO) << "Delivering exception: " << exception_ref->PrettyTypeOf()
153 << ": " << str_msg << "\n");
154 }
Sebastien Hertzfd3077e2014-04-23 10:32:43 +0200155
Sebastien Hertz520633b2015-09-08 17:03:36 +0200156 // Walk the stack to find catch handler.
Mathieu Chartiereb8167a2014-05-07 15:43:14 -0700157 CatchBlockStackVisitor visitor(self_, context_, &exception_ref, this);
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100158 visitor.WalkStack(true);
159
Sebastien Hertzfd3077e2014-04-23 10:32:43 +0200160 if (kDebugExceptionDelivery) {
Mathieu Chartiere401d142015-04-22 13:56:20 -0700161 if (*handler_quick_frame_ == nullptr) {
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100162 LOG(INFO) << "Handler is upcall";
Ian Rogers5cf98192014-05-29 21:31:50 -0700163 }
164 if (handler_method_ != nullptr) {
David Sehr9323e6e2016-09-13 08:58:35 -0700165 const DexFile* dex_file = handler_method_->GetDeclaringClass()->GetDexCache()->GetDexFile();
166 int line_number = annotations::GetLineNumFromPC(dex_file, handler_method_, handler_dex_pc_);
David Sehr709b0702016-10-13 09:12:37 -0700167 LOG(INFO) << "Handler: " << handler_method_->PrettyMethod() << " (line: "
168 << line_number << ")";
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100169 }
170 }
Roland Levillainb77b6982017-06-08 18:03:48 +0100171 // Exception was cleared as part of delivery.
172 DCHECK(!self_->IsExceptionPending());
173 if (!clear_exception_) {
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100174 // Put exception back in root set with clear throw location.
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000175 self_->SetException(exception_ref.Get());
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100176 }
David Brazdil77a48ae2015-09-15 12:34:04 +0000177 // If the handler is in optimized code, we need to set the catch environment.
178 if (*handler_quick_frame_ != nullptr &&
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100179 handler_method_header_ != nullptr &&
180 handler_method_header_->IsOptimized()) {
David Brazdil77a48ae2015-09-15 12:34:04 +0000181 SetCatchEnvironmentForOptimizedHandler(&visitor);
182 }
183}
184
185static VRegKind ToVRegKind(DexRegisterLocation::Kind kind) {
186 // Slightly hacky since we cannot map DexRegisterLocationKind and VRegKind
187 // one to one. However, StackVisitor::GetVRegFromOptimizedCode only needs to
188 // distinguish between core/FPU registers and low/high bits on 64-bit.
189 switch (kind) {
190 case DexRegisterLocation::Kind::kConstant:
191 case DexRegisterLocation::Kind::kInStack:
192 // VRegKind is ignored.
193 return VRegKind::kUndefined;
194
195 case DexRegisterLocation::Kind::kInRegister:
196 // Selects core register. For 64-bit registers, selects low 32 bits.
197 return VRegKind::kLongLoVReg;
198
199 case DexRegisterLocation::Kind::kInRegisterHigh:
200 // Selects core register. For 64-bit registers, selects high 32 bits.
201 return VRegKind::kLongHiVReg;
202
203 case DexRegisterLocation::Kind::kInFpuRegister:
204 // Selects FPU register. For 64-bit registers, selects low 32 bits.
205 return VRegKind::kDoubleLoVReg;
206
207 case DexRegisterLocation::Kind::kInFpuRegisterHigh:
208 // Selects FPU register. For 64-bit registers, selects high 32 bits.
209 return VRegKind::kDoubleHiVReg;
210
211 default:
David Srbecky7dc11782016-02-25 13:23:56 +0000212 LOG(FATAL) << "Unexpected vreg location " << kind;
David Brazdil77a48ae2015-09-15 12:34:04 +0000213 UNREACHABLE();
214 }
215}
216
217void QuickExceptionHandler::SetCatchEnvironmentForOptimizedHandler(StackVisitor* stack_visitor) {
218 DCHECK(!is_deoptimization_);
219 DCHECK(*handler_quick_frame_ != nullptr) << "Method should not be called on upcall exceptions";
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100220 DCHECK(handler_method_ != nullptr && handler_method_header_->IsOptimized());
David Brazdil77a48ae2015-09-15 12:34:04 +0000221
222 if (kDebugExceptionDelivery) {
Andreas Gampe3fec9ac2016-09-13 10:47:28 -0700223 self_->DumpStack(LOG_STREAM(INFO) << "Setting catch phis: ");
David Brazdil77a48ae2015-09-15 12:34:04 +0000224 }
225
David Sehr0225f8e2018-01-31 08:52:24 +0000226 CodeItemDataAccessor accessor(handler_method_->DexInstructionData());
Mathieu Chartier808c7a52017-12-15 11:19:33 -0800227 const size_t number_of_vregs = accessor.RegistersSize();
David Srbecky052f8ca2018-04-26 15:42:54 +0100228 CodeInfo code_info(handler_method_header_);
David Brazdil77a48ae2015-09-15 12:34:04 +0000229
Nicolas Geoffray012fc4e2016-01-08 15:58:19 +0000230 // Find stack map of the catch block.
David Srbecky052f8ca2018-04-26 15:42:54 +0100231 StackMap catch_stack_map = code_info.GetCatchStackMapForDexPc(GetHandlerDexPc());
Nicolas Geoffray012fc4e2016-01-08 15:58:19 +0000232 DCHECK(catch_stack_map.IsValid());
David Srbeckyfd89b072018-06-03 12:00:22 +0100233 DexRegisterMap catch_vreg_map = code_info.GetDexRegisterMapOf(catch_stack_map);
234 if (!catch_vreg_map.HasAnyLiveDexRegisters()) {
Nicolas Geoffray012fc4e2016-01-08 15:58:19 +0000235 return;
236 }
David Srbeckyfd89b072018-06-03 12:00:22 +0100237 DCHECK_EQ(catch_vreg_map.size(), number_of_vregs);
Nicolas Geoffray012fc4e2016-01-08 15:58:19 +0000238
David Brazdil77a48ae2015-09-15 12:34:04 +0000239 // Find stack map of the throwing instruction.
240 StackMap throw_stack_map =
David Srbecky052f8ca2018-04-26 15:42:54 +0100241 code_info.GetStackMapForNativePcOffset(stack_visitor->GetNativePcOffset());
David Brazdil77a48ae2015-09-15 12:34:04 +0000242 DCHECK(throw_stack_map.IsValid());
David Srbeckyfd89b072018-06-03 12:00:22 +0100243 DexRegisterMap throw_vreg_map = code_info.GetDexRegisterMapOf(throw_stack_map);
244 DCHECK_EQ(throw_vreg_map.size(), number_of_vregs);
David Brazdil77a48ae2015-09-15 12:34:04 +0000245
246 // Copy values between them.
247 for (uint16_t vreg = 0; vreg < number_of_vregs; ++vreg) {
David Srbeckye1402122018-06-13 18:20:45 +0100248 DexRegisterLocation::Kind catch_location = catch_vreg_map[vreg].GetKind();
David Brazdil77a48ae2015-09-15 12:34:04 +0000249 if (catch_location == DexRegisterLocation::Kind::kNone) {
250 continue;
251 }
252 DCHECK(catch_location == DexRegisterLocation::Kind::kInStack);
253
254 // Get vreg value from its current location.
255 uint32_t vreg_value;
David Srbeckye1402122018-06-13 18:20:45 +0100256 VRegKind vreg_kind = ToVRegKind(throw_vreg_map[vreg].GetKind());
David Brazdil77a48ae2015-09-15 12:34:04 +0000257 bool get_vreg_success = stack_visitor->GetVReg(stack_visitor->GetMethod(),
258 vreg,
259 vreg_kind,
260 &vreg_value);
261 CHECK(get_vreg_success) << "VReg " << vreg << " was optimized out ("
David Sehr709b0702016-10-13 09:12:37 -0700262 << "method=" << ArtMethod::PrettyMethod(stack_visitor->GetMethod())
263 << ", dex_pc=" << stack_visitor->GetDexPc() << ", "
David Brazdil77a48ae2015-09-15 12:34:04 +0000264 << "native_pc_offset=" << stack_visitor->GetNativePcOffset() << ")";
265
266 // Copy value to the catch phi's stack slot.
David Srbeckye1402122018-06-13 18:20:45 +0100267 int32_t slot_offset = catch_vreg_map[vreg].GetStackOffsetInBytes();
David Brazdil77a48ae2015-09-15 12:34:04 +0000268 ArtMethod** frame_top = stack_visitor->GetCurrentQuickFrame();
269 uint8_t* slot_address = reinterpret_cast<uint8_t*>(frame_top) + slot_offset;
270 uint32_t* slot_ptr = reinterpret_cast<uint32_t*>(slot_address);
271 *slot_ptr = vreg_value;
272 }
Sebastien Hertzfd3077e2014-04-23 10:32:43 +0200273}
274
Ian Rogers5cf98192014-05-29 21:31:50 -0700275// Prepares deoptimization.
276class DeoptimizeStackVisitor FINAL : public StackVisitor {
277 public:
Andreas Gampe639bdd12015-06-03 11:22:45 -0700278 DeoptimizeStackVisitor(Thread* self,
279 Context* context,
280 QuickExceptionHandler* exception_handler,
281 bool single_frame)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700282 REQUIRES_SHARED(Locks::mutator_lock_)
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100283 : StackVisitor(self, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100284 exception_handler_(exception_handler),
Mingyao Yang1f2d3ba2015-05-18 12:12:50 -0700285 prev_shadow_frame_(nullptr),
Andreas Gampe639bdd12015-06-03 11:22:45 -0700286 stacked_shadow_frame_pushed_(false),
287 single_frame_deopt_(single_frame),
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100288 single_frame_done_(false),
Nicolas Geoffrayb52de242016-02-19 12:43:12 +0000289 single_frame_deopt_method_(nullptr),
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700290 single_frame_deopt_quick_method_header_(nullptr),
291 callee_method_(nullptr) {
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100292 }
293
294 ArtMethod* GetSingleFrameDeoptMethod() const {
295 return single_frame_deopt_method_;
Ian Rogers5cf98192014-05-29 21:31:50 -0700296 }
297
Nicolas Geoffrayb52de242016-02-19 12:43:12 +0000298 const OatQuickMethodHeader* GetSingleFrameDeoptQuickMethodHeader() const {
299 return single_frame_deopt_quick_method_header_;
300 }
301
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700302 void FinishStackWalk() REQUIRES_SHARED(Locks::mutator_lock_) {
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700303 // This is the upcall, or the next full frame in single-frame deopt, or the
304 // code isn't deoptimizeable. We remember the frame and last pc so that we
305 // may long jump to them.
306 exception_handler_->SetHandlerQuickFramePc(GetCurrentQuickFramePc());
307 exception_handler_->SetHandlerQuickFrame(GetCurrentQuickFrame());
308 exception_handler_->SetHandlerMethodHeader(GetCurrentOatQuickMethodHeader());
309 if (!stacked_shadow_frame_pushed_) {
310 // In case there is no deoptimized shadow frame for this upcall, we still
311 // need to push a nullptr to the stack since there is always a matching pop after
312 // the long jump.
313 GetThread()->PushStackedShadowFrame(nullptr,
314 StackedShadowFrameType::kDeoptimizationShadowFrame);
315 stacked_shadow_frame_pushed_ = true;
316 }
317 if (GetMethod() == nullptr) {
318 exception_handler_->SetFullFragmentDone(true);
319 } else {
David Sehr709b0702016-10-13 09:12:37 -0700320 CHECK(callee_method_ != nullptr) << GetMethod()->PrettyMethod(false);
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700321 exception_handler_->SetHandlerQuickArg0(reinterpret_cast<uintptr_t>(callee_method_));
322 }
323 }
324
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700325 bool VisitFrame() OVERRIDE REQUIRES_SHARED(Locks::mutator_lock_) {
Hiroshi Yamauchi649278c2014-08-13 11:12:22 -0700326 exception_handler_->SetHandlerFrameDepth(GetFrameDepth());
Mathieu Chartiere401d142015-04-22 13:56:20 -0700327 ArtMethod* method = GetMethod();
Andreas Gampe639bdd12015-06-03 11:22:45 -0700328 if (method == nullptr || single_frame_done_) {
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700329 FinishStackWalk();
Ian Rogers5cf98192014-05-29 21:31:50 -0700330 return false; // End stack walk.
331 } else if (method->IsRuntimeMethod()) {
332 // Ignore callee save method.
333 DCHECK(method->IsCalleeSaveMethod());
334 return true;
Sebastien Hertz520633b2015-09-08 17:03:36 +0200335 } else if (method->IsNative()) {
336 // If we return from JNI with a pending exception and want to deoptimize, we need to skip
337 // the native method.
338 // The top method is a runtime method, the native method comes next.
339 CHECK_EQ(GetFrameDepth(), 1U);
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700340 callee_method_ = method;
Sebastien Hertz520633b2015-09-08 17:03:36 +0200341 return true;
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700342 } else if (!single_frame_deopt_ &&
Nicolas Geoffray433b79a2017-01-30 20:54:45 +0000343 !Runtime::Current()->IsAsyncDeoptimizeable(GetCurrentQuickFramePc())) {
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700344 // We hit some code that's not deoptimizeable. However, Single-frame deoptimization triggered
345 // from compiled code is always allowed since HDeoptimize always saves the full environment.
Nicolas Geoffray433b79a2017-01-30 20:54:45 +0000346 LOG(WARNING) << "Got request to deoptimize un-deoptimizable method "
347 << method->PrettyMethod();
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700348 FinishStackWalk();
349 return false; // End stack walk.
Ian Rogers5cf98192014-05-29 21:31:50 -0700350 } else {
Nicolas Geoffray33856502015-10-20 15:52:58 +0100351 // Check if a shadow frame already exists for debugger's set-local-value purpose.
352 const size_t frame_id = GetFrameId();
353 ShadowFrame* new_frame = GetThread()->FindDebuggerShadowFrame(frame_id);
354 const bool* updated_vregs;
David Sehr0225f8e2018-01-31 08:52:24 +0000355 CodeItemDataAccessor accessor(method->DexInstructionData());
Mathieu Chartier808c7a52017-12-15 11:19:33 -0800356 const size_t num_regs = accessor.RegistersSize();
Nicolas Geoffray33856502015-10-20 15:52:58 +0100357 if (new_frame == nullptr) {
358 new_frame = ShadowFrame::CreateDeoptimizedFrame(num_regs, nullptr, method, GetDexPc());
359 updated_vregs = nullptr;
360 } else {
361 updated_vregs = GetThread()->GetUpdatedVRegFlags(frame_id);
362 DCHECK(updated_vregs != nullptr);
363 }
Andreas Gampebf9611f2016-03-25 16:58:00 -0700364 HandleOptimizingDeoptimization(method, new_frame, updated_vregs);
Nicolas Geoffray33856502015-10-20 15:52:58 +0100365 if (updated_vregs != nullptr) {
366 // Calling Thread::RemoveDebuggerShadowFrameMapping will also delete the updated_vregs
367 // array so this must come after we processed the frame.
368 GetThread()->RemoveDebuggerShadowFrameMapping(frame_id);
369 DCHECK(GetThread()->FindDebuggerShadowFrame(frame_id) == nullptr);
370 }
371 if (prev_shadow_frame_ != nullptr) {
372 prev_shadow_frame_->SetLink(new_frame);
373 } else {
374 // Will be popped after the long jump after DeoptimizeStack(),
375 // right before interpreter::EnterInterpreterFromDeoptimize().
376 stacked_shadow_frame_pushed_ = true;
377 GetThread()->PushStackedShadowFrame(
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700378 new_frame, StackedShadowFrameType::kDeoptimizationShadowFrame);
Nicolas Geoffray33856502015-10-20 15:52:58 +0100379 }
380 prev_shadow_frame_ = new_frame;
381
Andreas Gampe639bdd12015-06-03 11:22:45 -0700382 if (single_frame_deopt_ && !IsInInlinedFrame()) {
383 // Single-frame deopt ends at the first non-inlined frame and needs to store that method.
Andreas Gampe639bdd12015-06-03 11:22:45 -0700384 single_frame_done_ = true;
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100385 single_frame_deopt_method_ = method;
Nicolas Geoffrayb52de242016-02-19 12:43:12 +0000386 single_frame_deopt_quick_method_header_ = GetCurrentOatQuickMethodHeader();
Andreas Gampe639bdd12015-06-03 11:22:45 -0700387 }
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700388 callee_method_ = method;
Andreas Gampe639bdd12015-06-03 11:22:45 -0700389 return true;
Ian Rogers5cf98192014-05-29 21:31:50 -0700390 }
391 }
392
393 private:
Nicolas Geoffray33856502015-10-20 15:52:58 +0100394 void HandleOptimizingDeoptimization(ArtMethod* m,
395 ShadowFrame* new_frame,
396 const bool* updated_vregs)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700397 REQUIRES_SHARED(Locks::mutator_lock_) {
Nicolas Geoffray33856502015-10-20 15:52:58 +0100398 const OatQuickMethodHeader* method_header = GetCurrentOatQuickMethodHeader();
David Srbecky052f8ca2018-04-26 15:42:54 +0100399 CodeInfo code_info(method_header);
Nicolas Geoffray33856502015-10-20 15:52:58 +0100400 uintptr_t native_pc_offset = method_header->NativeQuickPcOffset(GetCurrentQuickFramePc());
David Srbecky052f8ca2018-04-26 15:42:54 +0100401 StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset);
David Sehr0225f8e2018-01-31 08:52:24 +0000402 CodeItemDataAccessor accessor(m->DexInstructionData());
Mathieu Chartier808c7a52017-12-15 11:19:33 -0800403 const size_t number_of_vregs = accessor.RegistersSize();
David Srbecky052f8ca2018-04-26 15:42:54 +0100404 uint32_t register_mask = code_info.GetRegisterMaskOf(stack_map);
405 BitMemoryRegion stack_mask = code_info.GetStackMaskOf(stack_map);
David Brazdilefc3f022015-10-28 12:19:06 -0500406 DexRegisterMap vreg_map = IsInInlinedFrame()
David Srbeckyfd89b072018-06-03 12:00:22 +0100407 ? code_info.GetDexRegisterMapAtDepth(GetCurrentInliningDepth() - 1, stack_map)
408 : code_info.GetDexRegisterMapOf(stack_map);
409 if (vreg_map.empty()) {
Nicolas Geoffray012fc4e2016-01-08 15:58:19 +0000410 return;
411 }
David Srbeckyfd89b072018-06-03 12:00:22 +0100412 DCHECK_EQ(vreg_map.size(), number_of_vregs);
Nicolas Geoffray012fc4e2016-01-08 15:58:19 +0000413
Nicolas Geoffray33856502015-10-20 15:52:58 +0100414 for (uint16_t vreg = 0; vreg < number_of_vregs; ++vreg) {
415 if (updated_vregs != nullptr && updated_vregs[vreg]) {
416 // Keep the value set by debugger.
417 continue;
418 }
419
David Srbeckye1402122018-06-13 18:20:45 +0100420 DexRegisterLocation::Kind location = vreg_map[vreg].GetKind();
Nicolas Geoffray33856502015-10-20 15:52:58 +0100421 static constexpr uint32_t kDeadValue = 0xEBADDE09;
422 uint32_t value = kDeadValue;
423 bool is_reference = false;
424
425 switch (location) {
426 case DexRegisterLocation::Kind::kInStack: {
David Srbeckye1402122018-06-13 18:20:45 +0100427 const int32_t offset = vreg_map[vreg].GetStackOffsetInBytes();
Nicolas Geoffray33856502015-10-20 15:52:58 +0100428 const uint8_t* addr = reinterpret_cast<const uint8_t*>(GetCurrentQuickFrame()) + offset;
429 value = *reinterpret_cast<const uint32_t*>(addr);
430 uint32_t bit = (offset >> 2);
David Srbecky4b59d102018-05-29 21:46:10 +0000431 if (bit < stack_mask.size_in_bits() && stack_mask.LoadBit(bit)) {
Nicolas Geoffray33856502015-10-20 15:52:58 +0100432 is_reference = true;
433 }
434 break;
435 }
436 case DexRegisterLocation::Kind::kInRegister:
437 case DexRegisterLocation::Kind::kInRegisterHigh:
438 case DexRegisterLocation::Kind::kInFpuRegister:
439 case DexRegisterLocation::Kind::kInFpuRegisterHigh: {
David Srbeckye1402122018-06-13 18:20:45 +0100440 uint32_t reg = vreg_map[vreg].GetMachineRegister();
Nicolas Geoffray33856502015-10-20 15:52:58 +0100441 bool result = GetRegisterIfAccessible(reg, ToVRegKind(location), &value);
442 CHECK(result);
443 if (location == DexRegisterLocation::Kind::kInRegister) {
444 if (((1u << reg) & register_mask) != 0) {
445 is_reference = true;
446 }
447 }
448 break;
449 }
450 case DexRegisterLocation::Kind::kConstant: {
David Srbeckye1402122018-06-13 18:20:45 +0100451 value = vreg_map[vreg].GetConstant();
Nicolas Geoffray33856502015-10-20 15:52:58 +0100452 if (value == 0) {
453 // Make it a reference for extra safety.
454 is_reference = true;
455 }
456 break;
457 }
458 case DexRegisterLocation::Kind::kNone: {
459 break;
460 }
461 default: {
David Srbeckye1402122018-06-13 18:20:45 +0100462 LOG(FATAL) << "Unexpected location kind " << vreg_map[vreg].GetKind();
Nicolas Geoffray33856502015-10-20 15:52:58 +0100463 UNREACHABLE();
464 }
465 }
466 if (is_reference) {
467 new_frame->SetVRegReference(vreg, reinterpret_cast<mirror::Object*>(value));
468 } else {
469 new_frame->SetVReg(vreg, value);
470 }
471 }
472 }
473
Sebastien Hertzc901dd72014-07-16 11:56:07 +0200474 static VRegKind GetVRegKind(uint16_t reg, const std::vector<int32_t>& kinds) {
475 return static_cast<VRegKind>(kinds.at(reg * 2));
476 }
477
Ian Rogers5cf98192014-05-29 21:31:50 -0700478 QuickExceptionHandler* const exception_handler_;
479 ShadowFrame* prev_shadow_frame_;
Mingyao Yang1f2d3ba2015-05-18 12:12:50 -0700480 bool stacked_shadow_frame_pushed_;
Andreas Gampe639bdd12015-06-03 11:22:45 -0700481 const bool single_frame_deopt_;
482 bool single_frame_done_;
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100483 ArtMethod* single_frame_deopt_method_;
Nicolas Geoffrayb52de242016-02-19 12:43:12 +0000484 const OatQuickMethodHeader* single_frame_deopt_quick_method_header_;
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700485 ArtMethod* callee_method_;
Ian Rogers5cf98192014-05-29 21:31:50 -0700486
487 DISALLOW_COPY_AND_ASSIGN(DeoptimizeStackVisitor);
488};
489
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700490void QuickExceptionHandler::PrepareForLongJumpToInvokeStubOrInterpreterBridge() {
491 if (full_fragment_done_) {
492 // Restore deoptimization exception. When returning from the invoke stub,
493 // ArtMethod::Invoke() will see the special exception to know deoptimization
494 // is needed.
495 self_->SetException(Thread::GetDeoptimizationException());
496 } else {
497 // PC needs to be of the quick-to-interpreter bridge.
498 int32_t offset;
Andreas Gampe542451c2016-07-26 09:02:02 -0700499 offset = GetThreadOffset<kRuntimePointerSize>(kQuickQuickToInterpreterBridge).Int32Value();
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700500 handler_quick_frame_pc_ = *reinterpret_cast<uintptr_t*>(
501 reinterpret_cast<uint8_t*>(self_) + offset);
502 }
503}
504
Sebastien Hertzfd3077e2014-04-23 10:32:43 +0200505void QuickExceptionHandler::DeoptimizeStack() {
506 DCHECK(is_deoptimization_);
Ian Rogers5cf98192014-05-29 21:31:50 -0700507 if (kDebugExceptionDelivery) {
Andreas Gampe3fec9ac2016-09-13 10:47:28 -0700508 self_->DumpStack(LOG_STREAM(INFO) << "Deoptimizing: ");
Ian Rogers5cf98192014-05-29 21:31:50 -0700509 }
Sebastien Hertzfd3077e2014-04-23 10:32:43 +0200510
Andreas Gampe639bdd12015-06-03 11:22:45 -0700511 DeoptimizeStackVisitor visitor(self_, context_, this, false);
Sebastien Hertzfd3077e2014-04-23 10:32:43 +0200512 visitor.WalkStack(true);
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700513 PrepareForLongJumpToInvokeStubOrInterpreterBridge();
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100514}
515
Nicolas Geoffray4e92c3c2017-05-08 09:34:26 +0100516void QuickExceptionHandler::DeoptimizeSingleFrame(DeoptimizationKind kind) {
Andreas Gampe639bdd12015-06-03 11:22:45 -0700517 DCHECK(is_deoptimization_);
518
Andreas Gampe639bdd12015-06-03 11:22:45 -0700519 DeoptimizeStackVisitor visitor(self_, context_, this, true);
520 visitor.WalkStack(true);
521
Nicolas Geoffrayb88d59e2016-02-17 11:31:49 +0000522 // Compiled code made an explicit deoptimization.
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100523 ArtMethod* deopt_method = visitor.GetSingleFrameDeoptMethod();
524 DCHECK(deopt_method != nullptr);
Nicolas Geoffray646d6382017-08-09 10:50:00 +0100525 if (VLOG_IS_ON(deopt) || kDebugExceptionDelivery) {
526 LOG(INFO) << "Single-frame deopting: "
527 << deopt_method->PrettyMethod()
528 << " due to "
529 << GetDeoptimizationKindName(kind);
530 DumpFramesWithType(self_, /* details */ true);
531 }
Calin Juravleffc87072016-04-20 14:22:09 +0100532 if (Runtime::Current()->UseJitCompilation()) {
Nicolas Geoffrayb88d59e2016-02-17 11:31:49 +0000533 Runtime::Current()->GetJit()->GetCodeCache()->InvalidateCompiledCodeFor(
Nicolas Geoffrayb52de242016-02-19 12:43:12 +0000534 deopt_method, visitor.GetSingleFrameDeoptQuickMethodHeader());
Nicolas Geoffrayb88d59e2016-02-17 11:31:49 +0000535 } else {
536 // Transfer the code to interpreter.
537 Runtime::Current()->GetInstrumentation()->UpdateMethodsCode(
538 deopt_method, GetQuickToInterpreterBridge());
539 }
Nicolas Geoffray73be1e82015-09-17 15:22:56 +0100540
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700541 PrepareForLongJumpToInvokeStubOrInterpreterBridge();
Andreas Gampe639bdd12015-06-03 11:22:45 -0700542}
543
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700544void QuickExceptionHandler::DeoptimizePartialFragmentFixup(uintptr_t return_pc) {
545 // At this point, the instrumentation stack has been updated. We need to install
546 // the real return pc on stack, in case instrumentation stub is stored there,
547 // so that the interpreter bridge code can return to the right place.
548 if (return_pc != 0) {
549 uintptr_t* pc_addr = reinterpret_cast<uintptr_t*>(handler_quick_frame_);
550 CHECK(pc_addr != nullptr);
551 pc_addr--;
552 *reinterpret_cast<uintptr_t*>(pc_addr) = return_pc;
553 }
Andreas Gampe639bdd12015-06-03 11:22:45 -0700554
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700555 // Architecture-dependent work. This is to get the LR right for x86 and x86-64.
Andreas Gampe639bdd12015-06-03 11:22:45 -0700556 if (kRuntimeISA == InstructionSet::kX86 || kRuntimeISA == InstructionSet::kX86_64) {
557 // On x86, the return address is on the stack, so just reuse it. Otherwise we would have to
558 // change how longjump works.
559 handler_quick_frame_ = reinterpret_cast<ArtMethod**>(
560 reinterpret_cast<uintptr_t>(handler_quick_frame_) - sizeof(void*));
561 }
562}
563
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100564// Unwinds all instrumentation stack frame prior to catch handler or upcall.
565class InstrumentationStackVisitor : public StackVisitor {
566 public:
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700567 InstrumentationStackVisitor(Thread* self, size_t frame_depth)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700568 REQUIRES_SHARED(Locks::mutator_lock_)
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100569 : StackVisitor(self, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
Ian Rogerscf7f1912014-10-22 22:06:39 -0700570 frame_depth_(frame_depth),
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100571 instrumentation_frames_to_pop_(0) {
Hiroshi Yamauchi649278c2014-08-13 11:12:22 -0700572 CHECK_NE(frame_depth_, kInvalidFrameDepth);
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100573 }
574
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700575 bool VisitFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
Hiroshi Yamauchi649278c2014-08-13 11:12:22 -0700576 size_t current_frame_depth = GetFrameDepth();
577 if (current_frame_depth < frame_depth_) {
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100578 CHECK(GetMethod() != nullptr);
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700579 if (UNLIKELY(reinterpret_cast<uintptr_t>(GetQuickInstrumentationExitPc()) == GetReturnPc())) {
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100580 if (!IsInInlinedFrame()) {
581 // We do not count inlined frames, because we do not instrument them. The reason we
582 // include them in the stack walking is the check against `frame_depth_`, which is
583 // given to us by a visitor that visits inlined frames.
584 ++instrumentation_frames_to_pop_;
585 }
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100586 }
587 return true;
588 } else {
589 // We reached the frame of the catch handler or the upcall.
590 return false;
591 }
592 }
593
594 size_t GetInstrumentationFramesToPop() const {
595 return instrumentation_frames_to_pop_;
596 }
597
598 private:
Hiroshi Yamauchi649278c2014-08-13 11:12:22 -0700599 const size_t frame_depth_;
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100600 size_t instrumentation_frames_to_pop_;
601
602 DISALLOW_COPY_AND_ASSIGN(InstrumentationStackVisitor);
603};
604
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700605uintptr_t QuickExceptionHandler::UpdateInstrumentationStack() {
606 uintptr_t return_pc = 0;
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100607 if (method_tracing_active_) {
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700608 InstrumentationStackVisitor visitor(self_, handler_frame_depth_);
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100609 visitor.WalkStack(true);
610
611 size_t instrumentation_frames_to_pop = visitor.GetInstrumentationFramesToPop();
612 instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
613 for (size_t i = 0; i < instrumentation_frames_to_pop; ++i) {
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700614 return_pc = instrumentation->PopMethodForUnwind(self_, is_deoptimization_);
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100615 }
616 }
Mingyao Yangf711f2c2016-05-23 12:29:39 -0700617 return return_pc;
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100618}
619
Andreas Gampe639bdd12015-06-03 11:22:45 -0700620void QuickExceptionHandler::DoLongJump(bool smash_caller_saves) {
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100621 // Place context back on thread so it will be available when we continue.
622 self_->ReleaseLongJumpContext(context_);
623 context_->SetSP(reinterpret_cast<uintptr_t>(handler_quick_frame_));
624 CHECK_NE(handler_quick_frame_pc_, 0u);
625 context_->SetPC(handler_quick_frame_pc_);
Andreas Gampe639bdd12015-06-03 11:22:45 -0700626 context_->SetArg0(handler_quick_arg0_);
627 if (smash_caller_saves) {
628 context_->SmashCallerSaves();
629 }
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100630 context_->DoLongJump();
Andreas Gampe794ad762015-02-23 08:12:24 -0800631 UNREACHABLE();
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100632}
633
Andreas Gampe639bdd12015-06-03 11:22:45 -0700634// Prints out methods with their type of frame.
635class DumpFramesWithTypeStackVisitor FINAL : public StackVisitor {
636 public:
Chih-Hung Hsieh471118e2016-04-29 14:27:41 -0700637 explicit DumpFramesWithTypeStackVisitor(Thread* self, bool show_details = false)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700638 REQUIRES_SHARED(Locks::mutator_lock_)
Andreas Gampe639bdd12015-06-03 11:22:45 -0700639 : StackVisitor(self, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
640 show_details_(show_details) {}
641
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700642 bool VisitFrame() OVERRIDE REQUIRES_SHARED(Locks::mutator_lock_) {
Andreas Gampe639bdd12015-06-03 11:22:45 -0700643 ArtMethod* method = GetMethod();
644 if (show_details_) {
645 LOG(INFO) << "|> pc = " << std::hex << GetCurrentQuickFramePc();
646 LOG(INFO) << "|> addr = " << std::hex << reinterpret_cast<uintptr_t>(GetCurrentQuickFrame());
647 if (GetCurrentQuickFrame() != nullptr && method != nullptr) {
648 LOG(INFO) << "|> ret = " << std::hex << GetReturnPc();
649 }
650 }
651 if (method == nullptr) {
652 // Transition, do go on, we want to unwind over bridges, all the way.
653 if (show_details_) {
654 LOG(INFO) << "N <transition>";
655 }
656 return true;
657 } else if (method->IsRuntimeMethod()) {
658 if (show_details_) {
David Sehr709b0702016-10-13 09:12:37 -0700659 LOG(INFO) << "R " << method->PrettyMethod(true);
Andreas Gampe639bdd12015-06-03 11:22:45 -0700660 }
661 return true;
662 } else {
663 bool is_shadow = GetCurrentShadowFrame() != nullptr;
664 LOG(INFO) << (is_shadow ? "S" : "Q")
665 << ((!is_shadow && IsInInlinedFrame()) ? "i" : " ")
666 << " "
David Sehr709b0702016-10-13 09:12:37 -0700667 << method->PrettyMethod(true);
Andreas Gampe639bdd12015-06-03 11:22:45 -0700668 return true; // Go on.
669 }
670 }
671
672 private:
673 bool show_details_;
674
675 DISALLOW_COPY_AND_ASSIGN(DumpFramesWithTypeStackVisitor);
676};
677
678void QuickExceptionHandler::DumpFramesWithType(Thread* self, bool details) {
679 DumpFramesWithTypeStackVisitor visitor(self, details);
680 visitor.WalkStack(true);
681}
682
Sebastien Hertzd45a1f52014-01-09 14:56:54 +0100683} // namespace art