summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-07-25 10:37:19 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-07-23 18:04:01 +0000
commite2f654a463976f811c5358fc0de68c0492601274 (patch)
tree67b810cb82e972f304c32e9592d0b7c41af9e599
parentb7563b641059bcff82eb4624edb806a7ce7f39c0 (diff)
parentf9df5c1639a9418fcdf70476556a4c30b210701e (diff)
downloadart-e2f654a463976f811c5358fc0de68c0492601274.zip
art-e2f654a463976f811c5358fc0de68c0492601274.tar.gz
art-e2f654a463976f811c5358fc0de68c0492601274.tar.bz2
Merge "ART: Fix wrong CHECK in GetCurrentLocationForThrow"
-rw-r--r--runtime/monitor_android.cc1
-rw-r--r--runtime/thread.cc13
2 files changed, 7 insertions, 7 deletions
diff --git a/runtime/monitor_android.cc b/runtime/monitor_android.cc
index c46efd8..d89290b 100644
--- a/runtime/monitor_android.cc
+++ b/runtime/monitor_android.cc
@@ -79,7 +79,6 @@ void Monitor::LogContentionEvent(Thread* self, uint32_t wait_ms, uint32_t sample
// Emit the source code file name, <= 37 bytes.
uint32_t pc;
mirror::ArtMethod* m = self->GetCurrentMethod(&pc);
- CHECK_NE(pc, DexFile::kDexNoIndex); // TODO: Can we relax this check?
const char* filename;
uint32_t line_number;
TranslateLocation(m, pc, &filename, &line_number);
diff --git a/runtime/thread.cc b/runtime/thread.cc
index f041263..ddba708 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1975,9 +1975,10 @@ Context* Thread::GetLongJumpContext() {
// Note: this visitor may return with a method set, but dex_pc_ being DexFile:kDexNoIndex. This is
// so we don't abort in a special situation (thinlocked monitor) when dumping the Java stack.
struct CurrentMethodVisitor FINAL : public StackVisitor {
- CurrentMethodVisitor(Thread* thread, Context* context)
+ CurrentMethodVisitor(Thread* thread, Context* context, bool fail_on_error)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
- : StackVisitor(thread, context), this_object_(nullptr), method_(nullptr), dex_pc_(0) {}
+ : StackVisitor(thread, context), this_object_(nullptr), method_(nullptr), dex_pc_(0),
+ fail_on_error_(fail_on_error) {}
bool VisitFrame() OVERRIDE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
mirror::ArtMethod* m = GetMethod();
if (m->IsRuntimeMethod()) {
@@ -1988,16 +1989,17 @@ struct CurrentMethodVisitor FINAL : public StackVisitor {
this_object_ = GetThisObject();
}
method_ = m;
- dex_pc_ = GetDexPc(false); // We may not have a valid PC. Let the caller deal with it.
+ dex_pc_ = GetDexPc(fail_on_error_);
return false;
}
mirror::Object* this_object_;
mirror::ArtMethod* method_;
uint32_t dex_pc_;
+ const bool fail_on_error_;
};
mirror::ArtMethod* Thread::GetCurrentMethod(uint32_t* dex_pc) const {
- CurrentMethodVisitor visitor(const_cast<Thread*>(this), nullptr);
+ CurrentMethodVisitor visitor(const_cast<Thread*>(this), nullptr, false);
visitor.WalkStack(false);
if (dex_pc != nullptr) {
*dex_pc = visitor.dex_pc_;
@@ -2007,9 +2009,8 @@ mirror::ArtMethod* Thread::GetCurrentMethod(uint32_t* dex_pc) const {
ThrowLocation Thread::GetCurrentLocationForThrow() {
Context* context = GetLongJumpContext();
- CurrentMethodVisitor visitor(this, context);
+ CurrentMethodVisitor visitor(this, context, true);
visitor.WalkStack(false);
- CHECK_NE(visitor.dex_pc_, DexFile::kDexNoIndex); // TODO: Can we relax this?
ReleaseLongJumpContext(context);
return ThrowLocation(visitor.this_object_, visitor.method_, visitor.dex_pc_);
}