From 8e5bd18fc665d7ec5461ea068e98740a65da754c Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 6 May 2015 11:34:34 +0100 Subject: Add a flag to StackVisitor for inlining. The flag tells whether the stack walk needs to include inlined Java frames. This does not do anything just yet, as we're not inlining anyways. Change-Id: I716e25094fe56fa335ca1f9a398c1bcdba478e73 --- runtime/quick_exception_handler.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'runtime/quick_exception_handler.cc') diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index 9e79bd20cb..730759a71b 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -46,7 +46,9 @@ class CatchBlockStackVisitor FINAL : public StackVisitor { CatchBlockStackVisitor(Thread* self, Context* context, Handle* exception, QuickExceptionHandler* exception_handler) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) - : StackVisitor(self, context), self_(self), exception_(exception), + : StackVisitor(self, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames), + self_(self), + exception_(exception), exception_handler_(exception_handler) { } @@ -160,7 +162,9 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { public: DeoptimizeStackVisitor(Thread* self, Context* context, QuickExceptionHandler* exception_handler) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) - : StackVisitor(self, context), self_(self), exception_handler_(exception_handler), + : StackVisitor(self, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames), + self_(self), + exception_handler_(exception_handler), prev_shadow_frame_(nullptr) { CHECK(!self_->HasDeoptimizationShadowFrame()); } @@ -338,7 +342,7 @@ class InstrumentationStackVisitor : public StackVisitor { public: InstrumentationStackVisitor(Thread* self, size_t frame_depth) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) - : StackVisitor(self, nullptr), + : StackVisitor(self, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames), frame_depth_(frame_depth), instrumentation_frames_to_pop_(0) { CHECK_NE(frame_depth_, kInvalidFrameDepth); @@ -349,7 +353,12 @@ class InstrumentationStackVisitor : public StackVisitor { if (current_frame_depth < frame_depth_) { CHECK(GetMethod() != nullptr); if (UNLIKELY(reinterpret_cast(GetQuickInstrumentationExitPc()) == GetReturnPc())) { - ++instrumentation_frames_to_pop_; + if (!IsInInlinedFrame()) { + // We do not count inlined frames, because we do not instrument them. The reason we + // include them in the stack walking is the check against `frame_depth_`, which is + // given to us by a visitor that visits inlined frames. + ++instrumentation_frames_to_pop_; + } } return true; } else { -- cgit v1.2.3-59-g8ed1b