Use the current Java stack instead of the ThrowLocation.
The ThrowLocation contains information we can actually retrieve
from the current stack.
Change-Id: I7e5b2f519f95830c457cb31ea10a581aa9c973ee
diff --git a/runtime/thread.cc b/runtime/thread.cc
index e31af16..94d1059 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1730,21 +1730,21 @@
ThrowNewWrappedException(throw_location, exception_class_descriptor, msg);
}
-static mirror::ClassLoader* GetClassLoaderFromThrowLocation(const ThrowLocation& throw_location)
+static mirror::ClassLoader* GetCurrentClassLoader(Thread* self)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return throw_location.GetMethod() != nullptr
- ? throw_location.GetMethod()->GetDeclaringClass()->GetClassLoader()
+ mirror::ArtMethod* method = self->GetCurrentMethod(nullptr);
+ return method != nullptr
+ ? method->GetDeclaringClass()->GetClassLoader()
: nullptr;
}
-void Thread::ThrowNewWrappedException(const ThrowLocation& throw_location,
+void Thread::ThrowNewWrappedException(const ThrowLocation& throw_location ATTRIBUTE_UNUSED,
const char* exception_class_descriptor,
const char* msg) {
DCHECK_EQ(this, Thread::Current());
ScopedObjectAccessUnchecked soa(this);
StackHandleScope<3> hs(soa.Self());
- Handle<mirror::ClassLoader> class_loader(
- hs.NewHandle(GetClassLoaderFromThrowLocation(throw_location)));
+ Handle<mirror::ClassLoader> class_loader(hs.NewHandle(GetCurrentClassLoader(soa.Self())));
ScopedLocalRef<jobject> cause(GetJniEnv(), soa.AddLocalReference<jobject>(GetException()));
ClearException();
Runtime* runtime = Runtime::Current();