blob: 6d1e3849deec80851d731f124594275be58b4b12 [file] [log] [blame]
Elliott Hughes68e76522011-10-05 13:22:16 -07001/*
2 * Copyright (C) 2011 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
17#include "stack.h"
18
Andreas Gampe46ee31b2016-12-14 10:11:49 -080019#include "android-base/stringprintf.h"
20
Ian Rogerse63db272014-07-15 15:36:11 -070021#include "arch/context.h"
Mathieu Chartiere401d142015-04-22 13:56:20 -070022#include "art_method-inl.h"
Andreas Gampe8228cdf2017-05-30 15:03:54 -070023#include "base/callee_save_type.h"
Andreas Gampe542451c2016-07-26 09:02:02 -070024#include "base/enums.h"
Dave Allisonf9439142014-03-27 15:10:22 -070025#include "base/hex_dump.h"
David Sehr9e734c72018-01-04 17:56:19 -080026#include "dex/dex_file_types.h"
Nicolas Geoffrayd23eeef2015-05-18 22:31:29 +010027#include "entrypoints/entrypoint_utils-inl.h"
Vladimir Markod3083dd2018-05-17 08:43:47 +010028#include "entrypoints/quick/callee_save_frame.h"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070029#include "entrypoints/runtime_asm_entrypoints.h"
Mathieu Chartiere401d142015-04-22 13:56:20 -070030#include "gc/space/image_space.h"
31#include "gc/space/space-inl.h"
Vladimir Marko6ec2a1b2018-05-22 15:33:48 +010032#include "interpreter/shadow_frame-inl.h"
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +010033#include "jit/jit.h"
34#include "jit/jit_code_cache.h"
Mathieu Chartiere401d142015-04-22 13:56:20 -070035#include "linear_alloc.h"
Andreas Gampe513061a2017-06-01 09:17:34 -070036#include "managed_stack.h"
Ian Rogers4f6ad8a2013-03-18 15:27:28 -070037#include "mirror/class-inl.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080038#include "mirror/object-inl.h"
39#include "mirror/object_array-inl.h"
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +010040#include "oat_quick_method_header.h"
Vladimir Marko439d1262019-04-12 14:45:07 +010041#include "obj_ptr-inl.h"
Vladimir Marko7624d252014-05-02 14:40:15 +010042#include "quick/quick_method_frame_info.h"
Mathieu Chartier590fee92013-09-13 13:46:47 -070043#include "runtime.h"
Dave Allisonf9439142014-03-27 15:10:22 -070044#include "thread.h"
Elliott Hughesbfe487b2011-10-26 15:48:55 -070045#include "thread_list.h"
Elliott Hughes68e76522011-10-05 13:22:16 -070046
Elliott Hughes11d1b0c2012-01-23 16:57:47 -080047namespace art {
48
Andreas Gampe46ee31b2016-12-14 10:11:49 -080049using android::base::StringPrintf;
50
Mathieu Chartier8405bfd2016-02-05 12:00:49 -080051static constexpr bool kDebugStackWalk = false;
Mathieu Chartiere401d142015-04-22 13:56:20 -070052
Hiroshi Yamauchi02f365f2017-02-03 15:06:00 -080053StackVisitor::StackVisitor(Thread* thread,
54 Context* context,
55 StackWalkKind walk_kind,
56 bool check_suspended)
57 : StackVisitor(thread, context, walk_kind, 0, check_suspended) {}
Ian Rogers7a22fa62013-01-23 12:16:16 -080058
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +010059StackVisitor::StackVisitor(Thread* thread,
60 Context* context,
61 StackWalkKind walk_kind,
Hiroshi Yamauchi02f365f2017-02-03 15:06:00 -080062 size_t num_frames,
63 bool check_suspended)
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +010064 : thread_(thread),
65 walk_kind_(walk_kind),
66 cur_shadow_frame_(nullptr),
67 cur_quick_frame_(nullptr),
68 cur_quick_frame_pc_(0),
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +010069 cur_oat_quick_method_header_(nullptr),
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +010070 num_frames_(num_frames),
71 cur_depth_(0),
David Srbecky145a18a2019-06-03 14:35:22 +010072 cur_inline_info_(nullptr, CodeInfo()),
73 cur_stack_map_(0, StackMap()),
Hiroshi Yamauchi02f365f2017-02-03 15:06:00 -080074 context_(context),
75 check_suspended_(check_suspended) {
76 if (check_suspended_) {
77 DCHECK(thread == Thread::Current() || thread->IsSuspended()) << *thread;
78 }
Ian Rogers5cf98192014-05-29 21:31:50 -070079}
80
David Srbecky145a18a2019-06-03 14:35:22 +010081CodeInfo* StackVisitor::GetCurrentInlineInfo() const {
82 DCHECK(!(*cur_quick_frame_)->IsNative());
83 const OatQuickMethodHeader* header = GetCurrentOatQuickMethodHeader();
84 if (cur_inline_info_.first != header) {
David Srbecky0d4567f2019-05-30 22:45:40 +010085 cur_inline_info_ = std::make_pair(header, CodeInfo::DecodeInlineInfoOnly(header));
David Srbecky145a18a2019-06-03 14:35:22 +010086 }
87 return &cur_inline_info_.second;
88}
89
90StackMap* StackVisitor::GetCurrentStackMap() const {
91 DCHECK(!(*cur_quick_frame_)->IsNative());
92 const OatQuickMethodHeader* header = GetCurrentOatQuickMethodHeader();
93 if (cur_stack_map_.first != cur_quick_frame_pc_) {
94 uint32_t pc = header->NativeQuickPcOffset(cur_quick_frame_pc_);
95 cur_stack_map_ = std::make_pair(cur_quick_frame_pc_,
96 GetCurrentInlineInfo()->GetStackMapForNativePcOffset(pc));
97 }
98 return &cur_stack_map_.second;
99}
100
Mathieu Chartiere401d142015-04-22 13:56:20 -0700101ArtMethod* StackVisitor::GetMethod() const {
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100102 if (cur_shadow_frame_ != nullptr) {
103 return cur_shadow_frame_->GetMethod();
104 } else if (cur_quick_frame_ != nullptr) {
105 if (IsInInlinedFrame()) {
David Srbecky145a18a2019-06-03 14:35:22 +0100106 CodeInfo* code_info = GetCurrentInlineInfo();
Mathieu Chartier45bf2502016-03-31 11:07:09 -0700107 DCHECK(walk_kind_ != StackWalkKind::kSkipInlinedFrames);
David Srbecky145a18a2019-06-03 14:35:22 +0100108 return GetResolvedMethod(*GetCurrentQuickFrame(), *code_info, current_inline_frames_);
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100109 } else {
Mathieu Chartiere401d142015-04-22 13:56:20 -0700110 return *cur_quick_frame_;
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100111 }
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100112 }
Mathieu Chartiere401d142015-04-22 13:56:20 -0700113 return nullptr;
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100114}
115
Dave Allisonb373e092014-02-20 16:06:36 -0800116uint32_t StackVisitor::GetDexPc(bool abort_on_failure) const {
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700117 if (cur_shadow_frame_ != nullptr) {
Ian Rogers0399dde2012-06-06 17:09:28 -0700118 return cur_shadow_frame_->GetDexPC();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700119 } else if (cur_quick_frame_ != nullptr) {
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100120 if (IsInInlinedFrame()) {
David Srbecky93bd3612018-07-02 19:30:18 +0100121 return current_inline_frames_.back().GetDexPc();
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100122 } else if (cur_oat_quick_method_header_ == nullptr) {
Andreas Gampee2abbc62017-09-15 11:59:26 -0700123 return dex::kDexNoIndex;
David Srbecky145a18a2019-06-03 14:35:22 +0100124 } else if (!(*GetCurrentQuickFrame())->IsNative()) {
125 StackMap* stack_map = GetCurrentStackMap();
126 DCHECK(stack_map->IsValid());
127 return stack_map->GetDexPc();
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100128 } else {
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100129 return cur_oat_quick_method_header_->ToDexPc(
130 GetMethod(), cur_quick_frame_pc_, abort_on_failure);
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100131 }
Ian Rogers0399dde2012-06-06 17:09:28 -0700132 } else {
133 return 0;
134 }
135}
136
Mathieu Chartiere401d142015-04-22 13:56:20 -0700137extern "C" mirror::Object* artQuickGetProxyThisObject(ArtMethod** sp)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700138 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertza836bc92014-11-25 16:30:53 +0100139
Vladimir Markoabedfca2019-05-23 14:07:47 +0100140ObjPtr<mirror::Object> StackVisitor::GetThisObject() const {
Andreas Gampe542451c2016-07-26 09:02:02 -0700141 DCHECK_EQ(Runtime::Current()->GetClassLinker()->GetImagePointerSize(), kRuntimePointerSize);
Mathieu Chartiere401d142015-04-22 13:56:20 -0700142 ArtMethod* m = GetMethod();
Ian Rogers62d6c772013-02-27 08:32:07 -0800143 if (m->IsStatic()) {
Nicolas Geoffray39468442014-09-02 15:17:15 +0100144 return nullptr;
Ian Rogers62d6c772013-02-27 08:32:07 -0800145 } else if (m->IsNative()) {
Nicolas Geoffray39468442014-09-02 15:17:15 +0100146 if (cur_quick_frame_ != nullptr) {
Mathieu Chartiereb8167a2014-05-07 15:43:14 -0700147 HandleScope* hs = reinterpret_cast<HandleScope*>(
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100148 reinterpret_cast<char*>(cur_quick_frame_) + sizeof(ArtMethod*));
Mathieu Chartiereb8167a2014-05-07 15:43:14 -0700149 return hs->GetReference(0);
Ian Rogers62d6c772013-02-27 08:32:07 -0800150 } else {
151 return cur_shadow_frame_->GetVRegReference(0);
152 }
Nicolas Geoffray3a090922015-11-24 09:17:30 +0000153 } else if (m->IsProxyMethod()) {
Sebastien Hertza836bc92014-11-25 16:30:53 +0100154 if (cur_quick_frame_ != nullptr) {
155 return artQuickGetProxyThisObject(cur_quick_frame_);
156 } else {
157 return cur_shadow_frame_->GetVRegReference(0);
158 }
Ian Rogers62d6c772013-02-27 08:32:07 -0800159 } else {
David Sehr0225f8e2018-01-31 08:52:24 +0000160 CodeItemDataAccessor accessor(m->DexInstructionData());
Mathieu Chartier808c7a52017-12-15 11:19:33 -0800161 if (!accessor.HasCodeItem()) {
Ian Rogerse0dcd462014-03-08 15:21:04 -0800162 UNIMPLEMENTED(ERROR) << "Failed to determine this object of abstract or proxy method: "
David Sehr709b0702016-10-13 09:12:37 -0700163 << ArtMethod::PrettyMethod(m);
Ian Rogerse0dcd462014-03-08 15:21:04 -0800164 return nullptr;
Ian Rogers62d6c772013-02-27 08:32:07 -0800165 } else {
Mathieu Chartier808c7a52017-12-15 11:19:33 -0800166 uint16_t reg = accessor.RegistersSize() - accessor.InsSize();
Nicolas Geoffray15b9d522015-03-12 15:05:13 +0000167 uint32_t value = 0;
Nicolas Geoffray4cbfadc2018-10-10 16:09:43 +0100168 if (!GetVReg(m, reg, kReferenceVReg, &value)) {
169 return nullptr;
170 }
Nicolas Geoffray15b9d522015-03-12 15:05:13 +0000171 return reinterpret_cast<mirror::Object*>(value);
Ian Rogers62d6c772013-02-27 08:32:07 -0800172 }
173 }
174}
175
Ian Rogers0c7abda2012-09-19 13:33:42 -0700176size_t StackVisitor::GetNativePcOffset() const {
177 DCHECK(!IsShadowFrame());
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100178 return GetCurrentOatQuickMethodHeader()->NativeQuickPcOffset(cur_quick_frame_pc_);
Ian Rogers0c7abda2012-09-19 13:33:42 -0700179}
180
Mingyao Yang99170c62015-07-06 11:10:37 -0700181bool StackVisitor::GetVRegFromDebuggerShadowFrame(uint16_t vreg,
182 VRegKind kind,
183 uint32_t* val) const {
184 size_t frame_id = const_cast<StackVisitor*>(this)->GetFrameId();
185 ShadowFrame* shadow_frame = thread_->FindDebuggerShadowFrame(frame_id);
186 if (shadow_frame != nullptr) {
187 bool* updated_vreg_flags = thread_->GetUpdatedVRegFlags(frame_id);
188 DCHECK(updated_vreg_flags != nullptr);
189 if (updated_vreg_flags[vreg]) {
190 // Value is set by the debugger.
191 if (kind == kReferenceVReg) {
192 *val = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(
193 shadow_frame->GetVRegReference(vreg)));
194 } else {
195 *val = shadow_frame->GetVReg(vreg);
196 }
197 return true;
198 }
199 }
200 // No value is set by the debugger.
201 return false;
202}
203
David Srbeckycffa2542019-07-01 15:31:41 +0100204bool StackVisitor::GetVReg(ArtMethod* m,
205 uint16_t vreg,
206 VRegKind kind,
207 uint32_t* val,
208 std::optional<DexRegisterLocation> location) const {
Sebastien Hertzc901dd72014-07-16 11:56:07 +0200209 if (cur_quick_frame_ != nullptr) {
210 DCHECK(context_ != nullptr); // You can't reliably read registers without a context.
Ian Rogers2bcb4a42012-11-08 10:39:18 -0800211 DCHECK(m == GetMethod());
Mingyao Yang99170c62015-07-06 11:10:37 -0700212 // Check if there is value set by the debugger.
213 if (GetVRegFromDebuggerShadowFrame(vreg, kind, val)) {
214 return true;
215 }
Vladimir Marko9d07e3d2016-03-31 12:02:28 +0100216 DCHECK(cur_oat_quick_method_header_->IsOptimized());
David Srbeckycffa2542019-07-01 15:31:41 +0100217 if (location.has_value() && kind != kReferenceVReg) {
218 uint32_t val2 = *val;
219 // The caller already known the register location, so we can use the faster overload
220 // which does not decode the stack maps.
221 bool ok = GetVRegFromOptimizedCode(location.value(), kind, val);
222 // Compare to the slower overload.
223 DCHECK_EQ(ok, GetVRegFromOptimizedCode(m, vreg, kind, &val2));
224 DCHECK_EQ(*val, val2);
225 return ok;
226 }
Vladimir Marko9d07e3d2016-03-31 12:02:28 +0100227 return GetVRegFromOptimizedCode(m, vreg, kind, val);
Ian Rogers0399dde2012-06-06 17:09:28 -0700228 } else {
Sebastien Hertz96ba8dc2015-01-22 18:57:14 +0100229 DCHECK(cur_shadow_frame_ != nullptr);
Sebastien Hertz09687442015-11-17 10:35:39 +0100230 if (kind == kReferenceVReg) {
231 *val = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(
232 cur_shadow_frame_->GetVRegReference(vreg)));
233 } else {
234 *val = cur_shadow_frame_->GetVReg(vreg);
235 }
Sebastien Hertz0bcb2902014-06-17 15:52:45 +0200236 return true;
Ian Rogers0399dde2012-06-06 17:09:28 -0700237 }
238}
239
Mathieu Chartiere401d142015-04-22 13:56:20 -0700240bool StackVisitor::GetVRegFromOptimizedCode(ArtMethod* m, uint16_t vreg, VRegKind kind,
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100241 uint32_t* val) const {
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100242 DCHECK_EQ(m, GetMethod());
Mathieu Chartier808c7a52017-12-15 11:19:33 -0800243 // Can't be null or how would we compile its instructions?
244 DCHECK(m->GetCodeItem() != nullptr) << m->PrettyMethod();
David Sehr0225f8e2018-01-31 08:52:24 +0000245 CodeItemDataAccessor accessor(m->DexInstructionData());
Mathieu Chartier808c7a52017-12-15 11:19:33 -0800246 uint16_t number_of_dex_registers = accessor.RegistersSize();
247 DCHECK_LT(vreg, number_of_dex_registers);
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100248 const OatQuickMethodHeader* method_header = GetCurrentOatQuickMethodHeader();
David Srbecky052f8ca2018-04-26 15:42:54 +0100249 CodeInfo code_info(method_header);
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100250
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100251 uint32_t native_pc_offset = method_header->NativeQuickPcOffset(cur_quick_frame_pc_);
David Srbecky052f8ca2018-04-26 15:42:54 +0100252 StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset);
Nicolas Geoffraye12997f2015-05-22 14:01:33 +0100253 DCHECK(stack_map.IsValid());
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100254
255 DexRegisterMap dex_register_map = IsInInlinedFrame()
David Srbecky93bd3612018-07-02 19:30:18 +0100256 ? code_info.GetInlineDexRegisterMapOf(stack_map, current_inline_frames_.back())
David Srbeckyfd89b072018-06-03 12:00:22 +0100257 : code_info.GetDexRegisterMapOf(stack_map);
258 if (dex_register_map.empty()) {
Nicolas Geoffray012fc4e2016-01-08 15:58:19 +0000259 return false;
260 }
David Srbeckyfd89b072018-06-03 12:00:22 +0100261 DCHECK_EQ(dex_register_map.size(), number_of_dex_registers);
David Srbeckye1402122018-06-13 18:20:45 +0100262 DexRegisterLocation::Kind location_kind = dex_register_map[vreg].GetKind();
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100263 switch (location_kind) {
Roland Levillaina2d8ec62015-03-12 15:25:29 +0000264 case DexRegisterLocation::Kind::kInStack: {
David Srbeckye1402122018-06-13 18:20:45 +0100265 const int32_t offset = dex_register_map[vreg].GetStackOffsetInBytes();
Nicolas Geoffray4cbfadc2018-10-10 16:09:43 +0100266 BitMemoryRegion stack_mask = code_info.GetStackMaskOf(stack_map);
267 if (kind == kReferenceVReg && !stack_mask.LoadBit(offset / kFrameSlotSize)) {
268 return false;
269 }
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100270 const uint8_t* addr = reinterpret_cast<const uint8_t*>(cur_quick_frame_) + offset;
271 *val = *reinterpret_cast<const uint32_t*>(addr);
272 return true;
273 }
Nicolas Geoffray4cbfadc2018-10-10 16:09:43 +0100274 case DexRegisterLocation::Kind::kInRegister: {
275 uint32_t register_mask = code_info.GetRegisterMaskOf(stack_map);
276 uint32_t reg = dex_register_map[vreg].GetMachineRegister();
277 if (kind == kReferenceVReg && !(register_mask & (1 << reg))) {
278 return false;
279 }
280 return GetRegisterIfAccessible(reg, kind, val);
281 }
David Brazdild9cb68e2015-08-25 13:52:43 +0100282 case DexRegisterLocation::Kind::kInRegisterHigh:
283 case DexRegisterLocation::Kind::kInFpuRegister:
284 case DexRegisterLocation::Kind::kInFpuRegisterHigh: {
Nicolas Geoffray4cbfadc2018-10-10 16:09:43 +0100285 if (kind == kReferenceVReg) {
286 return false;
287 }
David Srbeckye1402122018-06-13 18:20:45 +0100288 uint32_t reg = dex_register_map[vreg].GetMachineRegister();
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100289 return GetRegisterIfAccessible(reg, kind, val);
290 }
Nicolas Geoffray4cbfadc2018-10-10 16:09:43 +0100291 case DexRegisterLocation::Kind::kConstant: {
292 uint32_t result = dex_register_map[vreg].GetConstant();
293 if (kind == kReferenceVReg && result != 0) {
294 return false;
295 }
296 *val = result;
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100297 return true;
Nicolas Geoffray4cbfadc2018-10-10 16:09:43 +0100298 }
Roland Levillaina2d8ec62015-03-12 15:25:29 +0000299 case DexRegisterLocation::Kind::kNone:
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100300 return false;
Roland Levillaina2d8ec62015-03-12 15:25:29 +0000301 default:
David Srbeckye1402122018-06-13 18:20:45 +0100302 LOG(FATAL) << "Unexpected location kind " << dex_register_map[vreg].GetKind();
Roland Levillaina2d8ec62015-03-12 15:25:29 +0000303 UNREACHABLE();
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100304 }
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100305}
306
David Srbeckycffa2542019-07-01 15:31:41 +0100307bool StackVisitor::GetVRegFromOptimizedCode(DexRegisterLocation location,
308 VRegKind kind,
309 uint32_t* val) const {
310 switch (location.GetKind()) {
311 case DexRegisterLocation::Kind::kInvalid:
312 break;
313 case DexRegisterLocation::Kind::kInStack: {
314 const uint8_t* sp = reinterpret_cast<const uint8_t*>(cur_quick_frame_);
315 *val = *reinterpret_cast<const uint32_t*>(sp + location.GetStackOffsetInBytes());
316 return true;
317 }
318 case DexRegisterLocation::Kind::kInRegister:
319 case DexRegisterLocation::Kind::kInRegisterHigh:
320 case DexRegisterLocation::Kind::kInFpuRegister:
321 case DexRegisterLocation::Kind::kInFpuRegisterHigh:
322 return GetRegisterIfAccessible(location.GetMachineRegister(), kind, val);
323 case DexRegisterLocation::Kind::kConstant:
324 *val = location.GetConstant();
325 return true;
326 case DexRegisterLocation::Kind::kNone:
327 return false;
328 }
329 LOG(FATAL) << "Unexpected location kind " << location.GetKind();
330 UNREACHABLE();
331}
332
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100333bool StackVisitor::GetRegisterIfAccessible(uint32_t reg, VRegKind kind, uint32_t* val) const {
334 const bool is_float = (kind == kFloatVReg) || (kind == kDoubleLoVReg) || (kind == kDoubleHiVReg);
David Brazdil77a48ae2015-09-15 12:34:04 +0000335
Vladimir Marko239d6ea2016-09-05 10:44:04 +0100336 if (kRuntimeISA == InstructionSet::kX86 && is_float) {
337 // X86 float registers are 64-bit and each XMM register is provided as two separate
338 // 32-bit registers by the context.
339 reg = (kind == kDoubleHiVReg) ? (2 * reg + 1) : (2 * reg);
340 }
David Brazdil77a48ae2015-09-15 12:34:04 +0000341
Goran Jakovljevic986660c2015-12-10 11:44:50 +0100342 // MIPS32 float registers are used as 64-bit (for MIPS32r2 it is pair
343 // F(2n)-F(2n+1), and for MIPS32r6 it is 64-bit register F(2n)). When
344 // accessing upper 32-bits from double, reg + 1 should be used.
345 if ((kRuntimeISA == InstructionSet::kMips) && (kind == kDoubleHiVReg)) {
346 DCHECK_ALIGNED(reg, 2);
347 reg++;
348 }
349
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100350 if (!IsAccessibleRegister(reg, is_float)) {
351 return false;
352 }
353 uintptr_t ptr_val = GetRegister(reg, is_float);
354 const bool target64 = Is64BitInstructionSet(kRuntimeISA);
355 if (target64) {
356 const bool wide_lo = (kind == kLongLoVReg) || (kind == kDoubleLoVReg);
357 const bool wide_hi = (kind == kLongHiVReg) || (kind == kDoubleHiVReg);
358 int64_t value_long = static_cast<int64_t>(ptr_val);
359 if (wide_lo) {
360 ptr_val = static_cast<uintptr_t>(Low32Bits(value_long));
361 } else if (wide_hi) {
362 ptr_val = static_cast<uintptr_t>(High32Bits(value_long));
363 }
364 }
365 *val = ptr_val;
366 return true;
367}
368
Mingyao Yang99170c62015-07-06 11:10:37 -0700369bool StackVisitor::GetVRegPairFromDebuggerShadowFrame(uint16_t vreg,
370 VRegKind kind_lo,
371 VRegKind kind_hi,
372 uint64_t* val) const {
373 uint32_t low_32bits;
374 uint32_t high_32bits;
375 bool success = GetVRegFromDebuggerShadowFrame(vreg, kind_lo, &low_32bits);
376 success &= GetVRegFromDebuggerShadowFrame(vreg + 1, kind_hi, &high_32bits);
377 if (success) {
378 *val = (static_cast<uint64_t>(high_32bits) << 32) | static_cast<uint64_t>(low_32bits);
379 }
380 return success;
381}
382
Mathieu Chartiere401d142015-04-22 13:56:20 -0700383bool StackVisitor::GetVRegPair(ArtMethod* m, uint16_t vreg, VRegKind kind_lo,
Sebastien Hertzc901dd72014-07-16 11:56:07 +0200384 VRegKind kind_hi, uint64_t* val) const {
385 if (kind_lo == kLongLoVReg) {
386 DCHECK_EQ(kind_hi, kLongHiVReg);
387 } else if (kind_lo == kDoubleLoVReg) {
388 DCHECK_EQ(kind_hi, kDoubleHiVReg);
389 } else {
390 LOG(FATAL) << "Expected long or double: kind_lo=" << kind_lo << ", kind_hi=" << kind_hi;
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100391 UNREACHABLE();
Sebastien Hertzc901dd72014-07-16 11:56:07 +0200392 }
Mingyao Yang99170c62015-07-06 11:10:37 -0700393 // Check if there is value set by the debugger.
394 if (GetVRegPairFromDebuggerShadowFrame(vreg, kind_lo, kind_hi, val)) {
395 return true;
396 }
Sebastien Hertzc901dd72014-07-16 11:56:07 +0200397 if (cur_quick_frame_ != nullptr) {
398 DCHECK(context_ != nullptr); // You can't reliably read registers without a context.
399 DCHECK(m == GetMethod());
Vladimir Marko9d07e3d2016-03-31 12:02:28 +0100400 DCHECK(cur_oat_quick_method_header_->IsOptimized());
401 return GetVRegPairFromOptimizedCode(m, vreg, kind_lo, kind_hi, val);
Sebastien Hertzc901dd72014-07-16 11:56:07 +0200402 } else {
Sebastien Hertz96ba8dc2015-01-22 18:57:14 +0100403 DCHECK(cur_shadow_frame_ != nullptr);
Sebastien Hertzc901dd72014-07-16 11:56:07 +0200404 *val = cur_shadow_frame_->GetVRegLong(vreg);
405 return true;
406 }
407}
408
Mathieu Chartiere401d142015-04-22 13:56:20 -0700409bool StackVisitor::GetVRegPairFromOptimizedCode(ArtMethod* m, uint16_t vreg,
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100410 VRegKind kind_lo, VRegKind kind_hi,
411 uint64_t* val) const {
412 uint32_t low_32bits;
413 uint32_t high_32bits;
Igor Murashkinb1d8c312015-08-04 11:18:43 -0700414 bool success = GetVRegFromOptimizedCode(m, vreg, kind_lo, &low_32bits);
415 success &= GetVRegFromOptimizedCode(m, vreg + 1, kind_hi, &high_32bits);
Sebastien Hertz7cde48c2015-01-20 16:06:43 +0100416 if (success) {
417 *val = (static_cast<uint64_t>(high_32bits) << 32) | static_cast<uint64_t>(low_32bits);
418 }
419 return success;
420}
421
422bool StackVisitor::GetRegisterPairIfAccessible(uint32_t reg_lo, uint32_t reg_hi,
423 VRegKind kind_lo, uint64_t* val) const {
424 const bool is_float = (kind_lo == kDoubleLoVReg);
425 if (!IsAccessibleRegister(reg_lo, is_float) || !IsAccessibleRegister(reg_hi, is_float)) {
426 return false;
427 }
428 uintptr_t ptr_val_lo = GetRegister(reg_lo, is_float);
429 uintptr_t ptr_val_hi = GetRegister(reg_hi, is_float);
430 bool target64 = Is64BitInstructionSet(kRuntimeISA);
431 if (target64) {
432 int64_t value_long_lo = static_cast<int64_t>(ptr_val_lo);
433 int64_t value_long_hi = static_cast<int64_t>(ptr_val_hi);
434 ptr_val_lo = static_cast<uintptr_t>(Low32Bits(value_long_lo));
435 ptr_val_hi = static_cast<uintptr_t>(High32Bits(value_long_hi));
436 }
437 *val = (static_cast<uint64_t>(ptr_val_hi) << 32) | static_cast<uint32_t>(ptr_val_lo);
438 return true;
439}
440
Vladimir Marko439d1262019-04-12 14:45:07 +0100441ShadowFrame* StackVisitor::PrepareSetVReg(ArtMethod* m, uint16_t vreg, bool wide) {
David Sehr0225f8e2018-01-31 08:52:24 +0000442 CodeItemDataAccessor accessor(m->DexInstructionData());
Mathieu Chartier808c7a52017-12-15 11:19:33 -0800443 if (!accessor.HasCodeItem()) {
Vladimir Marko439d1262019-04-12 14:45:07 +0100444 return nullptr;
Mingyao Yang99170c62015-07-06 11:10:37 -0700445 }
446 ShadowFrame* shadow_frame = GetCurrentShadowFrame();
447 if (shadow_frame == nullptr) {
448 // This is a compiled frame: we must prepare and update a shadow frame that will
449 // be executed by the interpreter after deoptimization of the stack.
450 const size_t frame_id = GetFrameId();
Mathieu Chartier808c7a52017-12-15 11:19:33 -0800451 const uint16_t num_regs = accessor.RegistersSize();
Mingyao Yang99170c62015-07-06 11:10:37 -0700452 shadow_frame = thread_->FindOrCreateDebuggerShadowFrame(frame_id, num_regs, m, GetDexPc());
453 CHECK(shadow_frame != nullptr);
Vladimir Marko439d1262019-04-12 14:45:07 +0100454 // Remember the vreg(s) has been set for debugging and must not be overwritten by the
Mingyao Yang99170c62015-07-06 11:10:37 -0700455 // original value during deoptimization of the stack.
456 thread_->GetUpdatedVRegFlags(frame_id)[vreg] = true;
Vladimir Marko439d1262019-04-12 14:45:07 +0100457 if (wide) {
458 thread_->GetUpdatedVRegFlags(frame_id)[vreg + 1] = true;
459 }
Mingyao Yang99170c62015-07-06 11:10:37 -0700460 }
Vladimir Marko439d1262019-04-12 14:45:07 +0100461 return shadow_frame;
462}
463
464bool StackVisitor::SetVReg(ArtMethod* m, uint16_t vreg, uint32_t new_value, VRegKind kind) {
465 DCHECK(kind == kIntVReg || kind == kFloatVReg);
466 ShadowFrame* shadow_frame = PrepareSetVReg(m, vreg, /* wide= */ false);
467 if (shadow_frame == nullptr) {
468 return false;
Mingyao Yang99170c62015-07-06 11:10:37 -0700469 }
Vladimir Marko439d1262019-04-12 14:45:07 +0100470 shadow_frame->SetVReg(vreg, new_value);
471 return true;
472}
473
474bool StackVisitor::SetVRegReference(ArtMethod* m, uint16_t vreg, ObjPtr<mirror::Object> new_value) {
475 ShadowFrame* shadow_frame = PrepareSetVReg(m, vreg, /* wide= */ false);
476 if (shadow_frame == nullptr) {
477 return false;
478 }
479 shadow_frame->SetVRegReference(vreg, new_value);
Mingyao Yang99170c62015-07-06 11:10:37 -0700480 return true;
481}
482
Mingyao Yang636b9252015-07-31 16:40:24 -0700483bool StackVisitor::SetVRegPair(ArtMethod* m,
484 uint16_t vreg,
485 uint64_t new_value,
486 VRegKind kind_lo,
487 VRegKind kind_hi) {
Mingyao Yang99170c62015-07-06 11:10:37 -0700488 if (kind_lo == kLongLoVReg) {
489 DCHECK_EQ(kind_hi, kLongHiVReg);
490 } else if (kind_lo == kDoubleLoVReg) {
491 DCHECK_EQ(kind_hi, kDoubleHiVReg);
492 } else {
493 LOG(FATAL) << "Expected long or double: kind_lo=" << kind_lo << ", kind_hi=" << kind_hi;
494 UNREACHABLE();
495 }
Vladimir Marko439d1262019-04-12 14:45:07 +0100496 ShadowFrame* shadow_frame = PrepareSetVReg(m, vreg, /* wide= */ true);
Mingyao Yang99170c62015-07-06 11:10:37 -0700497 if (shadow_frame == nullptr) {
Vladimir Marko439d1262019-04-12 14:45:07 +0100498 return false;
Mingyao Yang99170c62015-07-06 11:10:37 -0700499 }
500 shadow_frame->SetVRegLong(vreg, new_value);
501 return true;
502}
503
Sebastien Hertz96ba8dc2015-01-22 18:57:14 +0100504bool StackVisitor::IsAccessibleGPR(uint32_t reg) const {
505 DCHECK(context_ != nullptr);
506 return context_->IsAccessibleGPR(reg);
507}
508
Mathieu Chartier815873e2014-02-13 18:02:13 -0800509uintptr_t* StackVisitor::GetGPRAddress(uint32_t reg) const {
Sebastien Hertz96ba8dc2015-01-22 18:57:14 +0100510 DCHECK(cur_quick_frame_ != nullptr) << "This is a quick frame routine";
511 DCHECK(context_ != nullptr);
Mathieu Chartier815873e2014-02-13 18:02:13 -0800512 return context_->GetGPRAddress(reg);
513}
514
Sebastien Hertz96ba8dc2015-01-22 18:57:14 +0100515uintptr_t StackVisitor::GetGPR(uint32_t reg) const {
516 DCHECK(cur_quick_frame_ != nullptr) << "This is a quick frame routine";
517 DCHECK(context_ != nullptr);
518 return context_->GetGPR(reg);
Ian Rogers0399dde2012-06-06 17:09:28 -0700519}
520
Sebastien Hertz96ba8dc2015-01-22 18:57:14 +0100521bool StackVisitor::IsAccessibleFPR(uint32_t reg) const {
522 DCHECK(context_ != nullptr);
523 return context_->IsAccessibleFPR(reg);
Sebastien Hertz0bcb2902014-06-17 15:52:45 +0200524}
525
Sebastien Hertz96ba8dc2015-01-22 18:57:14 +0100526uintptr_t StackVisitor::GetFPR(uint32_t reg) const {
527 DCHECK(cur_quick_frame_ != nullptr) << "This is a quick frame routine";
528 DCHECK(context_ != nullptr);
529 return context_->GetFPR(reg);
530}
531
Ian Rogers0399dde2012-06-06 17:09:28 -0700532uintptr_t StackVisitor::GetReturnPc() const {
Ian Rogers13735952014-10-08 12:43:28 -0700533 uint8_t* sp = reinterpret_cast<uint8_t*>(GetCurrentQuickFrame());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700534 DCHECK(sp != nullptr);
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100535 uint8_t* pc_addr = sp + GetCurrentQuickFrameInfo().GetReturnPcOffset();
Ian Rogers0399dde2012-06-06 17:09:28 -0700536 return *reinterpret_cast<uintptr_t*>(pc_addr);
537}
538
539void StackVisitor::SetReturnPc(uintptr_t new_ret_pc) {
Ian Rogers13735952014-10-08 12:43:28 -0700540 uint8_t* sp = reinterpret_cast<uint8_t*>(GetCurrentQuickFrame());
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700541 CHECK(sp != nullptr);
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100542 uint8_t* pc_addr = sp + GetCurrentQuickFrameInfo().GetReturnPcOffset();
Ian Rogers0399dde2012-06-06 17:09:28 -0700543 *reinterpret_cast<uintptr_t*>(pc_addr) = new_ret_pc;
544}
545
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100546size_t StackVisitor::ComputeNumFrames(Thread* thread, StackWalkKind walk_kind) {
Ian Rogers0399dde2012-06-06 17:09:28 -0700547 struct NumFramesVisitor : public StackVisitor {
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100548 NumFramesVisitor(Thread* thread_in, StackWalkKind walk_kind_in)
549 : StackVisitor(thread_in, nullptr, walk_kind_in), frames(0) {}
Ian Rogers0399dde2012-06-06 17:09:28 -0700550
Roland Levillainbbc6e7e2018-08-24 16:58:47 +0100551 bool VisitFrame() override {
Ian Rogers0399dde2012-06-06 17:09:28 -0700552 frames++;
553 return true;
554 }
Elliott Hughes08fc03a2012-06-26 17:34:00 -0700555
Ian Rogers0399dde2012-06-06 17:09:28 -0700556 size_t frames;
557 };
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100558 NumFramesVisitor visitor(thread, walk_kind);
Ian Rogers0399dde2012-06-06 17:09:28 -0700559 visitor.WalkStack(true);
560 return visitor.frames;
561}
562
Mathieu Chartiere401d142015-04-22 13:56:20 -0700563bool StackVisitor::GetNextMethodAndDexPc(ArtMethod** next_method, uint32_t* next_dex_pc) {
Ian Rogers5cf98192014-05-29 21:31:50 -0700564 struct HasMoreFramesVisitor : public StackVisitor {
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100565 HasMoreFramesVisitor(Thread* thread,
566 StackWalkKind walk_kind,
567 size_t num_frames,
568 size_t frame_height)
569 : StackVisitor(thread, nullptr, walk_kind, num_frames),
570 frame_height_(frame_height),
571 found_frame_(false),
572 has_more_frames_(false),
573 next_method_(nullptr),
574 next_dex_pc_(0) {
Ian Rogers5cf98192014-05-29 21:31:50 -0700575 }
576
Roland Levillainbbc6e7e2018-08-24 16:58:47 +0100577 bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
Ian Rogers5cf98192014-05-29 21:31:50 -0700578 if (found_frame_) {
Mathieu Chartiere401d142015-04-22 13:56:20 -0700579 ArtMethod* method = GetMethod();
Ian Rogers5cf98192014-05-29 21:31:50 -0700580 if (method != nullptr && !method->IsRuntimeMethod()) {
581 has_more_frames_ = true;
582 next_method_ = method;
583 next_dex_pc_ = GetDexPc();
584 return false; // End stack walk once next method is found.
585 }
586 } else if (GetFrameHeight() == frame_height_) {
587 found_frame_ = true;
588 }
589 return true;
590 }
591
592 size_t frame_height_;
593 bool found_frame_;
594 bool has_more_frames_;
Mathieu Chartiere401d142015-04-22 13:56:20 -0700595 ArtMethod* next_method_;
Ian Rogers5cf98192014-05-29 21:31:50 -0700596 uint32_t next_dex_pc_;
597 };
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100598 HasMoreFramesVisitor visitor(thread_, walk_kind_, GetNumFrames(), GetFrameHeight());
Ian Rogers5cf98192014-05-29 21:31:50 -0700599 visitor.WalkStack(true);
600 *next_method = visitor.next_method_;
601 *next_dex_pc = visitor.next_dex_pc_;
602 return visitor.has_more_frames_;
603}
604
Ian Rogers7a22fa62013-01-23 12:16:16 -0800605void StackVisitor::DescribeStack(Thread* thread) {
Ian Rogers306057f2012-11-26 12:45:53 -0800606 struct DescribeStackVisitor : public StackVisitor {
Andreas Gampe277ccbd2014-11-03 21:36:10 -0800607 explicit DescribeStackVisitor(Thread* thread_in)
Nicolas Geoffray8e5bd182015-05-06 11:34:34 +0100608 : StackVisitor(thread_in, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames) {}
Ian Rogers306057f2012-11-26 12:45:53 -0800609
Roland Levillainbbc6e7e2018-08-24 16:58:47 +0100610 bool VisitFrame() override REQUIRES_SHARED(Locks::mutator_lock_) {
Ian Rogers306057f2012-11-26 12:45:53 -0800611 LOG(INFO) << "Frame Id=" << GetFrameId() << " " << DescribeLocation();
612 return true;
613 }
614 };
Ian Rogers7a22fa62013-01-23 12:16:16 -0800615 DescribeStackVisitor visitor(thread);
Ian Rogers306057f2012-11-26 12:45:53 -0800616 visitor.WalkStack(true);
617}
618
Ian Rogers40e3bac2012-11-20 00:09:14 -0800619std::string StackVisitor::DescribeLocation() const {
620 std::string result("Visiting method '");
Mathieu Chartiere401d142015-04-22 13:56:20 -0700621 ArtMethod* m = GetMethod();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700622 if (m == nullptr) {
Ian Rogers306057f2012-11-26 12:45:53 -0800623 return "upcall";
624 }
David Sehr709b0702016-10-13 09:12:37 -0700625 result += m->PrettyMethod();
Ian Rogersef7d42f2014-01-06 12:55:46 -0800626 result += StringPrintf("' at dex PC 0x%04x", GetDexPc());
Ian Rogers40e3bac2012-11-20 00:09:14 -0800627 if (!IsShadowFrame()) {
628 result += StringPrintf(" (native PC %p)", reinterpret_cast<void*>(GetCurrentQuickFramePc()));
629 }
630 return result;
631}
632
Alex Lightdba61482016-12-21 08:20:29 -0800633void StackVisitor::SetMethod(ArtMethod* method) {
634 DCHECK(GetMethod() != nullptr);
635 if (cur_shadow_frame_ != nullptr) {
636 cur_shadow_frame_->SetMethod(method);
637 } else {
638 DCHECK(cur_quick_frame_ != nullptr);
Nicolas Geoffray226805d2018-12-14 10:59:02 +0000639 CHECK(!IsInInlinedFrame()) << "We do not support setting inlined method's ArtMethod: "
640 << GetMethod()->PrettyMethod() << " is inlined into "
641 << GetOuterMethod()->PrettyMethod();
Alex Light1ebe4fe2017-01-30 14:57:11 -0800642 *cur_quick_frame_ = method;
Alex Lightdba61482016-12-21 08:20:29 -0800643 }
644}
645
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100646static void AssertPcIsWithinQuickCode(ArtMethod* method, uintptr_t pc)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700647 REQUIRES_SHARED(Locks::mutator_lock_) {
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100648 if (method->IsNative() || method->IsRuntimeMethod() || method->IsProxyMethod()) {
649 return;
650 }
651
652 if (pc == reinterpret_cast<uintptr_t>(GetQuickInstrumentationExitPc())) {
653 return;
654 }
655
Mingyao Yang88ca8ba2017-05-23 14:21:07 -0700656 Runtime* runtime = Runtime::Current();
657 if (runtime->UseJitCompilation() &&
658 runtime->GetJit()->GetCodeCache()->ContainsPc(reinterpret_cast<const void*>(pc))) {
659 return;
660 }
661
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100662 const void* code = method->GetEntryPointFromQuickCompiledCode();
Alex Lightdb01a092017-04-03 15:39:55 -0700663 if (code == GetQuickInstrumentationEntryPoint() || code == GetInvokeObsoleteMethodStub()) {
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100664 return;
665 }
666
667 ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
668 if (class_linker->IsQuickToInterpreterBridge(code) ||
669 class_linker->IsQuickResolutionStub(code)) {
670 return;
671 }
672
Calin Juravleffc87072016-04-20 14:22:09 +0100673 if (runtime->UseJitCompilation() && runtime->GetJit()->GetCodeCache()->ContainsPc(code)) {
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100674 return;
675 }
676
Mingyao Yang063fc772016-08-02 11:02:54 -0700677 uint32_t code_size = OatQuickMethodHeader::FromEntryPoint(code)->GetCodeSize();
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100678 uintptr_t code_start = reinterpret_cast<uintptr_t>(code);
679 CHECK(code_start <= pc && pc <= (code_start + code_size))
David Sehr709b0702016-10-13 09:12:37 -0700680 << method->PrettyMethod()
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100681 << " pc=" << std::hex << pc
Roland Levillain0d5a2812015-11-13 10:07:31 +0000682 << " code_start=" << code_start
683 << " code_size=" << code_size;
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100684}
685
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700686void StackVisitor::SanityCheckFrame() const {
Ian Rogersef7d42f2014-01-06 12:55:46 -0800687 if (kIsDebugBuild) {
Mathieu Chartiere401d142015-04-22 13:56:20 -0700688 ArtMethod* method = GetMethod();
Vladimir Markod93e3742018-07-18 10:58:13 +0100689 ObjPtr<mirror::Class> declaring_class = method->GetDeclaringClass();
Mathieu Chartiere401d142015-04-22 13:56:20 -0700690 // Runtime methods have null declaring class.
691 if (!method->IsRuntimeMethod()) {
692 CHECK(declaring_class != nullptr);
693 CHECK_EQ(declaring_class->GetClass(), declaring_class->GetClass()->GetClass())
694 << declaring_class;
695 } else {
696 CHECK(declaring_class == nullptr);
697 }
Mathieu Chartier951ec2c2015-09-22 08:50:05 -0700698 Runtime* const runtime = Runtime::Current();
699 LinearAlloc* const linear_alloc = runtime->GetLinearAlloc();
700 if (!linear_alloc->Contains(method)) {
701 // Check class linker linear allocs.
Nicolas Geoffray48b40cc2017-08-07 16:52:40 +0100702 // We get the canonical method as copied methods may have their declaring
703 // class from another class loader.
704 ArtMethod* canonical = method->GetCanonicalMethod();
Vladimir Markod93e3742018-07-18 10:58:13 +0100705 ObjPtr<mirror::Class> klass = canonical->GetDeclaringClass();
Mathieu Chartier951ec2c2015-09-22 08:50:05 -0700706 LinearAlloc* const class_linear_alloc = (klass != nullptr)
Mathieu Chartier5b830502016-03-02 10:30:23 -0800707 ? runtime->GetClassLinker()->GetAllocatorForClassLoader(klass->GetClassLoader())
Mathieu Chartier951ec2c2015-09-22 08:50:05 -0700708 : linear_alloc;
Nicolas Geoffray48b40cc2017-08-07 16:52:40 +0100709 if (!class_linear_alloc->Contains(canonical)) {
Mathieu Chartier951ec2c2015-09-22 08:50:05 -0700710 // Check image space.
711 bool in_image = false;
712 for (auto& space : runtime->GetHeap()->GetContinuousSpaces()) {
713 if (space->IsImageSpace()) {
714 auto* image_space = space->AsImageSpace();
715 const auto& header = image_space->GetImageHeader();
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700716 const ImageSection& methods = header.GetMethodsSection();
717 const ImageSection& runtime_methods = header.GetRuntimeMethodsSection();
Nicolas Geoffray48b40cc2017-08-07 16:52:40 +0100718 const size_t offset = reinterpret_cast<const uint8_t*>(canonical) - image_space->Begin();
Mathieu Chartiere42888f2016-04-14 10:49:19 -0700719 if (methods.Contains(offset) || runtime_methods.Contains(offset)) {
Mathieu Chartier951ec2c2015-09-22 08:50:05 -0700720 in_image = true;
721 break;
722 }
Mathieu Chartiere401d142015-04-22 13:56:20 -0700723 }
724 }
Nicolas Geoffray48b40cc2017-08-07 16:52:40 +0100725 CHECK(in_image) << canonical->PrettyMethod() << " not in linear alloc or image";
Mathieu Chartiere401d142015-04-22 13:56:20 -0700726 }
Mathieu Chartiere401d142015-04-22 13:56:20 -0700727 }
Ian Rogersef7d42f2014-01-06 12:55:46 -0800728 if (cur_quick_frame_ != nullptr) {
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100729 AssertPcIsWithinQuickCode(method, cur_quick_frame_pc_);
Ian Rogersef7d42f2014-01-06 12:55:46 -0800730 // Frame sanity.
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100731 size_t frame_size = GetCurrentQuickFrameInfo().FrameSizeInBytes();
Ian Rogersef7d42f2014-01-06 12:55:46 -0800732 CHECK_NE(frame_size, 0u);
Andreas Gampe5b417b92014-03-10 14:18:35 -0700733 // A rough guess at an upper size we expect to see for a frame.
734 // 256 registers
Mathieu Chartiereb8167a2014-05-07 15:43:14 -0700735 // 2 words HandleScope overhead
Andreas Gampe5b417b92014-03-10 14:18:35 -0700736 // 3+3 register spills
737 // TODO: this seems architecture specific for the case of JNI frames.
Brian Carlstromed08bd42014-03-19 18:34:17 -0700738 // TODO: 083-compiler-regressions ManyFloatArgs shows this estimate is wrong.
739 // const size_t kMaxExpectedFrameSize = (256 + 2 + 3 + 3) * sizeof(word);
740 const size_t kMaxExpectedFrameSize = 2 * KB;
David Sehr709b0702016-10-13 09:12:37 -0700741 CHECK_LE(frame_size, kMaxExpectedFrameSize) << method->PrettyMethod();
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100742 size_t return_pc_offset = GetCurrentQuickFrameInfo().GetReturnPcOffset();
Ian Rogersef7d42f2014-01-06 12:55:46 -0800743 CHECK_LT(return_pc_offset, frame_size);
744 }
Ian Rogers0399dde2012-06-06 17:09:28 -0700745 }
Ian Rogers0399dde2012-06-06 17:09:28 -0700746}
747
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100748// Counts the number of references in the parameter list of the corresponding method.
749// Note: Thus does _not_ include "this" for non-static methods.
750static uint32_t GetNumberOfReferenceArgsWithoutReceiver(ArtMethod* method)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700751 REQUIRES_SHARED(Locks::mutator_lock_) {
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100752 uint32_t shorty_len;
753 const char* shorty = method->GetShorty(&shorty_len);
754 uint32_t refs = 0;
755 for (uint32_t i = 1; i < shorty_len ; ++i) {
756 if (shorty[i] == 'L') {
757 refs++;
758 }
759 }
760 return refs;
761}
762
763QuickMethodFrameInfo StackVisitor::GetCurrentQuickFrameInfo() const {
764 if (cur_oat_quick_method_header_ != nullptr) {
765 return cur_oat_quick_method_header_->GetFrameInfo();
766 }
767
768 ArtMethod* method = GetMethod();
769 Runtime* runtime = Runtime::Current();
770
771 if (method->IsAbstract()) {
Vladimir Markod3083dd2018-05-17 08:43:47 +0100772 return RuntimeCalleeSaveFrame::GetMethodFrameInfo(CalleeSaveType::kSaveRefsAndArgs);
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100773 }
774
775 // This goes before IsProxyMethod since runtime methods have a null declaring class.
776 if (method->IsRuntimeMethod()) {
777 return runtime->GetRuntimeMethodFrameInfo(method);
778 }
779
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100780 if (method->IsProxyMethod()) {
Nicolas Geoffray22cf3d32015-11-02 11:57:11 +0000781 // There is only one direct method of a proxy class: the constructor. A direct method is
782 // cloned from the original java.lang.reflect.Proxy and is executed as usual quick
783 // compiled method without any stubs. Therefore the method must have a OatQuickMethodHeader.
784 DCHECK(!method->IsDirect() && !method->IsConstructor())
785 << "Constructors of proxy classes must have a OatQuickMethodHeader";
Vladimir Markod3083dd2018-05-17 08:43:47 +0100786 return RuntimeCalleeSaveFrame::GetMethodFrameInfo(CalleeSaveType::kSaveRefsAndArgs);
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100787 }
788
Vladimir Marko2196c652017-11-30 16:16:07 +0000789 // The only remaining case is if the method is native and uses the generic JNI stub,
790 // called either directly or through some (resolution, instrumentation) trampoline.
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100791 DCHECK(method->IsNative());
Vladimir Marko2196c652017-11-30 16:16:07 +0000792 if (kIsDebugBuild) {
793 ClassLinker* class_linker = runtime->GetClassLinker();
794 const void* entry_point = runtime->GetInstrumentation()->GetQuickCodeFor(method,
795 kRuntimePointerSize);
796 CHECK(class_linker->IsQuickGenericJniStub(entry_point) ||
797 // The current entrypoint (after filtering out trampolines) may have changed
798 // from GenericJNI to JIT-compiled stub since we have entered this frame.
799 (runtime->GetJit() != nullptr &&
800 runtime->GetJit()->GetCodeCache()->ContainsPc(entry_point))) << method->PrettyMethod();
801 }
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100802 // Generic JNI frame.
803 uint32_t handle_refs = GetNumberOfReferenceArgsWithoutReceiver(method) + 1;
804 size_t scope_size = HandleScope::SizeOf(handle_refs);
Vladimir Markod3083dd2018-05-17 08:43:47 +0100805 constexpr QuickMethodFrameInfo callee_info =
806 RuntimeCalleeSaveFrame::GetMethodFrameInfo(CalleeSaveType::kSaveRefsAndArgs);
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100807
808 // Callee saves + handle scope + method ref + alignment
809 // Note: -sizeof(void*) since callee-save frame stores a whole method pointer.
810 size_t frame_size = RoundUp(
811 callee_info.FrameSizeInBytes() - sizeof(void*) + sizeof(ArtMethod*) + scope_size,
812 kStackAlignment);
813 return QuickMethodFrameInfo(frame_size, callee_info.CoreSpillMask(), callee_info.FpSpillMask());
814}
815
Andreas Gampe585da952016-12-02 14:52:29 -0800816template <StackVisitor::CountTransitions kCount>
Ian Rogers0399dde2012-06-06 17:09:28 -0700817void StackVisitor::WalkStack(bool include_transitions) {
Hiroshi Yamauchi02f365f2017-02-03 15:06:00 -0800818 if (check_suspended_) {
819 DCHECK(thread_ == Thread::Current() || thread_->IsSuspended());
820 }
Ian Rogers62d6c772013-02-27 08:32:07 -0800821 CHECK_EQ(cur_depth_, 0U);
822 bool exit_stubs_installed = Runtime::Current()->GetInstrumentation()->AreExitStubsInstalled();
Alex Lightb81a9842016-12-15 00:59:05 +0000823 uint32_t instrumentation_stack_depth = 0;
Sebastien Hertzb2feaaf2015-10-12 13:40:10 +0000824 size_t inlined_frames_count = 0;
Dave Allisonf9439142014-03-27 15:10:22 -0700825
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700826 for (const ManagedStack* current_fragment = thread_->GetManagedStack();
827 current_fragment != nullptr; current_fragment = current_fragment->GetLink()) {
Ian Rogers0399dde2012-06-06 17:09:28 -0700828 cur_shadow_frame_ = current_fragment->GetTopShadowFrame();
829 cur_quick_frame_ = current_fragment->GetTopQuickFrame();
Ian Rogers1d8cdbc2014-09-22 22:51:09 -0700830 cur_quick_frame_pc_ = 0;
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100831 cur_oat_quick_method_header_ = nullptr;
Dave Allisonf9439142014-03-27 15:10:22 -0700832
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700833 if (cur_quick_frame_ != nullptr) { // Handle quick stack frames.
Ian Rogers0399dde2012-06-06 17:09:28 -0700834 // Can't be both a shadow and a quick fragment.
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700835 DCHECK(current_fragment->GetTopShadowFrame() == nullptr);
Mathieu Chartiere401d142015-04-22 13:56:20 -0700836 ArtMethod* method = *cur_quick_frame_;
Vladimir Marko2196c652017-11-30 16:16:07 +0000837 DCHECK(method != nullptr);
838 bool header_retrieved = false;
839 if (method->IsNative()) {
840 // We do not have a PC for the first frame, so we cannot simply use
841 // ArtMethod::GetOatQuickMethodHeader() as we're unable to distinguish there
842 // between GenericJNI frame and JIT-compiled JNI stub; the entrypoint may have
843 // changed since the frame was entered. The top quick frame tag indicates
844 // GenericJNI here, otherwise it's either AOT-compiled or JNI-compiled JNI stub.
845 if (UNLIKELY(current_fragment->GetTopQuickFrameTag())) {
846 // The generic JNI does not have any method header.
847 cur_oat_quick_method_header_ = nullptr;
848 } else {
849 const void* existing_entry_point = method->GetEntryPointFromQuickCompiledCode();
850 CHECK(existing_entry_point != nullptr);
851 Runtime* runtime = Runtime::Current();
852 ClassLinker* class_linker = runtime->GetClassLinker();
853 // Check whether we can quickly get the header from the current entrypoint.
854 if (!class_linker->IsQuickGenericJniStub(existing_entry_point) &&
855 !class_linker->IsQuickResolutionStub(existing_entry_point) &&
856 existing_entry_point != GetQuickInstrumentationEntryPoint()) {
857 cur_oat_quick_method_header_ =
858 OatQuickMethodHeader::FromEntryPoint(existing_entry_point);
859 } else {
860 const void* code = method->GetOatMethodQuickCode(class_linker->GetImagePointerSize());
861 if (code != nullptr) {
862 cur_oat_quick_method_header_ = OatQuickMethodHeader::FromEntryPoint(code);
863 } else {
864 // This must be a JITted JNI stub frame.
865 CHECK(runtime->GetJit() != nullptr);
866 code = runtime->GetJit()->GetCodeCache()->GetJniStubCode(method);
867 CHECK(code != nullptr) << method->PrettyMethod();
868 cur_oat_quick_method_header_ = OatQuickMethodHeader::FromCodePointer(code);
869 }
870 }
871 }
872 header_retrieved = true;
873 }
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700874 while (method != nullptr) {
Vladimir Marko2196c652017-11-30 16:16:07 +0000875 if (!header_retrieved) {
876 cur_oat_quick_method_header_ = method->GetOatQuickMethodHeader(cur_quick_frame_pc_);
877 }
878 header_retrieved = false; // Force header retrieval in next iteration.
Dave Allison5cd33752014-04-15 15:57:58 -0700879 SanityCheckFrame();
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100880
Nicolas Geoffrayc6df1e32016-07-04 10:15:47 +0100881 if ((walk_kind_ == StackWalkKind::kIncludeInlinedFrames)
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100882 && (cur_oat_quick_method_header_ != nullptr)
David Srbeckyafc97bc2018-07-05 08:14:35 +0000883 && cur_oat_quick_method_header_->IsOptimized()
David Srbeckye42a4b92019-05-26 00:10:25 +0100884 && !method->IsNative() // JNI methods cannot have any inlined frames.
885 && CodeInfo::HasInlineInfo(cur_oat_quick_method_header_->GetOptimizedCodeInfoPtr())) {
David Srbeckyafc97bc2018-07-05 08:14:35 +0000886 DCHECK_NE(cur_quick_frame_pc_, 0u);
David Srbecky145a18a2019-06-03 14:35:22 +0100887 CodeInfo* code_info = GetCurrentInlineInfo();
888 StackMap* stack_map = GetCurrentStackMap();
889 if (stack_map->IsValid() && stack_map->HasInlineInfo()) {
David Srbecky93bd3612018-07-02 19:30:18 +0100890 DCHECK_EQ(current_inline_frames_.size(), 0u);
David Srbecky145a18a2019-06-03 14:35:22 +0100891 for (current_inline_frames_ = code_info->GetInlineInfosOf(*stack_map);
David Srbecky93bd3612018-07-02 19:30:18 +0100892 !current_inline_frames_.empty();
893 current_inline_frames_.pop_back()) {
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100894 bool should_continue = VisitFrame();
895 if (UNLIKELY(!should_continue)) {
896 return;
897 }
Nicolas Geoffrayd23eeef2015-05-18 22:31:29 +0100898 cur_depth_++;
Sebastien Hertzb2feaaf2015-10-12 13:40:10 +0000899 inlined_frames_count++;
Nicolas Geoffray57f61612015-05-15 13:20:41 +0100900 }
901 }
902 }
903
Dave Allison5cd33752014-04-15 15:57:58 -0700904 bool should_continue = VisitFrame();
905 if (UNLIKELY(!should_continue)) {
906 return;
Ian Rogers0399dde2012-06-06 17:09:28 -0700907 }
Dave Allison5cd33752014-04-15 15:57:58 -0700908
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100909 QuickMethodFrameInfo frame_info = GetCurrentQuickFrameInfo();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700910 if (context_ != nullptr) {
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100911 context_->FillCalleeSaves(reinterpret_cast<uint8_t*>(cur_quick_frame_), frame_info);
Ian Rogers0399dde2012-06-06 17:09:28 -0700912 }
Ian Rogers0399dde2012-06-06 17:09:28 -0700913 // Compute PC for next stack frame from return PC.
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100914 size_t frame_size = frame_info.FrameSizeInBytes();
915 size_t return_pc_offset = frame_size - sizeof(void*);
Ian Rogers13735952014-10-08 12:43:28 -0700916 uint8_t* return_pc_addr = reinterpret_cast<uint8_t*>(cur_quick_frame_) + return_pc_offset;
Ian Rogers0399dde2012-06-06 17:09:28 -0700917 uintptr_t return_pc = *reinterpret_cast<uintptr_t*>(return_pc_addr);
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100918
Alex Lightb32c6a92018-06-07 16:48:04 -0700919 if (UNLIKELY(exit_stubs_installed ||
920 reinterpret_cast<uintptr_t>(GetQuickInstrumentationExitPc()) == return_pc)) {
Ian Rogers0399dde2012-06-06 17:09:28 -0700921 // While profiling, the return pc is restored from the side stack, except when walking
922 // the stack for an exception where the side stack will be unwound in VisitFrame.
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700923 if (reinterpret_cast<uintptr_t>(GetQuickInstrumentationExitPc()) == return_pc) {
Andreas Gampe585da952016-12-02 14:52:29 -0800924 CHECK_LT(instrumentation_stack_depth, thread_->GetInstrumentationStack()->size());
Sebastien Hertz74e256b2013-10-04 10:40:37 +0200925 const instrumentation::InstrumentationStackFrame& instrumentation_frame =
Vladimir Marko35d5b8a2018-07-03 09:18:32 +0100926 (*thread_->GetInstrumentationStack())[instrumentation_stack_depth];
jeffhao725a9572012-11-13 18:20:12 -0800927 instrumentation_stack_depth++;
Vladimir Markofd36f1f2016-08-03 18:49:58 +0100928 if (GetMethod() ==
Andreas Gampe8228cdf2017-05-30 15:03:54 -0700929 Runtime::Current()->GetCalleeSaveMethod(CalleeSaveType::kSaveAllCalleeSaves)) {
Jeff Haofb2802d2013-07-24 13:53:05 -0700930 // Skip runtime save all callee frames which are used to deliver exceptions.
931 } else if (instrumentation_frame.interpreter_entry_) {
Vladimir Markofd36f1f2016-08-03 18:49:58 +0100932 ArtMethod* callee =
Andreas Gampe8228cdf2017-05-30 15:03:54 -0700933 Runtime::Current()->GetCalleeSaveMethod(CalleeSaveType::kSaveRefsAndArgs);
David Sehr709b0702016-10-13 09:12:37 -0700934 CHECK_EQ(GetMethod(), callee) << "Expected: " << ArtMethod::PrettyMethod(callee)
935 << " Found: " << ArtMethod::PrettyMethod(GetMethod());
Sebastien Hertzb2feaaf2015-10-12 13:40:10 +0000936 } else {
Alex Lighteee0bd42017-02-14 15:31:45 +0000937 // Instrumentation generally doesn't distinguish between a method's obsolete and
938 // non-obsolete version.
939 CHECK_EQ(instrumentation_frame.method_->GetNonObsoleteMethod(),
940 GetMethod()->GetNonObsoleteMethod())
941 << "Expected: "
942 << ArtMethod::PrettyMethod(instrumentation_frame.method_->GetNonObsoleteMethod())
943 << " Found: " << ArtMethod::PrettyMethod(GetMethod()->GetNonObsoleteMethod());
Ian Rogers62d6c772013-02-27 08:32:07 -0800944 }
945 if (num_frames_ != 0) {
946 // Check agreement of frame Ids only if num_frames_ is computed to avoid infinite
947 // recursion.
Sebastien Hertzb2feaaf2015-10-12 13:40:10 +0000948 size_t frame_id = instrumentation::Instrumentation::ComputeFrameId(
949 thread_,
950 cur_depth_,
951 inlined_frames_count);
952 CHECK_EQ(instrumentation_frame.frame_id_, frame_id);
Ian Rogers62d6c772013-02-27 08:32:07 -0800953 }
jeffhao725a9572012-11-13 18:20:12 -0800954 return_pc = instrumentation_frame.return_pc_;
Ian Rogers0399dde2012-06-06 17:09:28 -0700955 }
956 }
Nicolas Geoffray6bc43742015-10-12 18:11:10 +0100957
Ian Rogers0399dde2012-06-06 17:09:28 -0700958 cur_quick_frame_pc_ = return_pc;
Ian Rogers13735952014-10-08 12:43:28 -0700959 uint8_t* next_frame = reinterpret_cast<uint8_t*>(cur_quick_frame_) + frame_size;
Mathieu Chartiere401d142015-04-22 13:56:20 -0700960 cur_quick_frame_ = reinterpret_cast<ArtMethod**>(next_frame);
961
962 if (kDebugStackWalk) {
David Sehr709b0702016-10-13 09:12:37 -0700963 LOG(INFO) << ArtMethod::PrettyMethod(method) << "@" << method << " size=" << frame_size
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100964 << std::boolalpha
965 << " optimized=" << (cur_oat_quick_method_header_ != nullptr &&
966 cur_oat_quick_method_header_->IsOptimized())
Mathieu Chartiere401d142015-04-22 13:56:20 -0700967 << " native=" << method->IsNative()
Nicolas Geoffray524e7ea2015-10-16 17:13:34 +0100968 << std::noboolalpha
Mathieu Chartiere401d142015-04-22 13:56:20 -0700969 << " entrypoints=" << method->GetEntryPointFromQuickCompiledCode()
Alex Lighteee0bd42017-02-14 15:31:45 +0000970 << "," << (method->IsNative() ? method->GetEntryPointFromJni() : nullptr)
Mathieu Chartiere401d142015-04-22 13:56:20 -0700971 << " next=" << *cur_quick_frame_;
972 }
973
Andreas Gampef040be62017-04-14 21:49:33 -0700974 if (kCount == CountTransitions::kYes || !method->IsRuntimeMethod()) {
975 cur_depth_++;
976 }
Mathieu Chartiere401d142015-04-22 13:56:20 -0700977 method = *cur_quick_frame_;
jeffhao6641ea12013-01-02 18:13:42 -0800978 }
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700979 } else if (cur_shadow_frame_ != nullptr) {
Ian Rogers0399dde2012-06-06 17:09:28 -0700980 do {
981 SanityCheckFrame();
982 bool should_continue = VisitFrame();
983 if (UNLIKELY(!should_continue)) {
984 return;
985 }
986 cur_depth_++;
987 cur_shadow_frame_ = cur_shadow_frame_->GetLink();
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700988 } while (cur_shadow_frame_ != nullptr);
Ian Rogers0399dde2012-06-06 17:09:28 -0700989 }
Ian Rogers0399dde2012-06-06 17:09:28 -0700990 if (include_transitions) {
991 bool should_continue = VisitFrame();
992 if (!should_continue) {
993 return;
994 }
995 }
Andreas Gampe585da952016-12-02 14:52:29 -0800996 if (kCount == CountTransitions::kYes) {
997 cur_depth_++;
998 }
Ian Rogers62d6c772013-02-27 08:32:07 -0800999 }
1000 if (num_frames_ != 0) {
1001 CHECK_EQ(cur_depth_, num_frames_);
Ian Rogers0399dde2012-06-06 17:09:28 -07001002 }
1003}
1004
Andreas Gampe585da952016-12-02 14:52:29 -08001005template void StackVisitor::WalkStack<StackVisitor::CountTransitions::kYes>(bool);
1006template void StackVisitor::WalkStack<StackVisitor::CountTransitions::kNo>(bool);
1007
Elliott Hughes68e76522011-10-05 13:22:16 -07001008} // namespace art