diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-03-05 10:40:17 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-03-09 10:09:33 +0000 |
commit | 14691c5e786e8c2c5734f687e4c96217340771be (patch) | |
tree | 7c2156671b323c70ffdd1d48d5e2f1d1de79c5fc /runtime/mirror | |
parent | 3d7d2af4c6502b771b032ee9bf3ab30e78f9c60d (diff) | |
download | art-14691c5e786e8c2c5734f687e4c96217340771be.tar.gz art-14691c5e786e8c2c5734f687e4c96217340771be.tar.bz2 art-14691c5e786e8c2c5734f687e4c96217340771be.zip |
Compute the right catch location for the debugger.
Also remove tls ThrowLocation, it is not needed anymore.
Change-Id: I78fddf09ce968ca475e39c17fa76d699c589c8d9
Diffstat (limited to 'runtime/mirror')
-rw-r--r-- | runtime/mirror/art_method.cc | 7 | ||||
-rw-r--r-- | runtime/mirror/class.cc | 12 | ||||
-rw-r--r-- | runtime/mirror/object_test.cc | 18 |
3 files changed, 15 insertions, 22 deletions
diff --git a/runtime/mirror/art_method.cc b/runtime/mirror/art_method.cc index 85fc5f3c9..bc5870980 100644 --- a/runtime/mirror/art_method.cc +++ b/runtime/mirror/art_method.cc @@ -271,9 +271,8 @@ uint32_t ArtMethod::FindCatchBlock(Handle<ArtMethod> h_this, Handle<Class> excep const DexFile::CodeItem* code_item = h_this->GetCodeItem(); // Set aside the exception while we resolve its type. Thread* self = Thread::Current(); - ThrowLocation throw_location; StackHandleScope<1> hs(self); - Handle<mirror::Throwable> exception(hs.NewHandle(self->GetException(&throw_location))); + Handle<mirror::Throwable> exception(hs.NewHandle(self->GetException())); self->ClearException(); // Default to handler not found. uint32_t found_dex_pc = DexFile::kDexNoIndex; @@ -309,7 +308,7 @@ uint32_t ArtMethod::FindCatchBlock(Handle<ArtMethod> h_this, Handle<Class> excep } // Put the exception back. if (exception.Get() != nullptr) { - self->SetException(throw_location, exception.Get()); + self->SetException(exception.Get()); } return found_dex_pc; } @@ -434,7 +433,7 @@ void ArtMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* #else (*art_quick_invoke_stub)(this, args, args_size, self, result, shorty); #endif - if (UNLIKELY(self->GetException(nullptr) == Thread::GetDeoptimizationException())) { + if (UNLIKELY(self->GetException() == Thread::GetDeoptimizationException())) { // Unusual case where we were running generated code and an // exception was thrown to force the activations to be removed from the // stack. Continue execution in the interpreter. diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc index 96b15dd67..6f4ef60e8 100644 --- a/runtime/mirror/class.cc +++ b/runtime/mirror/class.cc @@ -77,13 +77,9 @@ void Class::SetStatus(Status new_status, Thread* self) { << "Attempt to set as erroneous an already erroneous class " << PrettyClass(this); // Stash current exception. - StackHandleScope<3> hs(self); - ThrowLocation old_throw_location; - Handle<mirror::Throwable> old_exception(hs.NewHandle(self->GetException(&old_throw_location))); + StackHandleScope<1> hs(self); + Handle<mirror::Throwable> old_exception(hs.NewHandle(self->GetException())); CHECK(old_exception.Get() != nullptr); - Handle<mirror::Object> old_throw_this_object(hs.NewHandle(old_throw_location.GetThis())); - Handle<mirror::ArtMethod> old_throw_method(hs.NewHandle(old_throw_location.GetMethod())); - uint32_t old_throw_dex_pc = old_throw_location.GetDexPc(); Class* eiie_class; // Do't attempt to use FindClass if we have an OOM error since this can try to do more // allocations and may cause infinite loops. @@ -109,9 +105,7 @@ void Class::SetStatus(Status new_status, Thread* self) { } // Restore exception. - ThrowLocation gc_safe_throw_location(old_throw_this_object.Get(), old_throw_method.Get(), - old_throw_dex_pc); - self->SetException(gc_safe_throw_location, old_exception.Get()); + self->SetException(old_exception.Get()); } static_assert(sizeof(Status) == sizeof(uint32_t), "Size of status not equal to uint32"); if (Runtime::Current()->IsActiveTransaction()) { diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc index 9b345a65d..21972a1cc 100644 --- a/runtime/mirror/object_test.cc +++ b/runtime/mirror/object_test.cc @@ -124,12 +124,12 @@ TEST_F(ObjectTest, AllocObjectArray) { EXPECT_TRUE(oa->Get(-1) == NULL); EXPECT_TRUE(soa.Self()->IsExceptionPending()); - EXPECT_EQ(aioobe, soa.Self()->GetException(NULL)->GetClass()); + EXPECT_EQ(aioobe, soa.Self()->GetException()->GetClass()); soa.Self()->ClearException(); EXPECT_TRUE(oa->Get(2) == NULL); EXPECT_TRUE(soa.Self()->IsExceptionPending()); - EXPECT_EQ(aioobe, soa.Self()->GetException(NULL)->GetClass()); + EXPECT_EQ(aioobe, soa.Self()->GetException()->GetClass()); soa.Self()->ClearException(); ASSERT_TRUE(oa->GetClass() != NULL); @@ -213,12 +213,12 @@ void TestPrimitiveArray(ClassLinker* cl) { EXPECT_EQ(0, a->Get(-1)); EXPECT_TRUE(soa.Self()->IsExceptionPending()); - EXPECT_EQ(aioobe, soa.Self()->GetException(NULL)->GetClass()); + EXPECT_EQ(aioobe, soa.Self()->GetException()->GetClass()); soa.Self()->ClearException(); EXPECT_EQ(0, a->Get(2)); EXPECT_TRUE(soa.Self()->IsExceptionPending()); - EXPECT_EQ(aioobe, soa.Self()->GetException(NULL)->GetClass()); + EXPECT_EQ(aioobe, soa.Self()->GetException()->GetClass()); soa.Self()->ClearException(); } @@ -262,12 +262,12 @@ TEST_F(ObjectTest, PrimitiveArray_Double_Alloc) { EXPECT_DOUBLE_EQ(0, a->Get(-1)); EXPECT_TRUE(soa.Self()->IsExceptionPending()); - EXPECT_EQ(aioobe, soa.Self()->GetException(NULL)->GetClass()); + EXPECT_EQ(aioobe, soa.Self()->GetException()->GetClass()); soa.Self()->ClearException(); EXPECT_DOUBLE_EQ(0, a->Get(2)); EXPECT_TRUE(soa.Self()->IsExceptionPending()); - EXPECT_EQ(aioobe, soa.Self()->GetException(NULL)->GetClass()); + EXPECT_EQ(aioobe, soa.Self()->GetException()->GetClass()); soa.Self()->ClearException(); } @@ -292,12 +292,12 @@ TEST_F(ObjectTest, PrimitiveArray_Float_Alloc) { EXPECT_FLOAT_EQ(0, a->Get(-1)); EXPECT_TRUE(soa.Self()->IsExceptionPending()); - EXPECT_EQ(aioobe, soa.Self()->GetException(NULL)->GetClass()); + EXPECT_EQ(aioobe, soa.Self()->GetException()->GetClass()); soa.Self()->ClearException(); EXPECT_FLOAT_EQ(0, a->Get(2)); EXPECT_TRUE(soa.Self()->IsExceptionPending()); - EXPECT_EQ(aioobe, soa.Self()->GetException(NULL)->GetClass()); + EXPECT_EQ(aioobe, soa.Self()->GetException()->GetClass()); soa.Self()->ClearException(); } @@ -335,7 +335,7 @@ TEST_F(ObjectTest, CreateMultiArray) { dims->Set<false>(0, -1); multi = Array::CreateMultiArray(soa.Self(), c, dims); EXPECT_TRUE(soa.Self()->IsExceptionPending()); - EXPECT_EQ(PrettyDescriptor(soa.Self()->GetException(NULL)->GetClass()), + EXPECT_EQ(PrettyDescriptor(soa.Self()->GetException()->GetClass()), "java.lang.NegativeArraySizeException"); soa.Self()->ClearException(); |