summaryrefslogtreecommitdiff
path: root/runtime/quick_exception_handler.cc
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2015-09-15 09:52:07 +0200
committerSebastien Hertz <shertz@google.com>2015-09-15 11:15:12 +0200
commit26f728661a08062a373a3203b72dc2555c2aed2d (patch)
tree4f6e8168ac7ca422c7de3c7cdda6db21958358fd /runtime/quick_exception_handler.cc
parentb6f7dd330f115fc977d1d5a10122c41c9dd7c210 (diff)
Cleanup thread access in StackVisitor
Adds method StackVisitor::GetThread to give access to the visited Thread* so we no longer need to copy that pointer in subclasses. Also adds a few missing const and DISALLOW_COPY_AND_ASSIGN. Change-Id: I57649ee7742ef4ef1e01447ac2fbb66f977b22eb
Diffstat (limited to 'runtime/quick_exception_handler.cc')
-rw-r--r--runtime/quick_exception_handler.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index 60defbaaa3..57c6866aa8 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -47,7 +47,6 @@ class CatchBlockStackVisitor FINAL : public StackVisitor {
QuickExceptionHandler* exception_handler)
SHARED_REQUIRES(Locks::mutator_lock_)
: StackVisitor(self, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
- self_(self),
exception_(exception),
exception_handler_(exception_handler) {
}
@@ -90,7 +89,7 @@ class CatchBlockStackVisitor FINAL : public StackVisitor {
}
if (dex_pc != DexFile::kDexNoIndex) {
bool clear_exception = false;
- StackHandleScope<1> hs(self_);
+ StackHandleScope<1> hs(GetThread());
Handle<mirror::Class> to_find(hs.NewHandle((*exception_)->GetClass()));
uint32_t found_dex_pc = method->FindCatchBlock(to_find, dex_pc, &clear_exception);
exception_handler_->SetClearException(clear_exception);
@@ -105,7 +104,6 @@ class CatchBlockStackVisitor FINAL : public StackVisitor {
return true; // Continue stack walk.
}
- Thread* const self_;
// The exception we're looking for the catch block of.
Handle<mirror::Throwable>* exception_;
// The quick exception handler we're visiting for.
@@ -154,7 +152,6 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor {
DeoptimizeStackVisitor(Thread* self, Context* context, QuickExceptionHandler* exception_handler)
SHARED_REQUIRES(Locks::mutator_lock_)
: StackVisitor(self, context, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
- self_(self),
exception_handler_(exception_handler),
prev_shadow_frame_(nullptr),
stacked_shadow_frame_pushed_(false) {
@@ -171,7 +168,8 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor {
// In case there is no deoptimized shadow frame for this upcall, we still
// need to push a nullptr to the stack since there is always a matching pop after
// the long jump.
- self_->PushStackedShadowFrame(nullptr, StackedShadowFrameType::kDeoptimizationShadowFrame);
+ GetThread()->PushStackedShadowFrame(nullptr,
+ StackedShadowFrameType::kDeoptimizationShadowFrame);
stacked_shadow_frame_pushed_ = true;
}
return false; // End stack walk.
@@ -200,18 +198,19 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor {
CHECK(code_item != nullptr) << "No code item for " << PrettyMethod(m);
uint16_t num_regs = code_item->registers_size_;
uint32_t dex_pc = GetDexPc();
- StackHandleScope<2> hs(self_); // Dex cache, class loader and method.
+ StackHandleScope<2> hs(GetThread()); // Dex cache, class loader and method.
mirror::Class* declaring_class = m->GetDeclaringClass();
Handle<mirror::DexCache> h_dex_cache(hs.NewHandle(declaring_class->GetDexCache()));
Handle<mirror::ClassLoader> h_class_loader(hs.NewHandle(declaring_class->GetClassLoader()));
- verifier::MethodVerifier verifier(self_, h_dex_cache->GetDexFile(), h_dex_cache, h_class_loader,
- &m->GetClassDef(), code_item, m->GetDexMethodIndex(),
- m, m->GetAccessFlags(), true, true, true, true);
+ verifier::MethodVerifier verifier(GetThread(), h_dex_cache->GetDexFile(), h_dex_cache,
+ h_class_loader, &m->GetClassDef(), code_item,
+ m->GetDexMethodIndex(), m, m->GetAccessFlags(), true, true,
+ true, true);
bool verifier_success = verifier.Verify();
CHECK(verifier_success) << PrettyMethod(m);
ShadowFrame* new_frame = ShadowFrame::CreateDeoptimizedFrame(num_regs, nullptr, m, dex_pc);
{
- ScopedStackedShadowFramePusher pusher(self_, new_frame,
+ ScopedStackedShadowFramePusher pusher(GetThread(), new_frame,
StackedShadowFrameType::kShadowFrameUnderConstruction);
const std::vector<int32_t> kinds(verifier.DescribeVRegs(dex_pc));
@@ -318,13 +317,13 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor {
// Will be popped after the long jump after DeoptimizeStack(),
// right before interpreter::EnterInterpreterFromDeoptimize().
stacked_shadow_frame_pushed_ = true;
- self_->PushStackedShadowFrame(new_frame, StackedShadowFrameType::kDeoptimizationShadowFrame);
+ GetThread()->PushStackedShadowFrame(new_frame,
+ StackedShadowFrameType::kDeoptimizationShadowFrame);
}
prev_shadow_frame_ = new_frame;
return true;
}
- Thread* const self_;
QuickExceptionHandler* const exception_handler_;
ShadowFrame* prev_shadow_frame_;
bool stacked_shadow_frame_pushed_;