summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/Android.mk1
-rw-r--r--runtime/class_linker.cc16
-rw-r--r--runtime/common_throws.cc191
-rw-r--r--runtime/common_throws.h20
-rw-r--r--runtime/debugger.cc1
-rw-r--r--runtime/debugger.h1
-rw-r--r--runtime/entrypoints/entrypoint_utils-inl.h12
-rw-r--r--runtime/entrypoints/entrypoint_utils.cc26
-rw-r--r--runtime/entrypoints/quick/quick_field_entrypoints.cc36
-rw-r--r--runtime/entrypoints/quick/quick_lock_entrypoints.cc8
-rw-r--r--runtime/entrypoints/quick/quick_throw_entrypoints.cc7
-rw-r--r--runtime/instrumentation.h1
-rw-r--r--runtime/interpreter/interpreter_common.cc36
-rw-r--r--runtime/interpreter/interpreter_common.h4
-rw-r--r--runtime/interpreter/interpreter_goto_table_impl.cc42
-rw-r--r--runtime/interpreter/interpreter_switch_impl.cc42
-rw-r--r--runtime/java_vm_ext.cc3
-rw-r--r--runtime/jit/jit_instrumentation.h1
-rw-r--r--runtime/jni_internal.cc18
-rw-r--r--runtime/mirror/object_array-inl.h3
-rw-r--r--runtime/monitor.cc9
-rw-r--r--runtime/native/dalvik_system_VMDebug.cc8
-rw-r--r--runtime/native/dalvik_system_VMRuntime.cc6
-rw-r--r--runtime/native/java_lang_Class.cc3
-rw-r--r--runtime/native/java_lang_String.cc2
-rw-r--r--runtime/native/java_lang_System.cc13
-rw-r--r--runtime/native/java_lang_Thread.cc2
-rw-r--r--runtime/native/java_lang_reflect_Constructor.cc3
-rw-r--r--runtime/native/java_lang_reflect_Field.cc20
-rw-r--r--runtime/quick_exception_handler.h1
-rw-r--r--runtime/reflection-inl.h8
-rw-r--r--runtime/reflection.cc43
-rw-r--r--runtime/reflection.h6
-rw-r--r--runtime/runtime.cc4
-rw-r--r--runtime/stack.cc5
-rw-r--r--runtime/stack.h4
-rw-r--r--runtime/thread.cc29
-rw-r--r--runtime/thread.h18
-rw-r--r--runtime/throw_location.cc46
-rw-r--r--runtime/throw_location.h93
-rw-r--r--runtime/transaction.cc3
41 files changed, 254 insertions, 541 deletions
diff --git a/runtime/Android.mk b/runtime/Android.mk
index c5cf890..ffea6f2 100644
--- a/runtime/Android.mk
+++ b/runtime/Android.mk
@@ -151,7 +151,6 @@ LIBART_COMMON_SRC_FILES := \
thread.cc \
thread_list.cc \
thread_pool.cc \
- throw_location.cc \
trace.cc \
transaction.cc \
profiler.cc \
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index f0c8819..afb2a06 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -82,8 +82,7 @@ static void ThrowNoClassDefFoundError(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
Thread* self = Thread::Current();
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewExceptionV(throw_location, "Ljava/lang/NoClassDefFoundError;", fmt, args);
+ self->ThrowNewExceptionV("Ljava/lang/NoClassDefFoundError;", fmt, args);
va_end(args);
}
@@ -105,14 +104,13 @@ static void ThrowEarlierClassFailure(mirror::Class* c)
mirror::Throwable* pre_allocated = runtime->GetPreAllocatedNoClassDefFoundError();
self->SetException(pre_allocated);
} else {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
if (c->GetVerifyErrorClass() != NULL) {
// TODO: change the verifier to store an _instance_, with a useful detail message?
std::string temp;
- self->ThrowNewException(throw_location, c->GetVerifyErrorClass()->GetDescriptor(&temp),
+ self->ThrowNewException(c->GetVerifyErrorClass()->GetDescriptor(&temp),
PrettyDescriptor(c).c_str());
} else {
- self->ThrowNewException(throw_location, "Ljava/lang/NoClassDefFoundError;",
+ self->ThrowNewException("Ljava/lang/NoClassDefFoundError;",
PrettyDescriptor(c).c_str());
}
}
@@ -141,9 +139,7 @@ static void WrapExceptionInInitializer(Handle<mirror::Class> klass)
// We only wrap non-Error exceptions; an Error can just be used as-is.
if (!is_error) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewWrappedException(throw_location, "Ljava/lang/ExceptionInInitializerError;",
- nullptr);
+ self->ThrowNewWrappedException("Ljava/lang/ExceptionInInitializerError;", nullptr);
}
VlogClassInitializationFailure(klass);
}
@@ -2259,8 +2255,8 @@ mirror::Class* ClassLinker::FindClass(Thread* self, const char* descriptor,
return nullptr;
} else if (result.get() == nullptr) {
// broken loader - throw NPE to be compatible with Dalvik
- ThrowNullPointerException(nullptr, StringPrintf("ClassLoader.loadClass returned null for %s",
- class_name_string.c_str()).c_str());
+ ThrowNullPointerException(StringPrintf("ClassLoader.loadClass returned null for %s",
+ class_name_string.c_str()).c_str());
return nullptr;
} else {
// success, return mirror::Class*
diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc
index f5b4354..36de221 100644
--- a/runtime/common_throws.cc
+++ b/runtime/common_throws.cc
@@ -43,7 +43,7 @@ static void AddReferrerLocation(std::ostream& os, mirror::Class* referrer)
}
}
-static void ThrowException(const ThrowLocation* throw_location, const char* exception_descriptor,
+static void ThrowException(const char* exception_descriptor,
mirror::Class* referrer, const char* fmt, va_list* args = NULL)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::ostringstream msg;
@@ -56,16 +56,10 @@ static void ThrowException(const ThrowLocation* throw_location, const char* exce
}
AddReferrerLocation(msg, referrer);
Thread* self = Thread::Current();
- if (throw_location == NULL) {
- ThrowLocation computed_throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewException(computed_throw_location, exception_descriptor, msg.str().c_str());
- } else {
- self->ThrowNewException(*throw_location, exception_descriptor, msg.str().c_str());
- }
+ self->ThrowNewException(exception_descriptor, msg.str().c_str());
}
-static void ThrowWrappedException(const ThrowLocation* throw_location,
- const char* exception_descriptor,
+static void ThrowWrappedException(const char* exception_descriptor,
mirror::Class* referrer, const char* fmt, va_list* args = NULL)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::ostringstream msg;
@@ -78,18 +72,13 @@ static void ThrowWrappedException(const ThrowLocation* throw_location,
}
AddReferrerLocation(msg, referrer);
Thread* self = Thread::Current();
- if (throw_location == NULL) {
- ThrowLocation computed_throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewWrappedException(computed_throw_location, exception_descriptor, msg.str().c_str());
- } else {
- self->ThrowNewWrappedException(*throw_location, exception_descriptor, msg.str().c_str());
- }
+ self->ThrowNewWrappedException(exception_descriptor, msg.str().c_str());
}
// AbstractMethodError
void ThrowAbstractMethodError(mirror::ArtMethod* method) {
- ThrowException(NULL, "Ljava/lang/AbstractMethodError;", NULL,
+ ThrowException("Ljava/lang/AbstractMethodError;", NULL,
StringPrintf("abstract method \"%s\"",
PrettyMethod(method).c_str()).c_str());
}
@@ -97,20 +86,20 @@ void ThrowAbstractMethodError(mirror::ArtMethod* method) {
// ArithmeticException
void ThrowArithmeticExceptionDivideByZero() {
- ThrowException(NULL, "Ljava/lang/ArithmeticException;", NULL, "divide by zero");
+ ThrowException("Ljava/lang/ArithmeticException;", NULL, "divide by zero");
}
// ArrayIndexOutOfBoundsException
void ThrowArrayIndexOutOfBoundsException(int index, int length) {
- ThrowException(NULL, "Ljava/lang/ArrayIndexOutOfBoundsException;", NULL,
+ ThrowException("Ljava/lang/ArrayIndexOutOfBoundsException;", NULL,
StringPrintf("length=%d; index=%d", length, index).c_str());
}
// ArrayStoreException
void ThrowArrayStoreException(mirror::Class* element_class, mirror::Class* array_class) {
- ThrowException(NULL, "Ljava/lang/ArrayStoreException;", NULL,
+ ThrowException("Ljava/lang/ArrayStoreException;", NULL,
StringPrintf("%s cannot be stored in an array of type %s",
PrettyDescriptor(element_class).c_str(),
PrettyDescriptor(array_class).c_str()).c_str());
@@ -119,14 +108,14 @@ void ThrowArrayStoreException(mirror::Class* element_class, mirror::Class* array
// ClassCastException
void ThrowClassCastException(mirror::Class* dest_type, mirror::Class* src_type) {
- ThrowException(NULL, "Ljava/lang/ClassCastException;", NULL,
+ ThrowException("Ljava/lang/ClassCastException;", NULL,
StringPrintf("%s cannot be cast to %s",
PrettyDescriptor(src_type).c_str(),
PrettyDescriptor(dest_type).c_str()).c_str());
}
-void ThrowClassCastException(const ThrowLocation* throw_location, const char* msg) {
- ThrowException(throw_location, "Ljava/lang/ClassCastException;", NULL, msg);
+void ThrowClassCastException(const char* msg) {
+ ThrowException("Ljava/lang/ClassCastException;", NULL, msg);
}
// ClassCircularityError
@@ -134,7 +123,7 @@ void ThrowClassCastException(const ThrowLocation* throw_location, const char* ms
void ThrowClassCircularityError(mirror::Class* c) {
std::ostringstream msg;
msg << PrettyDescriptor(c);
- ThrowException(NULL, "Ljava/lang/ClassCircularityError;", c, msg.str().c_str());
+ ThrowException("Ljava/lang/ClassCircularityError;", c, msg.str().c_str());
}
// ClassFormatError
@@ -142,7 +131,7 @@ void ThrowClassCircularityError(mirror::Class* c) {
void ThrowClassFormatError(mirror::Class* referrer, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
- ThrowException(NULL, "Ljava/lang/ClassFormatError;", referrer, fmt, &args);
+ ThrowException("Ljava/lang/ClassFormatError;", referrer, fmt, &args);
va_end(args);}
// IllegalAccessError
@@ -151,7 +140,7 @@ void ThrowIllegalAccessErrorClass(mirror::Class* referrer, mirror::Class* access
std::ostringstream msg;
msg << "Illegal class access: '" << PrettyDescriptor(referrer) << "' attempting to access '"
<< PrettyDescriptor(accessed) << "'";
- ThrowException(NULL, "Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str());
+ ThrowException("Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str());
}
void ThrowIllegalAccessErrorClassForMethodDispatch(mirror::Class* referrer, mirror::Class* accessed,
@@ -161,21 +150,21 @@ void ThrowIllegalAccessErrorClassForMethodDispatch(mirror::Class* referrer, mirr
msg << "Illegal class access ('" << PrettyDescriptor(referrer) << "' attempting to access '"
<< PrettyDescriptor(accessed) << "') in attempt to invoke " << type
<< " method " << PrettyMethod(called).c_str();
- ThrowException(NULL, "Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str());
+ ThrowException("Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str());
}
void ThrowIllegalAccessErrorMethod(mirror::Class* referrer, mirror::ArtMethod* accessed) {
std::ostringstream msg;
msg << "Method '" << PrettyMethod(accessed) << "' is inaccessible to class '"
<< PrettyDescriptor(referrer) << "'";
- ThrowException(NULL, "Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str());
+ ThrowException("Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str());
}
void ThrowIllegalAccessErrorField(mirror::Class* referrer, mirror::ArtField* accessed) {
std::ostringstream msg;
msg << "Field '" << PrettyField(accessed, false) << "' is inaccessible to class '"
<< PrettyDescriptor(referrer) << "'";
- ThrowException(NULL, "Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str());
+ ThrowException("Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str());
}
void ThrowIllegalAccessErrorFinalField(mirror::ArtMethod* referrer,
@@ -183,7 +172,7 @@ void ThrowIllegalAccessErrorFinalField(mirror::ArtMethod* referrer,
std::ostringstream msg;
msg << "Final field '" << PrettyField(accessed, false) << "' cannot be written to by method '"
<< PrettyMethod(referrer) << "'";
- ThrowException(NULL, "Ljava/lang/IllegalAccessError;",
+ ThrowException("Ljava/lang/IllegalAccessError;",
referrer != NULL ? referrer->GetClass() : NULL,
msg.str().c_str());
}
@@ -191,20 +180,20 @@ void ThrowIllegalAccessErrorFinalField(mirror::ArtMethod* referrer,
void ThrowIllegalAccessError(mirror::Class* referrer, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
- ThrowException(NULL, "Ljava/lang/IllegalAccessError;", referrer, fmt, &args);
+ ThrowException("Ljava/lang/IllegalAccessError;", referrer, fmt, &args);
va_end(args);
}
// IllegalAccessException
-void ThrowIllegalAccessException(const ThrowLocation* throw_location, const char* msg) {
- ThrowException(throw_location, "Ljava/lang/IllegalAccessException;", NULL, msg);
+void ThrowIllegalAccessException(const char* msg) {
+ ThrowException("Ljava/lang/IllegalAccessException;", NULL, msg);
}
// IllegalArgumentException
-void ThrowIllegalArgumentException(const ThrowLocation* throw_location, const char* msg) {
- ThrowException(throw_location, "Ljava/lang/IllegalArgumentException;", NULL, msg);
+void ThrowIllegalArgumentException(const char* msg) {
+ ThrowException("Ljava/lang/IllegalArgumentException;", NULL, msg);
}
@@ -216,7 +205,7 @@ void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType foun
std::ostringstream msg;
msg << "The method '" << PrettyMethod(method) << "' was expected to be of type "
<< expected_type << " but instead was found to be of type " << found_type;
- ThrowException(NULL, "Ljava/lang/IncompatibleClassChangeError;",
+ ThrowException("Ljava/lang/IncompatibleClassChangeError;",
referrer != NULL ? referrer->GetClass() : NULL,
msg.str().c_str());
}
@@ -232,7 +221,7 @@ void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(mirror::ArtMetho
<< "' does not implement interface '"
<< PrettyDescriptor(interface_method->GetDeclaringClass())
<< "' in call to '" << PrettyMethod(interface_method) << "'";
- ThrowException(NULL, "Ljava/lang/IncompatibleClassChangeError;",
+ ThrowException("Ljava/lang/IncompatibleClassChangeError;",
referrer != NULL ? referrer->GetClass() : NULL,
msg.str().c_str());
}
@@ -243,14 +232,14 @@ void ThrowIncompatibleClassChangeErrorField(mirror::ArtField* resolved_field, bo
msg << "Expected '" << PrettyField(resolved_field) << "' to be a "
<< (is_static ? "static" : "instance") << " field" << " rather than a "
<< (is_static ? "instance" : "static") << " field";
- ThrowException(NULL, "Ljava/lang/IncompatibleClassChangeError;", referrer->GetClass(),
+ ThrowException("Ljava/lang/IncompatibleClassChangeError;", referrer->GetClass(),
msg.str().c_str());
}
void ThrowIncompatibleClassChangeError(mirror::Class* referrer, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
- ThrowException(NULL, "Ljava/lang/IncompatibleClassChangeError;", referrer, fmt, &args);
+ ThrowException("Ljava/lang/IncompatibleClassChangeError;", referrer, fmt, &args);
va_end(args);
}
@@ -259,14 +248,14 @@ void ThrowIncompatibleClassChangeError(mirror::Class* referrer, const char* fmt,
void ThrowIOException(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
- ThrowException(NULL, "Ljava/io/IOException;", NULL, fmt, &args);
+ ThrowException("Ljava/io/IOException;", NULL, fmt, &args);
va_end(args);
}
void ThrowWrappedIOException(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
- ThrowWrappedException(NULL, "Ljava/io/IOException;", NULL, fmt, &args);
+ ThrowWrappedException("Ljava/io/IOException;", NULL, fmt, &args);
va_end(args);
}
@@ -275,19 +264,19 @@ void ThrowWrappedIOException(const char* fmt, ...) {
void ThrowLinkageError(mirror::Class* referrer, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
- ThrowException(NULL, "Ljava/lang/LinkageError;", referrer, fmt, &args);
+ ThrowException("Ljava/lang/LinkageError;", referrer, fmt, &args);
va_end(args);
}
// NegativeArraySizeException
void ThrowNegativeArraySizeException(int size) {
- ThrowException(NULL, "Ljava/lang/NegativeArraySizeException;", NULL,
+ ThrowException("Ljava/lang/NegativeArraySizeException;", NULL,
StringPrintf("%d", size).c_str());
}
void ThrowNegativeArraySizeException(const char* msg) {
- ThrowException(NULL, "Ljava/lang/NegativeArraySizeException;", NULL, msg);
+ ThrowException("Ljava/lang/NegativeArraySizeException;", NULL, msg);
}
// NoSuchFieldError
@@ -299,7 +288,7 @@ void ThrowNoSuchFieldError(const StringPiece& scope, mirror::Class* c,
std::string temp;
msg << "No " << scope << "field " << name << " of type " << type
<< " in class " << c->GetDescriptor(&temp) << " or its superclasses";
- ThrowException(NULL, "Ljava/lang/NoSuchFieldError;", c, msg.str().c_str());
+ ThrowException("Ljava/lang/NoSuchFieldError;", c, msg.str().c_str());
}
// NoSuchMethodError
@@ -310,97 +299,91 @@ void ThrowNoSuchMethodError(InvokeType type, mirror::Class* c, const StringPiece
std::string temp;
msg << "No " << type << " method " << name << signature
<< " in class " << c->GetDescriptor(&temp) << " or its super classes";
- ThrowException(NULL, "Ljava/lang/NoSuchMethodError;", c, msg.str().c_str());
+ ThrowException("Ljava/lang/NoSuchMethodError;", c, msg.str().c_str());
}
void ThrowNoSuchMethodError(uint32_t method_idx) {
- Thread* self = Thread::Current();
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- mirror::DexCache* dex_cache = throw_location.GetMethod()->GetDeclaringClass()->GetDexCache();
+ mirror::ArtMethod* method = Thread::Current()->GetCurrentMethod(nullptr);
+ mirror::DexCache* dex_cache = method->GetDeclaringClass()->GetDexCache();
const DexFile& dex_file = *dex_cache->GetDexFile();
std::ostringstream msg;
msg << "No method '" << PrettyMethod(method_idx, dex_file, true) << "'";
- ThrowException(&throw_location, "Ljava/lang/NoSuchMethodError;",
- throw_location.GetMethod()->GetDeclaringClass(), msg.str().c_str());
+ ThrowException("Ljava/lang/NoSuchMethodError;",
+ method->GetDeclaringClass(), msg.str().c_str());
}
// NullPointerException
-void ThrowNullPointerExceptionForFieldAccess(const ThrowLocation& throw_location,
- mirror::ArtField* field, bool is_read) {
+void ThrowNullPointerExceptionForFieldAccess(mirror::ArtField* field, bool is_read) {
std::ostringstream msg;
msg << "Attempt to " << (is_read ? "read from" : "write to")
<< " field '" << PrettyField(field, true) << "' on a null object reference";
- ThrowException(&throw_location, "Ljava/lang/NullPointerException;", NULL, msg.str().c_str());
+ ThrowException("Ljava/lang/NullPointerException;", NULL, msg.str().c_str());
}
-static void ThrowNullPointerExceptionForMethodAccessImpl(const ThrowLocation& throw_location,
- uint32_t method_idx,
+static void ThrowNullPointerExceptionForMethodAccessImpl(uint32_t method_idx,
const DexFile& dex_file,
InvokeType type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::ostringstream msg;
msg << "Attempt to invoke " << type << " method '"
<< PrettyMethod(method_idx, dex_file, true) << "' on a null object reference";
- ThrowException(&throw_location, "Ljava/lang/NullPointerException;", NULL, msg.str().c_str());
+ ThrowException("Ljava/lang/NullPointerException;", NULL, msg.str().c_str());
}
-void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_location,
- uint32_t method_idx,
+void ThrowNullPointerExceptionForMethodAccess(uint32_t method_idx,
InvokeType type) {
- mirror::DexCache* dex_cache = throw_location.GetMethod()->GetDeclaringClass()->GetDexCache();
+ mirror::DexCache* dex_cache =
+ Thread::Current()->GetCurrentMethod(nullptr)->GetDeclaringClass()->GetDexCache();
const DexFile& dex_file = *dex_cache->GetDexFile();
- ThrowNullPointerExceptionForMethodAccessImpl(throw_location, method_idx,
- dex_file, type);
+ ThrowNullPointerExceptionForMethodAccessImpl(method_idx, dex_file, type);
}
-void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_location,
- mirror::ArtMethod* method,
+void ThrowNullPointerExceptionForMethodAccess(mirror::ArtMethod* method,
InvokeType type) {
mirror::DexCache* dex_cache = method->GetDeclaringClass()->GetDexCache();
const DexFile& dex_file = *dex_cache->GetDexFile();
- ThrowNullPointerExceptionForMethodAccessImpl(throw_location, method->GetDexMethodIndex(),
+ ThrowNullPointerExceptionForMethodAccessImpl(method->GetDexMethodIndex(),
dex_file, type);
}
-void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) {
- const DexFile::CodeItem* code = throw_location.GetMethod()->GetCodeItem();
- uint32_t throw_dex_pc = throw_location.GetDexPc();
+void ThrowNullPointerExceptionFromDexPC() {
+ uint32_t throw_dex_pc;
+ mirror::ArtMethod* method = Thread::Current()->GetCurrentMethod(&throw_dex_pc);
+ const DexFile::CodeItem* code = method->GetCodeItem();
CHECK_LT(throw_dex_pc, code->insns_size_in_code_units_);
const Instruction* instr = Instruction::At(&code->insns_[throw_dex_pc]);
switch (instr->Opcode()) {
case Instruction::INVOKE_DIRECT:
- ThrowNullPointerExceptionForMethodAccess(throw_location, instr->VRegB_35c(), kDirect);
+ ThrowNullPointerExceptionForMethodAccess(instr->VRegB_35c(), kDirect);
break;
case Instruction::INVOKE_DIRECT_RANGE:
- ThrowNullPointerExceptionForMethodAccess(throw_location, instr->VRegB_3rc(), kDirect);
+ ThrowNullPointerExceptionForMethodAccess(instr->VRegB_3rc(), kDirect);
break;
case Instruction::INVOKE_VIRTUAL:
- ThrowNullPointerExceptionForMethodAccess(throw_location, instr->VRegB_35c(), kVirtual);
+ ThrowNullPointerExceptionForMethodAccess(instr->VRegB_35c(), kVirtual);
break;
case Instruction::INVOKE_VIRTUAL_RANGE:
- ThrowNullPointerExceptionForMethodAccess(throw_location, instr->VRegB_3rc(), kVirtual);
+ ThrowNullPointerExceptionForMethodAccess(instr->VRegB_3rc(), kVirtual);
break;
case Instruction::INVOKE_INTERFACE:
- ThrowNullPointerExceptionForMethodAccess(throw_location, instr->VRegB_35c(), kInterface);
+ ThrowNullPointerExceptionForMethodAccess(instr->VRegB_35c(), kInterface);
break;
case Instruction::INVOKE_INTERFACE_RANGE:
- ThrowNullPointerExceptionForMethodAccess(throw_location, instr->VRegB_3rc(), kInterface);
+ ThrowNullPointerExceptionForMethodAccess(instr->VRegB_3rc(), kInterface);
break;
case Instruction::INVOKE_VIRTUAL_QUICK:
case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: {
// Since we replaced the method index, we ask the verifier to tell us which
// method is invoked at this location.
- mirror::ArtMethod* method =
- verifier::MethodVerifier::FindInvokedMethodAtDexPc(throw_location.GetMethod(),
- throw_location.GetDexPc());
- if (method != NULL) {
+ mirror::ArtMethod* invoked_method =
+ verifier::MethodVerifier::FindInvokedMethodAtDexPc(method, throw_dex_pc);
+ if (invoked_method != NULL) {
// NPE with precise message.
- ThrowNullPointerExceptionForMethodAccess(throw_location, method, kVirtual);
+ ThrowNullPointerExceptionForMethodAccess(invoked_method, kVirtual);
} else {
// NPE with imprecise message.
- ThrowNullPointerException(&throw_location,
- "Attempt to invoke a virtual method on a null object reference");
+ ThrowNullPointerException("Attempt to invoke a virtual method on a null object reference");
}
break;
}
@@ -412,9 +395,8 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) {
case Instruction::IGET_CHAR:
case Instruction::IGET_SHORT: {
mirror::ArtField* field =
- Runtime::Current()->GetClassLinker()->ResolveField(instr->VRegC_22c(),
- throw_location.GetMethod(), false);
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, true /* read */);
+ Runtime::Current()->GetClassLinker()->ResolveField(instr->VRegC_22c(), method, false);
+ ThrowNullPointerExceptionForFieldAccess(field, true /* read */);
break;
}
case Instruction::IGET_QUICK:
@@ -427,15 +409,13 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) {
// Since we replaced the field index, we ask the verifier to tell us which
// field is accessed at this location.
mirror::ArtField* field =
- verifier::MethodVerifier::FindAccessedFieldAtDexPc(throw_location.GetMethod(),
- throw_location.GetDexPc());
+ verifier::MethodVerifier::FindAccessedFieldAtDexPc(method, throw_dex_pc);
if (field != NULL) {
// NPE with precise message.
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, true /* read */);
+ ThrowNullPointerExceptionForFieldAccess(field, true /* read */);
} else {
// NPE with imprecise message.
- ThrowNullPointerException(&throw_location,
- "Attempt to read from a field on a null object reference");
+ ThrowNullPointerException("Attempt to read from a field on a null object reference");
}
break;
}
@@ -447,9 +427,8 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) {
case Instruction::IPUT_CHAR:
case Instruction::IPUT_SHORT: {
mirror::ArtField* field =
- Runtime::Current()->GetClassLinker()->ResolveField(instr->VRegC_22c(),
- throw_location.GetMethod(), false);
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, false /* write */);
+ Runtime::Current()->GetClassLinker()->ResolveField(instr->VRegC_22c(), method, false);
+ ThrowNullPointerExceptionForFieldAccess(field, false /* write */);
break;
}
case Instruction::IPUT_QUICK:
@@ -462,15 +441,13 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) {
// Since we replaced the field index, we ask the verifier to tell us which
// field is accessed at this location.
mirror::ArtField* field =
- verifier::MethodVerifier::FindAccessedFieldAtDexPc(throw_location.GetMethod(),
- throw_location.GetDexPc());
+ verifier::MethodVerifier::FindAccessedFieldAtDexPc(method, throw_dex_pc);
if (field != NULL) {
// NPE with precise message.
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, false /* write */);
+ ThrowNullPointerExceptionForFieldAccess(field, false /* write */);
} else {
// NPE with imprecise message.
- ThrowNullPointerException(&throw_location,
- "Attempt to write to a field on a null object reference");
+ ThrowNullPointerException("Attempt to write to a field on a null object reference");
}
break;
}
@@ -481,7 +458,7 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) {
case Instruction::AGET_BYTE:
case Instruction::AGET_CHAR:
case Instruction::AGET_SHORT:
- ThrowException(&throw_location, "Ljava/lang/NullPointerException;", NULL,
+ ThrowException("Ljava/lang/NullPointerException;", NULL,
"Attempt to read from null array");
break;
case Instruction::APUT:
@@ -491,28 +468,28 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) {
case Instruction::APUT_BYTE:
case Instruction::APUT_CHAR:
case Instruction::APUT_SHORT:
- ThrowException(&throw_location, "Ljava/lang/NullPointerException;", NULL,
+ ThrowException("Ljava/lang/NullPointerException;", NULL,
"Attempt to write to null array");
break;
case Instruction::ARRAY_LENGTH:
- ThrowException(&throw_location, "Ljava/lang/NullPointerException;", NULL,
+ ThrowException("Ljava/lang/NullPointerException;", NULL,
"Attempt to get length of null array");
break;
default: {
// TODO: We should have covered all the cases where we expect a NPE above, this
// message/logging is so we can improve any cases we've missed in the future.
- const DexFile& dex_file =
- *throw_location.GetMethod()->GetDeclaringClass()->GetDexCache()->GetDexFile();
- ThrowException(&throw_location, "Ljava/lang/NullPointerException;", NULL,
+ const DexFile* dex_file =
+ method->GetDeclaringClass()->GetDexCache()->GetDexFile();
+ ThrowException("Ljava/lang/NullPointerException;", NULL,
StringPrintf("Null pointer exception during instruction '%s'",
- instr->DumpString(&dex_file).c_str()).c_str());
+ instr->DumpString(dex_file).c_str()).c_str());
break;
}
}
}
-void ThrowNullPointerException(const ThrowLocation* throw_location, const char* msg) {
- ThrowException(throw_location, "Ljava/lang/NullPointerException;", NULL, msg);
+void ThrowNullPointerException(const char* msg) {
+ ThrowException("Ljava/lang/NullPointerException;", NULL, msg);
}
// RuntimeException
@@ -520,7 +497,7 @@ void ThrowNullPointerException(const ThrowLocation* throw_location, const char*
void ThrowRuntimeException(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
- ThrowException(NULL, "Ljava/lang/RuntimeException;", NULL, fmt, &args);
+ ThrowException("Ljava/lang/RuntimeException;", NULL, fmt, &args);
va_end(args);
}
@@ -529,7 +506,7 @@ void ThrowRuntimeException(const char* fmt, ...) {
void ThrowVerifyError(mirror::Class* referrer, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
- ThrowException(NULL, "Ljava/lang/VerifyError;", referrer, fmt, &args);
+ ThrowException("Ljava/lang/VerifyError;", referrer, fmt, &args);
va_end(args);
}
diff --git a/runtime/common_throws.h b/runtime/common_throws.h
index ebedae0..9e749e3 100644
--- a/runtime/common_throws.h
+++ b/runtime/common_throws.h
@@ -29,7 +29,6 @@ namespace mirror {
} // namespace mirror
class Signature;
class StringPiece;
-class ThrowLocation;
// AbstractMethodError
@@ -60,7 +59,7 @@ void ThrowClassCircularityError(mirror::Class* c)
void ThrowClassCastException(mirror::Class* dest_type, mirror::Class* src_type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) COLD_ATTR;
-void ThrowClassCastException(const ThrowLocation* throw_location, const char* msg)
+void ThrowClassCastException(const char* msg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) COLD_ATTR;
// ClassFormatError
@@ -94,12 +93,12 @@ void ThrowIllegalAccessError(mirror::Class* referrer, const char* fmt, ...)
// IllegalAccessException
-void ThrowIllegalAccessException(const ThrowLocation* throw_location, const char* msg)
+void ThrowIllegalAccessException(const char* msg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) COLD_ATTR;
// IllegalArgumentException
-void ThrowIllegalArgumentException(const ThrowLocation* throw_location, const char* msg)
+void ThrowIllegalArgumentException(const char* msg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) COLD_ATTR;
// IncompatibleClassChangeError
@@ -161,25 +160,22 @@ void ThrowNoSuchMethodError(uint32_t method_idx)
// NullPointerException
-void ThrowNullPointerExceptionForFieldAccess(const ThrowLocation& throw_location,
- mirror::ArtField* field,
+void ThrowNullPointerExceptionForFieldAccess(mirror::ArtField* field,
bool is_read)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) COLD_ATTR;
-void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_location,
- uint32_t method_idx,
+void ThrowNullPointerExceptionForMethodAccess(uint32_t method_idx,
InvokeType type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) COLD_ATTR;
-void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_location,
- mirror::ArtMethod* method,
+void ThrowNullPointerExceptionForMethodAccess(mirror::ArtMethod* method,
InvokeType type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) COLD_ATTR;
-void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location)
+void ThrowNullPointerExceptionFromDexPC()
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) COLD_ATTR;
-void ThrowNullPointerException(const ThrowLocation* throw_location, const char* msg)
+void ThrowNullPointerException(const char* msg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) COLD_ATTR;
// RuntimeException
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index e6df12e..9f2a09b 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -47,7 +47,6 @@
#include "ScopedPrimitiveArray.h"
#include "handle_scope-inl.h"
#include "thread_list.h"
-#include "throw_location.h"
#include "utf.h"
#include "verifier/method_verifier-inl.h"
#include "well_known_classes.h"
diff --git a/runtime/debugger.h b/runtime/debugger.h
index 0ac83f6..01c9d5d 100644
--- a/runtime/debugger.h
+++ b/runtime/debugger.h
@@ -48,7 +48,6 @@ class ObjectRegistry;
class ScopedObjectAccessUnchecked;
class StackVisitor;
class Thread;
-class ThrowLocation;
/*
* Invoke-during-breakpoint support.
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index 149c6b4..8a13d34 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -53,9 +53,7 @@ inline mirror::Class* CheckObjectAlloc(uint32_t type_idx,
}
if (kAccessCheck) {
if (UNLIKELY(!klass->IsInstantiable())) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewException(throw_location, "Ljava/lang/InstantiationError;",
- PrettyDescriptor(klass).c_str());
+ self->ThrowNewException("Ljava/lang/InstantiationError;", PrettyDescriptor(klass).c_str());
*slow_path = true;
return nullptr; // Failure
}
@@ -294,9 +292,7 @@ inline mirror::ArtField* FindFieldFromCode(uint32_t field_idx, mirror::ArtMethod
} else {
if (UNLIKELY(resolved_field->IsPrimitiveType() != is_primitive ||
resolved_field->FieldSize() != expected_size)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- DCHECK(throw_location.GetMethod() == referrer);
- self->ThrowNewExceptionF(throw_location, "Ljava/lang/NoSuchFieldError;",
+ self->ThrowNewExceptionF("Ljava/lang/NoSuchFieldError;",
"Attempted read of %zd-bit %s on field '%s'",
expected_size * (32 / sizeof(int32_t)),
is_primitive ? "primitive" : "non-primitive",
@@ -367,9 +363,7 @@ inline mirror::ArtMethod* FindMethodFromCode(uint32_t method_idx,
} else if (UNLIKELY(*this_object == nullptr && type != kStatic)) {
// Maintain interpreter-like semantics where NullPointerException is thrown
// after potential NoSuchMethodError from class linker.
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- DCHECK_EQ(*referrer, throw_location.GetMethod());
- ThrowNullPointerExceptionForMethodAccess(throw_location, method_idx, type);
+ ThrowNullPointerExceptionForMethodAccess(method_idx, type);
return nullptr; // Failure.
} else if (access_check) {
// Incompatible class change should have been handled in resolve method.
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index af528b7..70e2851 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -55,10 +55,8 @@ static inline mirror::Class* CheckFilledNewArrayAlloc(uint32_t type_idx,
ThrowRuntimeException("Bad filled array request for type %s",
PrettyDescriptor(klass).c_str());
} else {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- DCHECK(throw_location.GetMethod() == referrer);
self->ThrowNewExceptionF(
- throw_location, "Ljava/lang/InternalError;",
+ "Ljava/lang/InternalError;",
"Found type %s; filled-new-array not implemented for anything but 'int'",
PrettyDescriptor(klass).c_str());
}
@@ -281,18 +279,8 @@ JValue InvokeProxyInvocationHandler(ScopedObjectAccessAlreadyRunnable& soa, cons
// This can cause thread suspension.
mirror::Class* result_type = h_interface_method->GetReturnType();
mirror::Object* result_ref = soa.Decode<mirror::Object*>(result);
- mirror::Object* rcvr = soa.Decode<mirror::Object*>(rcvr_jobj);
- mirror::ArtMethod* proxy_method;
- if (h_interface_method->GetDeclaringClass()->IsInterface()) {
- proxy_method = rcvr->GetClass()->FindVirtualMethodForInterface(h_interface_method.Get());
- } else {
- // Proxy dispatch to a method defined in Object.
- DCHECK(h_interface_method->GetDeclaringClass()->IsObjectClass());
- proxy_method = h_interface_method.Get();
- }
- ThrowLocation throw_location(rcvr, proxy_method, -1);
JValue result_unboxed;
- if (!UnboxPrimitiveForResult(throw_location, result_ref, result_type, &result_unboxed)) {
+ if (!UnboxPrimitiveForResult(result_ref, result_type, &result_unboxed)) {
DCHECK(soa.Self()->IsExceptionPending());
return zero;
}
@@ -327,9 +315,7 @@ JValue InvokeProxyInvocationHandler(ScopedObjectAccessAlreadyRunnable& soa, cons
declares_exception = declared_exception->IsAssignableFrom(exception_class);
}
if (!declares_exception) {
- ThrowLocation throw_location(rcvr, proxy_method, -1);
- soa.Self()->ThrowNewWrappedException(throw_location,
- "Ljava/lang/reflect/UndeclaredThrowableException;",
+ soa.Self()->ThrowNewWrappedException("Ljava/lang/reflect/UndeclaredThrowableException;",
NULL);
}
}
@@ -340,16 +326,14 @@ JValue InvokeProxyInvocationHandler(ScopedObjectAccessAlreadyRunnable& soa, cons
bool FillArrayData(mirror::Object* obj, const Instruction::ArrayDataPayload* payload) {
DCHECK_EQ(payload->ident, static_cast<uint16_t>(Instruction::kArrayDataSignature));
if (UNLIKELY(obj == nullptr)) {
- ThrowNullPointerException(nullptr, "null array in FILL_ARRAY_DATA");
+ ThrowNullPointerException("null array in FILL_ARRAY_DATA");
return false;
}
mirror::Array* array = obj->AsArray();
DCHECK(!array->IsObjectArray());
if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
Thread* self = Thread::Current();
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewExceptionF(throw_location,
- "Ljava/lang/ArrayIndexOutOfBoundsException;",
+ self->ThrowNewExceptionF("Ljava/lang/ArrayIndexOutOfBoundsException;",
"failed FILL_ARRAY_DATA; length=%d, index=%d",
array->GetLength(), payload->element_count);
return false;
diff --git a/runtime/entrypoints/quick/quick_field_entrypoints.cc b/runtime/entrypoints/quick/quick_field_entrypoints.cc
index 7326fcf..22bf939 100644
--- a/runtime/entrypoints/quick/quick_field_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_field_entrypoints.cc
@@ -155,8 +155,7 @@ extern "C" int8_t artGetByteInstanceFromCode(uint32_t field_idx, mirror::Object*
sizeof(int8_t));
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, true);
+ ThrowNullPointerExceptionForFieldAccess(field, true);
} else {
return field->GetByte(obj);
}
@@ -177,8 +176,7 @@ extern "C" uint8_t artGetBooleanInstanceFromCode(uint32_t field_idx, mirror::Obj
sizeof(int8_t));
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, true);
+ ThrowNullPointerExceptionForFieldAccess(field, true);
} else {
return field->GetBoolean(obj);
}
@@ -198,8 +196,7 @@ extern "C" int16_t artGetShortInstanceFromCode(uint32_t field_idx, mirror::Objec
sizeof(int16_t));
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, true);
+ ThrowNullPointerExceptionForFieldAccess(field, true);
} else {
return field->GetShort(obj);
}
@@ -220,8 +217,7 @@ extern "C" uint16_t artGetCharInstanceFromCode(uint32_t field_idx, mirror::Objec
sizeof(int16_t));
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, true);
+ ThrowNullPointerExceptionForFieldAccess(field, true);
} else {
return field->GetChar(obj);
}
@@ -242,8 +238,7 @@ extern "C" uint32_t artGet32InstanceFromCode(uint32_t field_idx, mirror::Object*
sizeof(int32_t));
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, true);
+ ThrowNullPointerExceptionForFieldAccess(field, true);
} else {
return field->Get32(obj);
}
@@ -264,8 +259,7 @@ extern "C" uint64_t artGet64InstanceFromCode(uint32_t field_idx, mirror::Object*
sizeof(int64_t));
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, true);
+ ThrowNullPointerExceptionForFieldAccess(field, true);
} else {
return field->Get64(obj);
}
@@ -287,8 +281,7 @@ extern "C" mirror::Object* artGetObjInstanceFromCode(uint32_t field_idx, mirror:
sizeof(mirror::HeapReference<mirror::Object>));
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, true);
+ ThrowNullPointerExceptionForFieldAccess(field, true);
} else {
return field->GetObj(obj);
}
@@ -448,8 +441,7 @@ extern "C" int artSet8InstanceFromCode(uint32_t field_idx, mirror::Object* obj,
}
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, false);
+ ThrowNullPointerExceptionForFieldAccess(field, false);
} else {
Primitive::Type type = field->GetTypeAsPrimitiveType();
// Compiled code can't use transactional mode.
@@ -489,8 +481,7 @@ extern "C" int artSet16InstanceFromCode(uint32_t field_idx, mirror::Object* obj,
}
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, false);
+ ThrowNullPointerExceptionForFieldAccess(field, false);
} else {
Primitive::Type type = field->GetTypeAsPrimitiveType();
// Compiled code can't use transactional mode.
@@ -525,8 +516,7 @@ extern "C" int artSet32InstanceFromCode(uint32_t field_idx, mirror::Object* obj,
}
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, false);
+ ThrowNullPointerExceptionForFieldAccess(field, false);
} else {
// Compiled code can't use transactional mode.
field->Set32<false>(obj, new_value);
@@ -551,8 +541,7 @@ extern "C" int artSet64InstanceFromCode(uint32_t field_idx, mirror::Object* obj,
sizeof(int64_t));
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, false);
+ ThrowNullPointerExceptionForFieldAccess(field, false);
} else {
// Compiled code can't use transactional mode.
field->Set64<false>(obj, new_value);
@@ -578,8 +567,7 @@ extern "C" int artSetObjInstanceFromCode(uint32_t field_idx, mirror::Object* obj
sizeof(mirror::HeapReference<mirror::Object>));
if (LIKELY(field != nullptr)) {
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionForFieldAccess(throw_location, field, false);
+ ThrowNullPointerExceptionForFieldAccess(field, false);
} else {
// Compiled code can't use transactional mode.
field->SetObj<false>(obj, new_value);
diff --git a/runtime/entrypoints/quick/quick_lock_entrypoints.cc b/runtime/entrypoints/quick/quick_lock_entrypoints.cc
index 8ceac97..4423c08 100644
--- a/runtime/entrypoints/quick/quick_lock_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_lock_entrypoints.cc
@@ -25,9 +25,7 @@ extern "C" int artLockObjectFromCode(mirror::Object* obj, Thread* self)
NO_THREAD_SAFETY_ANALYSIS /* EXCLUSIVE_LOCK_FUNCTION(Monitor::monitor_lock_) */ {
ScopedQuickEntrypointChecks sqec(self);
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location(self->GetCurrentLocationForThrow());
- ThrowNullPointerException(&throw_location,
- "Null reference used for synchronization (monitor-enter)");
+ ThrowNullPointerException("Null reference used for synchronization (monitor-enter)");
return -1; // Failure.
} else {
if (kIsDebugBuild) {
@@ -47,9 +45,7 @@ extern "C" int artUnlockObjectFromCode(mirror::Object* obj, Thread* self)
NO_THREAD_SAFETY_ANALYSIS /* UNLOCK_FUNCTION(Monitor::monitor_lock_) */ {
ScopedQuickEntrypointChecks sqec(self);
if (UNLIKELY(obj == nullptr)) {
- ThrowLocation throw_location(self->GetCurrentLocationForThrow());
- ThrowNullPointerException(&throw_location,
- "Null reference used for synchronization (monitor-exit)");
+ ThrowNullPointerException("Null reference used for synchronization (monitor-exit)");
return -1; // Failure.
} else {
// MonitorExit may throw exception.
diff --git a/runtime/entrypoints/quick/quick_throw_entrypoints.cc b/runtime/entrypoints/quick/quick_throw_entrypoints.cc
index 127f9e0..70317bb 100644
--- a/runtime/entrypoints/quick/quick_throw_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_throw_entrypoints.cc
@@ -42,9 +42,7 @@ extern "C" void artDeliverExceptionFromCode(mirror::Throwable* exception, Thread
*/
ScopedQuickEntrypointChecks sqec(self);
if (exception == nullptr) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewException(throw_location, "Ljava/lang/NullPointerException;",
- "throw with null exception");
+ self->ThrowNewException("Ljava/lang/NullPointerException;", "throw with null exception");
} else {
self->SetException(exception);
}
@@ -56,8 +54,7 @@ extern "C" void artThrowNullPointerExceptionFromCode(Thread* self)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
ScopedQuickEntrypointChecks sqec(self);
self->NoteSignalBeingHandled();
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionFromDexPC(throw_location);
+ ThrowNullPointerExceptionFromDexPC();
self->NoteSignalHandlerDone();
self->QuickDeliverException();
}
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index e3f18f1..8972f3a 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -38,7 +38,6 @@ namespace mirror {
} // namespace mirror
union JValue;
class Thread;
-class ThrowLocation;
namespace instrumentation {
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index e6e647c..2a9c0d4 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -23,8 +23,8 @@
namespace art {
namespace interpreter {
-void ThrowNullPointerExceptionFromInterpreter(const ShadowFrame& shadow_frame) {
- ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
+void ThrowNullPointerExceptionFromInterpreter() {
+ ThrowNullPointerExceptionFromDexPC();
}
template<FindFieldType find_type, Primitive::Type field_type, bool do_access_check>
@@ -44,7 +44,7 @@ bool DoFieldGet(Thread* self, ShadowFrame& shadow_frame, const Instruction* inst
} else {
obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
if (UNLIKELY(obj == nullptr)) {
- ThrowNullPointerExceptionForFieldAccess(shadow_frame.GetCurrentLocationForThrow(), f, true);
+ ThrowNullPointerExceptionForFieldAccess(f, true);
return false;
}
}
@@ -126,7 +126,7 @@ bool DoIGetQuick(ShadowFrame& shadow_frame, const Instruction* inst, uint16_t in
if (UNLIKELY(obj == nullptr)) {
// We lost the reference to the field index so we cannot get a more
// precised exception message.
- ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
+ ThrowNullPointerExceptionFromDexPC();
return false;
}
MemberOffset field_offset(inst->VRegC_22c());
@@ -238,8 +238,7 @@ bool DoFieldPut(Thread* self, const ShadowFrame& shadow_frame, const Instruction
} else {
obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
if (UNLIKELY(obj == nullptr)) {
- ThrowNullPointerExceptionForFieldAccess(shadow_frame.GetCurrentLocationForThrow(),
- f, false);
+ ThrowNullPointerExceptionForFieldAccess(f, false);
return false;
}
}
@@ -289,8 +288,7 @@ bool DoFieldPut(Thread* self, const ShadowFrame& shadow_frame, const Instruction
if (!reg->VerifierInstanceOf(field_class)) {
// This should never happen.
std::string temp1, temp2, temp3;
- self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
- "Ljava/lang/VirtualMachineError;",
+ self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
"Put '%s' that is not instance of field '%s' in '%s'",
reg->GetClass()->GetDescriptor(&temp1),
field_class->GetDescriptor(&temp2),
@@ -346,7 +344,7 @@ bool DoIPutQuick(const ShadowFrame& shadow_frame, const Instruction* inst, uint1
if (UNLIKELY(obj == nullptr)) {
// We lost the reference to the field index so we cannot get a more
// precised exception message.
- ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
+ ThrowNullPointerExceptionFromDexPC();
return false;
}
MemberOffset field_offset(inst->VRegC_22c());
@@ -555,8 +553,7 @@ bool DoCall(ArtMethod* called_method, Thread* self, ShadowFrame& shadow_frame,
if (!o->VerifierInstanceOf(arg_type)) {
// This should never happen.
std::string temp1, temp2;
- self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
- "Ljava/lang/VirtualMachineError;",
+ self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
"Invoking %s with bad arg %d, type '%s' not instance of '%s'",
new_shadow_frame->GetMethod()->GetName(), shorty_pos,
o->GetClass()->GetDescriptor(&temp1),
@@ -658,8 +655,7 @@ bool DoFilledNewArray(const Instruction* inst, const ShadowFrame& shadow_frame,
ThrowRuntimeException("Bad filled array request for type %s",
PrettyDescriptor(componentClass).c_str());
} else {
- self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
- "Ljava/lang/InternalError;",
+ self->ThrowNewExceptionF("Ljava/lang/InternalError;",
"Found type %s; filled-new-array not implemented for anything but 'int'",
PrettyDescriptor(componentClass).c_str());
}
@@ -776,8 +772,7 @@ static void CheckExceptionGenerateClassNotFound(Thread* self)
// If it is not an InternalError, wrap it.
std::string type(PrettyTypeOf(self->GetException()));
if (type != "java.lang.InternalError") {
- self->ThrowNewWrappedException(self->GetCurrentLocationForThrow(),
- "Ljava/lang/ClassNotFoundException;",
+ self->ThrowNewWrappedException("Ljava/lang/ClassNotFoundException;",
"ClassNotFoundException");
}
}
@@ -856,7 +851,7 @@ static void UnstartedRuntimeInvoke(Thread* self, const DexFile::CodeItem* code_
ok = true;
}
} else {
- self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(), "Ljava/lang/InternalError;",
+ self->ThrowNewExceptionF("Ljava/lang/InternalError;",
"Could not find default constructor for '%s'",
PrettyClass(h_klass.Get()).c_str());
}
@@ -865,9 +860,7 @@ static void UnstartedRuntimeInvoke(Thread* self, const DexFile::CodeItem* code_
std::string error_msg = StringPrintf("Failed in Class.newInstance for '%s' with %s",
PrettyClass(h_klass.Get()).c_str(),
PrettyTypeOf(self->GetException()).c_str());
- self->ThrowNewWrappedException(self->GetCurrentLocationForThrow(),
- "Ljava/lang/InternalError;",
- error_msg.c_str());
+ self->ThrowNewWrappedException("Ljava/lang/InternalError;", error_msg.c_str());
}
} else if (name == "java.lang.reflect.Field java.lang.Class.getDeclaredField(java.lang.String)") {
// Special managed code cut-out to allow field lookup in a un-started runtime that'd fail
@@ -938,7 +931,7 @@ static void UnstartedRuntimeInvoke(Thread* self, const DexFile::CodeItem* code_
dst->Set(dstPos + i, src->Get(srcPos + i));
}
} else {
- self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(), "Ljava/lang/InternalError;",
+ self->ThrowNewExceptionF("Ljava/lang/InternalError;",
"Unimplemented System.arraycopy for type '%s'",
PrettyDescriptor(ctype).c_str());
}
@@ -1005,8 +998,7 @@ static void UnstartedRuntimeInvoke(Thread* self, const DexFile::CodeItem* code_
}
if (!ok) {
- self->ThrowNewException(self->GetCurrentLocationForThrow(), "Ljava/lang/InternalError;",
- "Unimplemented ThreadLocal.get");
+ self->ThrowNewException("Ljava/lang/InternalError;", "Unimplemented ThreadLocal.get");
}
} else {
// Not special, continue with regular interpreter execution.
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index 06b809f..3095316 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -77,7 +77,7 @@ template<bool do_access_check, bool transaction_active>
extern JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item,
ShadowFrame& shadow_frame, JValue result_register);
-void ThrowNullPointerExceptionFromInterpreter(const ShadowFrame& shadow_frame)
+void ThrowNullPointerExceptionFromInterpreter()
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static inline void DoMonitorEnter(Thread* self, Object* ref) NO_THREAD_SAFETY_ANALYSIS {
@@ -138,7 +138,7 @@ static inline bool DoInvokeVirtualQuick(Thread* self, ShadowFrame& shadow_frame,
if (UNLIKELY(receiver == nullptr)) {
// We lost the reference to the method index so we cannot get a more
// precised exception message.
- ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
+ ThrowNullPointerExceptionFromDexPC();
return false;
}
const uint32_t vtable_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c();
diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc
index f1ab747..5f97f94 100644
--- a/runtime/interpreter/interpreter_goto_table_impl.cc
+++ b/runtime/interpreter/interpreter_goto_table_impl.cc
@@ -341,8 +341,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
if (!obj_result->VerifierInstanceOf(return_type)) {
// This should never happen.
std::string temp1, temp2;
- self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
- "Ljava/lang/VirtualMachineError;",
+ self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
"Returning '%s' that is not instance of return type '%s'",
obj_result->GetClass()->GetDescriptor(&temp1),
return_type->GetDescriptor(&temp2));
@@ -465,7 +464,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
if (UNLIKELY(obj == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
DoMonitorEnter(self, obj);
@@ -477,7 +476,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
if (UNLIKELY(obj == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
DoMonitorExit(self, obj);
@@ -519,7 +518,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
if (UNLIKELY(array == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
@@ -596,12 +595,11 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(THROW) {
Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
if (UNLIKELY(exception == NULL)) {
- ThrowNullPointerException(NULL, "throw with null exception");
+ ThrowNullPointerException("throw with null exception");
} else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
// This should never happen.
std::string temp;
- self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
- "Ljava/lang/VirtualMachineError;",
+ self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
"Throwing '%s' that is not instance of Throwable",
exception->GetClass()->GetDescriptor(&temp));
} else {
@@ -972,7 +970,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
@@ -990,7 +988,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(AGET_BYTE) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
@@ -1008,7 +1006,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(AGET_CHAR) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
@@ -1026,7 +1024,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(AGET_SHORT) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
@@ -1044,7 +1042,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(AGET) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
@@ -1062,7 +1060,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(AGET_WIDE) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
@@ -1080,7 +1078,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(AGET_OBJECT) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
@@ -1098,7 +1096,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
@@ -1117,7 +1115,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(APUT_BYTE) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
@@ -1136,7 +1134,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(APUT_CHAR) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
@@ -1155,7 +1153,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(APUT_SHORT) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
@@ -1174,7 +1172,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(APUT) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data));
@@ -1193,7 +1191,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(APUT_WIDE) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data));
@@ -1212,7 +1210,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF
HANDLE_INSTRUCTION_START(APUT_OBJECT) {
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc
index dceed47..9313c75 100644
--- a/runtime/interpreter/interpreter_switch_impl.cc
+++ b/runtime/interpreter/interpreter_switch_impl.cc
@@ -248,8 +248,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
if (!obj_result->VerifierInstanceOf(return_type)) {
// This should never happen.
std::string temp1, temp2;
- self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
- "Ljava/lang/VirtualMachineError;",
+ self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
"Returning '%s' that is not instance of return type '%s'",
obj_result->GetClass()->GetDescriptor(&temp1),
return_type->GetDescriptor(&temp2));
@@ -370,7 +369,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
if (UNLIKELY(obj == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
DoMonitorEnter(self, obj);
@@ -382,7 +381,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
if (UNLIKELY(obj == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
DoMonitorExit(self, obj);
@@ -424,7 +423,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data));
if (UNLIKELY(array == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
} else {
shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength());
@@ -506,12 +505,11 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data));
if (UNLIKELY(exception == NULL)) {
- ThrowNullPointerException(NULL, "throw with null exception");
+ ThrowNullPointerException("throw with null exception");
} else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) {
// This should never happen.
std::string temp;
- self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(),
- "Ljava/lang/VirtualMachineError;",
+ self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
"Throwing '%s' that is not instance of Throwable",
exception->GetClass()->GetDescriptor(&temp));
} else {
@@ -817,7 +815,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -835,7 +833,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -853,7 +851,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -871,7 +869,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -889,7 +887,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -907,7 +905,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -925,7 +923,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -943,7 +941,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -962,7 +960,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -981,7 +979,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -1000,7 +998,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -1019,7 +1017,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -1038,7 +1036,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
@@ -1057,7 +1055,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
PREAMBLE();
Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
if (UNLIKELY(a == NULL)) {
- ThrowNullPointerExceptionFromInterpreter(shadow_frame);
+ ThrowNullPointerExceptionFromInterpreter();
HANDLE_PENDING_EXCEPTION();
break;
}
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc
index 08332d3..e68616f 100644
--- a/runtime/java_vm_ext.cc
+++ b/runtime/java_vm_ext.cc
@@ -741,8 +741,7 @@ void* JavaVMExt::FindCodeForNativeMethod(mirror::ArtMethod* m) {
}
// Throwing can cause libraries_lock to be reacquired.
if (native_method == nullptr) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewException(throw_location, "Ljava/lang/UnsatisfiedLinkError;", detail.c_str());
+ self->ThrowNewException("Ljava/lang/UnsatisfiedLinkError;", detail.c_str());
}
return native_method;
}
diff --git a/runtime/jit/jit_instrumentation.h b/runtime/jit/jit_instrumentation.h
index 9d122e0..425d2d3 100644
--- a/runtime/jit/jit_instrumentation.h
+++ b/runtime/jit/jit_instrumentation.h
@@ -39,7 +39,6 @@ namespace mirror {
} // namespace mirror
union JValue;
class Thread;
-class ThrowLocation;
namespace jit {
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 213de6f..898a363 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -89,9 +89,8 @@ static std::string NormalizeJniClassDescriptor(const char* name) {
static void ThrowNoSuchMethodError(ScopedObjectAccess& soa, mirror::Class* c,
const char* name, const char* sig, const char* kind)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
std::string temp;
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/NoSuchMethodError;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/NoSuchMethodError;",
"no %s method \"%s.%s%s\"",
kind, c->GetDescriptor(&temp), name, sig);
}
@@ -102,8 +101,7 @@ static void ReportInvalidJNINativeMethod(const ScopedObjectAccess& soa, mirror::
LOG(return_errors ? ERROR : FATAL) << "Failed to register native method in "
<< PrettyDescriptor(c) << " in " << c->GetDexCache()->GetLocation()->ToModifiedUtf8()
<< ": " << kind << " is null at index " << idx;
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/NoSuchMethodError;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/NoSuchMethodError;",
"%s is null at index %d", kind, idx);
}
@@ -200,8 +198,7 @@ static jfieldID FindFieldID(const ScopedObjectAccess& soa, jclass jni_class, con
Handle<mirror::Throwable> cause(hs2.NewHandle(soa.Self()->GetException()));
soa.Self()->ClearException();
std::string temp;
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/NoSuchFieldError;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/NoSuchFieldError;",
"no type \"%s\" found and so no field \"%s\" "
"could be found in class \"%s\" or its superclasses", sig, name,
c->GetDescriptor(&temp));
@@ -216,8 +213,7 @@ static jfieldID FindFieldID(const ScopedObjectAccess& soa, jclass jni_class, con
field = c->FindInstanceField(name, field_type->GetDescriptor(&temp));
}
if (field == nullptr) {
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/NoSuchFieldError;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/NoSuchFieldError;",
"no \"%s\" field \"%s\" in class \"%s\" or its superclasses",
sig, name, c->GetDescriptor(&temp));
return nullptr;
@@ -229,8 +225,7 @@ static void ThrowAIOOBE(ScopedObjectAccess& soa, mirror::Array* array, jsize sta
jsize length, const char* identifier)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::string type(PrettyTypeOf(array));
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/ArrayIndexOutOfBoundsException;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/ArrayIndexOutOfBoundsException;",
"%s offset=%d length=%d %s.length=%d",
type.c_str(), start, length, identifier, array->GetLength());
}
@@ -238,8 +233,7 @@ static void ThrowAIOOBE(ScopedObjectAccess& soa, mirror::Array* array, jsize sta
static void ThrowSIOOBE(ScopedObjectAccess& soa, jsize start, jsize length,
jsize array_length)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/StringIndexOutOfBoundsException;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/StringIndexOutOfBoundsException;",
"offset=%d length=%d string.length()=%d", start, length,
array_length);
}
diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h
index 96d426b..80d5135 100644
--- a/runtime/mirror/object_array-inl.h
+++ b/runtime/mirror/object_array-inl.h
@@ -233,9 +233,8 @@ inline void ObjectArray<T>::AssignableCheckingMemcpy(int32_t dst_pos, ObjectArra
std::string actualSrcType(PrettyTypeOf(o));
std::string dstType(PrettyTypeOf(this));
Thread* self = Thread::Current();
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
if (throw_exception) {
- self->ThrowNewExceptionF(throw_location, "Ljava/lang/ArrayStoreException;",
+ self->ThrowNewExceptionF("Ljava/lang/ArrayStoreException;",
"source[%d] of type %s cannot be stored in destination array of type %s",
src_pos + i, actualSrcType.c_str(), dstType.c_str());
} else {
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index dce8bac..d41d37e 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -300,8 +300,7 @@ static void ThrowIllegalMonitorStateExceptionF(const char* fmt, ...)
va_list args;
va_start(args, fmt);
Thread* self = Thread::Current();
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewExceptionV(throw_location, "Ljava/lang/IllegalMonitorStateException;", fmt, args);
+ self->ThrowNewExceptionV("Ljava/lang/IllegalMonitorStateException;", fmt, args);
if (!Runtime::Current()->IsStarted() || VLOG_IS_ON(monitor)) {
std::ostringstream ss;
self->Dump(ss);
@@ -428,8 +427,7 @@ void Monitor::Wait(Thread* self, int64_t ms, int32_t ns,
// Enforce the timeout range.
if (ms < 0 || ns < 0 || ns > 999999) {
monitor_lock_.Unlock(self);
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewExceptionF(throw_location, "Ljava/lang/IllegalArgumentException;",
+ self->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
"timeout arguments out of range: ms=%" PRId64 " ns=%d", ms, ns);
return;
}
@@ -540,8 +538,7 @@ void Monitor::Wait(Thread* self, int64_t ms, int32_t ns,
self->SetInterruptedLocked(false);
}
if (interruptShouldThrow) {
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewException(throw_location, "Ljava/lang/InterruptedException;", NULL);
+ self->ThrowNewException("Ljava/lang/InterruptedException;", NULL);
}
}
}
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
index 6c82eb2..57ca2b1 100644
--- a/runtime/native/dalvik_system_VMDebug.cc
+++ b/runtime/native/dalvik_system_VMDebug.cc
@@ -93,8 +93,7 @@ static void VMDebug_startMethodTracingFd(JNIEnv* env, jclass, jstring javaTraceF
int fd = dup(originalFd);
if (fd < 0) {
ScopedObjectAccess soa(env);
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/RuntimeException;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/RuntimeException;",
"dup(%d) failed: %s", originalFd, strerror(errno));
return;
}
@@ -148,8 +147,7 @@ static jlong VMDebug_lastDebuggerActivity(JNIEnv*, jclass) {
static void ThrowUnsupportedOperationException(JNIEnv* env) {
ScopedObjectAccess soa(env);
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewException(throw_location, "Ljava/lang/UnsupportedOperationException;", NULL);
+ soa.Self()->ThrowNewException("Ljava/lang/UnsupportedOperationException;", NULL);
}
static void VMDebug_startInstructionCounting(JNIEnv* env, jclass) {
@@ -196,7 +194,7 @@ static void VMDebug_dumpHprofData(JNIEnv* env, jclass, jstring javaFilename, job
// Only one of these may be NULL.
if (javaFilename == NULL && javaFd == NULL) {
ScopedObjectAccess soa(env);
- ThrowNullPointerException(NULL, "fileName == null && fd == null");
+ ThrowNullPointerException("fileName == null && fd == null");
return;
}
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index 599d97f..6e3f1bc 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -72,7 +72,7 @@ static jobject VMRuntime_newNonMovableArray(JNIEnv* env, jobject, jclass javaEle
}
mirror::Class* element_class = soa.Decode<mirror::Class*>(javaElementClass);
if (UNLIKELY(element_class == nullptr)) {
- ThrowNullPointerException(NULL, "element class == null");
+ ThrowNullPointerException("element class == null");
return nullptr;
}
Runtime* runtime = Runtime::Current();
@@ -97,7 +97,7 @@ static jobject VMRuntime_newUnpaddedArray(JNIEnv* env, jobject, jclass javaEleme
}
mirror::Class* element_class = soa.Decode<mirror::Class*>(javaElementClass);
if (UNLIKELY(element_class == nullptr)) {
- ThrowNullPointerException(NULL, "element class == null");
+ ThrowNullPointerException("element class == null");
return nullptr;
}
Runtime* runtime = Runtime::Current();
@@ -120,7 +120,7 @@ static jlong VMRuntime_addressOf(JNIEnv* env, jobject, jobject javaArray) {
ScopedFastNativeObjectAccess soa(env);
mirror::Array* array = soa.Decode<mirror::Array*>(javaArray);
if (!array->IsArrayInstance()) {
- ThrowIllegalArgumentException(NULL, "not an array");
+ ThrowIllegalArgumentException("not an array");
return 0;
}
if (Runtime::Current()->GetHeap()->IsMovableObject(array)) {
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index 1ea75f3..60d14e9 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -55,8 +55,7 @@ static jclass Class_classForName(JNIEnv* env, jclass, jstring javaName, jboolean
// is especially handy for array types, since we want to avoid
// auto-generating bogus array classes.
if (!IsValidBinaryClassName(name.c_str())) {
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/ClassNotFoundException;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/ClassNotFoundException;",
"Invalid name: %s", name.c_str());
return nullptr;
}
diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc
index 4ea2546..6afe83b 100644
--- a/runtime/native/java_lang_String.cc
+++ b/runtime/native/java_lang_String.cc
@@ -29,7 +29,7 @@ namespace art {
static jint String_compareTo(JNIEnv* env, jobject javaThis, jobject javaRhs) {
ScopedFastNativeObjectAccess soa(env);
if (UNLIKELY(javaRhs == NULL)) {
- ThrowNullPointerException(NULL, "rhs == null");
+ ThrowNullPointerException("rhs == null");
return -1;
} else {
return soa.Decode<mirror::String*>(javaThis)->CompareTo(soa.Decode<mirror::String*>(javaRhs));
diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc
index f79be56..736b42b 100644
--- a/runtime/native/java_lang_System.cc
+++ b/runtime/native/java_lang_System.cc
@@ -39,8 +39,7 @@ static void ThrowArrayStoreException_NotAnArray(const char* identifier, mirror::
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::string actualType(PrettyTypeOf(array));
Thread* self = Thread::Current();
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- self->ThrowNewExceptionF(throw_location, "Ljava/lang/ArrayStoreException;",
+ self->ThrowNewExceptionF("Ljava/lang/ArrayStoreException;",
"%s of type %s is not an array", identifier, actualType.c_str());
}
@@ -52,11 +51,11 @@ static void System_arraycopy(JNIEnv* env, jclass, jobject javaSrc, jint srcPos,
// Null pointer checks.
if (UNLIKELY(javaSrc == nullptr)) {
- ThrowNullPointerException(nullptr, "src == null");
+ ThrowNullPointerException("src == null");
return;
}
if (UNLIKELY(javaDst == nullptr)) {
- ThrowNullPointerException(nullptr, "dst == null");
+ ThrowNullPointerException("dst == null");
return;
}
@@ -78,8 +77,7 @@ static void System_arraycopy(JNIEnv* env, jclass, jobject javaSrc, jint srcPos,
if (UNLIKELY(srcPos < 0) || UNLIKELY(dstPos < 0) || UNLIKELY(count < 0) ||
UNLIKELY(srcPos > srcArray->GetLength() - count) ||
UNLIKELY(dstPos > dstArray->GetLength() - count)) {
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/ArrayIndexOutOfBoundsException;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/ArrayIndexOutOfBoundsException;",
"src.length=%d srcPos=%d dst.length=%d dstPos=%d length=%d",
srcArray->GetLength(), srcPos, dstArray->GetLength(), dstPos,
count);
@@ -132,8 +130,7 @@ static void System_arraycopy(JNIEnv* env, jclass, jobject javaSrc, jint srcPos,
srcComponentType->IsPrimitive())) {
std::string srcType(PrettyTypeOf(srcArray));
std::string dstType(PrettyTypeOf(dstArray));
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/ArrayStoreException;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/ArrayStoreException;",
"Incompatible types: src=%s, dst=%s",
srcType.c_str(), dstType.c_str());
return;
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
index e4b8db1..d3b52ba 100644
--- a/runtime/native/java_lang_Thread.cc
+++ b/runtime/native/java_lang_Thread.cc
@@ -100,7 +100,7 @@ static jboolean Thread_nativeHoldsLock(JNIEnv* env, jobject java_thread, jobject
ScopedObjectAccess soa(env);
mirror::Object* object = soa.Decode<mirror::Object*>(java_object);
if (object == NULL) {
- ThrowNullPointerException(NULL, "object == null");
+ ThrowNullPointerException("object == null");
return JNI_FALSE;
}
MutexLock mu(soa.Self(), *Locks::thread_list_lock_);
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
index 3121a90..765f548 100644
--- a/runtime/native/java_lang_reflect_Constructor.cc
+++ b/runtime/native/java_lang_reflect_Constructor.cc
@@ -42,8 +42,7 @@ static jobject Constructor_newInstance(JNIEnv* env, jobject javaMethod, jobjectA
StackHandleScope<1> hs(soa.Self());
Handle<mirror::Class> c(hs.NewHandle(m->GetDeclaringClass()));
if (UNLIKELY(c->IsAbstract())) {
- ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();
- soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/InstantiationException;",
+ soa.Self()->ThrowNewExceptionF("Ljava/lang/InstantiationException;",
"Can't instantiate %s %s",
c->IsInterface() ? "interface" : "abstract class",
PrettyDescriptor(c.Get()).c_str());
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 2cebf02..9c5bde9 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -34,7 +34,7 @@ ALWAYS_INLINE inline static bool VerifyFieldAccess(Thread* self, mirror::ArtFiel
mirror::Object* obj)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
if (kIsSet && field->IsFinal()) {
- ThrowIllegalAccessException(nullptr,
+ ThrowIllegalAccessException(
StringPrintf("Cannot set %s field %s of class %s",
PrettyJavaAccessFlags(field->GetAccessFlags()).c_str(),
PrettyField(field).c_str(),
@@ -45,7 +45,7 @@ ALWAYS_INLINE inline static bool VerifyFieldAccess(Thread* self, mirror::ArtFiel
mirror::Class* calling_class = nullptr;
if (!VerifyAccess(self, obj, field->GetDeclaringClass(), field->GetAccessFlags(),
&calling_class)) {
- ThrowIllegalAccessException(nullptr,
+ ThrowIllegalAccessException(
StringPrintf("Class %s cannot access %s field %s of class %s",
calling_class == nullptr ? "null" : PrettyClass(calling_class).c_str(),
PrettyJavaAccessFlags(field->GetAccessFlags()).c_str(),
@@ -98,8 +98,8 @@ ALWAYS_INLINE inline static bool GetFieldValue(mirror::Object* o, mirror::ArtFie
// Never okay.
break;
}
- ThrowIllegalArgumentException(nullptr, StringPrintf("Not a primitive field: %s",
- PrettyField(f).c_str()).c_str());
+ ThrowIllegalArgumentException(StringPrintf("Not a primitive field: %s",
+ PrettyField(f).c_str()).c_str());
return false;
}
@@ -190,7 +190,7 @@ ALWAYS_INLINE inline static JValue GetPrimitiveField(JNIEnv* env, jobject javaFi
}
// Widen it if necessary (and possible).
JValue wide_value;
- if (!ConvertPrimitiveValue(nullptr, false, field_type, kPrimitiveType, field_value,
+ if (!ConvertPrimitiveValue(false, field_type, kPrimitiveType, field_value,
&wide_value)) {
DCHECK(soa.Self()->IsExceptionPending());
return JValue();
@@ -270,8 +270,8 @@ static void SetFieldValue(mirror::Object* o, mirror::ArtField* f, Primitive::Typ
FALLTHROUGH_INTENDED;
case Primitive::kPrimVoid:
// Never okay.
- ThrowIllegalArgumentException(nullptr, StringPrintf("Not a primitive field: %s",
- PrettyField(f).c_str()).c_str());
+ ThrowIllegalArgumentException(StringPrintf("Not a primitive field: %s",
+ PrettyField(f).c_str()).c_str());
return;
}
}
@@ -329,14 +329,14 @@ static void SetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj,
}
Primitive::Type field_type = f->GetTypeAsPrimitiveType();
if (UNLIKELY(field_type == Primitive::kPrimNot)) {
- ThrowIllegalArgumentException(nullptr, StringPrintf("Not a primitive field: %s",
- PrettyField(f).c_str()).c_str());
+ ThrowIllegalArgumentException(StringPrintf("Not a primitive field: %s",
+ PrettyField(f).c_str()).c_str());
return;
}
// Widen the value if necessary (and possible).
JValue wide_value;
- if (!ConvertPrimitiveValue(nullptr, false, kPrimitiveType, field_type, new_value, &wide_value)) {
+ if (!ConvertPrimitiveValue(false, kPrimitiveType, field_type, new_value, &wide_value)) {
DCHECK(soa.Self()->IsExceptionPending());
return;
}
diff --git a/runtime/quick_exception_handler.h b/runtime/quick_exception_handler.h
index 08619fa..8cccec8 100644
--- a/runtime/quick_exception_handler.h
+++ b/runtime/quick_exception_handler.h
@@ -30,7 +30,6 @@ class Throwable;
} // namespace mirror
class Context;
class Thread;
-class ThrowLocation;
class ShadowFrame;
// Manages exception delivery for Quick backend.
diff --git a/runtime/reflection-inl.h b/runtime/reflection-inl.h
index be4d560..f21c1a0 100644
--- a/runtime/reflection-inl.h
+++ b/runtime/reflection-inl.h
@@ -27,7 +27,7 @@
namespace art {
-inline bool ConvertPrimitiveValue(const ThrowLocation* throw_location, bool unbox_for_result,
+inline bool ConvertPrimitiveValue(bool unbox_for_result,
Primitive::Type srcType, Primitive::Type dstType,
const JValue& src, JValue* dst) {
DCHECK(srcType != Primitive::kPrimNot && dstType != Primitive::kPrimNot);
@@ -88,13 +88,11 @@ inline bool ConvertPrimitiveValue(const ThrowLocation* throw_location, bool unbo
break;
}
if (!unbox_for_result) {
- ThrowIllegalArgumentException(throw_location,
- StringPrintf("Invalid primitive conversion from %s to %s",
+ ThrowIllegalArgumentException(StringPrintf("Invalid primitive conversion from %s to %s",
PrettyDescriptor(srcType).c_str(),
PrettyDescriptor(dstType).c_str()).c_str());
} else {
- ThrowClassCastException(throw_location,
- StringPrintf("Couldn't convert result of type %s to %s",
+ ThrowClassCastException(StringPrintf("Couldn't convert result of type %s to %s",
PrettyDescriptor(srcType).c_str(),
PrettyDescriptor(dstType).c_str()).c_str());
}
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index 4acd07f..a54a39d 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -207,7 +207,7 @@ class ArgArray {
static void ThrowIllegalPrimitiveArgumentException(const char* expected,
const char* found_descriptor)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ThrowIllegalArgumentException(nullptr,
+ ThrowIllegalArgumentException(
StringPrintf("Invalid primitive conversion from %s to %s", expected,
PrettyDescriptor(found_descriptor).c_str()).c_str());
}
@@ -227,7 +227,7 @@ class ArgArray {
mirror::Class* dst_class =
h_m->GetClassFromTypeIndex(classes->GetTypeItem(args_offset).type_idx_, true);
if (UNLIKELY(arg == nullptr || !arg->InstanceOf(dst_class))) {
- ThrowIllegalArgumentException(nullptr,
+ ThrowIllegalArgumentException(
StringPrintf("method %s argument %zd has type %s, got %s",
PrettyMethod(h_m.Get(), false).c_str(),
args_offset + 1, // Humans don't count from 0.
@@ -255,7 +255,7 @@ class ArgArray {
ThrowIllegalPrimitiveArgumentException(expected, \
arg->GetClass<>()->GetDescriptor(&temp)); \
} else { \
- ThrowIllegalArgumentException(nullptr, \
+ ThrowIllegalArgumentException(\
StringPrintf("method %s argument %zd has type %s, got %s", \
PrettyMethod(h_m.Get(), false).c_str(), \
args_offset + 1, \
@@ -580,8 +580,7 @@ jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject javaM
uint32_t classes_size = (classes == nullptr) ? 0 : classes->Size();
uint32_t arg_count = (objects != nullptr) ? objects->GetLength() : 0;
if (arg_count != classes_size) {
- ThrowIllegalArgumentException(nullptr,
- StringPrintf("Wrong number of arguments; expected %d, got %d",
+ ThrowIllegalArgumentException(StringPrintf("Wrong number of arguments; expected %d, got %d",
classes_size, arg_count).c_str());
return nullptr;
}
@@ -590,7 +589,7 @@ jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject javaM
mirror::Class* calling_class = nullptr;
if (!accessible && !VerifyAccess(soa.Self(), receiver, declaring_class, m->GetAccessFlags(),
&calling_class)) {
- ThrowIllegalAccessException(nullptr,
+ ThrowIllegalAccessException(
StringPrintf("Class %s cannot access %s method %s of class %s",
calling_class == nullptr ? "null" : PrettyClass(calling_class).c_str(),
PrettyJavaAccessFlags(m->GetAccessFlags()).c_str(),
@@ -631,13 +630,12 @@ jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject javaM
bool VerifyObjectIsClass(mirror::Object* o, mirror::Class* c) {
if (o == nullptr) {
- ThrowNullPointerException(nullptr, "null receiver");
+ ThrowNullPointerException("null receiver");
return false;
} else if (!o->InstanceOf(c)) {
std::string expected_class_name(PrettyDescriptor(c));
std::string actual_class_name(PrettyTypeOf(o));
- ThrowIllegalArgumentException(nullptr,
- StringPrintf("Expected receiver of type %s, but got %s",
+ ThrowIllegalArgumentException(StringPrintf("Expected receiver of type %s, but got %s",
expected_class_name.c_str(),
actual_class_name.c_str()).c_str());
return false;
@@ -718,7 +716,7 @@ static std::string UnboxingFailureKind(mirror::ArtField* f)
return "result";
}
-static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object* o,
+static bool UnboxPrimitive(mirror::Object* o,
mirror::Class* dst_class, mirror::ArtField* f,
JValue* unboxed_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -726,14 +724,12 @@ static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object*
if (!dst_class->IsPrimitive()) {
if (UNLIKELY(o != nullptr && !o->InstanceOf(dst_class))) {
if (!unbox_for_result) {
- ThrowIllegalArgumentException(throw_location,
- StringPrintf("%s has type %s, got %s",
+ ThrowIllegalArgumentException(StringPrintf("%s has type %s, got %s",
UnboxingFailureKind(f).c_str(),
PrettyDescriptor(dst_class).c_str(),
PrettyTypeOf(o).c_str()).c_str());
} else {
- ThrowClassCastException(throw_location,
- StringPrintf("Couldn't convert result of type %s to %s",
+ ThrowClassCastException(StringPrintf("Couldn't convert result of type %s to %s",
PrettyTypeOf(o).c_str(),
PrettyDescriptor(dst_class).c_str()).c_str());
}
@@ -743,20 +739,17 @@ static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object*
return true;
}
if (UNLIKELY(dst_class->GetPrimitiveType() == Primitive::kPrimVoid)) {
- ThrowIllegalArgumentException(throw_location,
- StringPrintf("Can't unbox %s to void",
+ ThrowIllegalArgumentException(StringPrintf("Can't unbox %s to void",
UnboxingFailureKind(f).c_str()).c_str());
return false;
}
if (UNLIKELY(o == nullptr)) {
if (!unbox_for_result) {
- ThrowIllegalArgumentException(throw_location,
- StringPrintf("%s has type %s, got null",
+ ThrowIllegalArgumentException(StringPrintf("%s has type %s, got null",
UnboxingFailureKind(f).c_str(),
PrettyDescriptor(dst_class).c_str()).c_str());
} else {
- ThrowNullPointerException(throw_location,
- StringPrintf("Expected to unbox a '%s' primitive type but was returned null",
+ ThrowNullPointerException(StringPrintf("Expected to unbox a '%s' primitive type but was returned null",
PrettyDescriptor(dst_class).c_str()).c_str());
}
return false;
@@ -793,14 +786,14 @@ static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object*
boxed_value.SetS(primitive_field->GetShort(o));
} else {
std::string temp;
- ThrowIllegalArgumentException(throw_location,
+ ThrowIllegalArgumentException(
StringPrintf("%s has type %s, got %s", UnboxingFailureKind(f).c_str(),
PrettyDescriptor(dst_class).c_str(),
PrettyDescriptor(o->GetClass()->GetDescriptor(&temp)).c_str()).c_str());
return false;
}
- return ConvertPrimitiveValue(throw_location, unbox_for_result,
+ return ConvertPrimitiveValue(unbox_for_result,
src_class->GetPrimitiveType(), dst_class->GetPrimitiveType(),
boxed_value, unboxed_value);
}
@@ -808,12 +801,12 @@ static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object*
bool UnboxPrimitiveForField(mirror::Object* o, mirror::Class* dst_class, mirror::ArtField* f,
JValue* unboxed_value) {
DCHECK(f != nullptr);
- return UnboxPrimitive(nullptr, o, dst_class, f, unboxed_value);
+ return UnboxPrimitive(o, dst_class, f, unboxed_value);
}
-bool UnboxPrimitiveForResult(const ThrowLocation& throw_location, mirror::Object* o,
+bool UnboxPrimitiveForResult(mirror::Object* o,
mirror::Class* dst_class, JValue* unboxed_value) {
- return UnboxPrimitive(&throw_location, o, dst_class, nullptr, unboxed_value);
+ return UnboxPrimitive(o, dst_class, nullptr, unboxed_value);
}
bool VerifyAccess(Thread* self, mirror::Object* obj, mirror::Class* declaring_class,
diff --git a/runtime/reflection.h b/runtime/reflection.h
index 1a64871..857d63b 100644
--- a/runtime/reflection.h
+++ b/runtime/reflection.h
@@ -31,18 +31,16 @@ namespace mirror {
union JValue;
class ScopedObjectAccessAlreadyRunnable;
class ShadowFrame;
-class ThrowLocation;
mirror::Object* BoxPrimitive(Primitive::Type src_class, const JValue& value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool UnboxPrimitiveForField(mirror::Object* o, mirror::Class* dst_class, mirror::ArtField* f,
JValue* unboxed_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-bool UnboxPrimitiveForResult(const ThrowLocation& throw_location, mirror::Object* o,
- mirror::Class* dst_class, JValue* unboxed_value)
+bool UnboxPrimitiveForResult(mirror::Object* o, mirror::Class* dst_class, JValue* unboxed_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-ALWAYS_INLINE bool ConvertPrimitiveValue(const ThrowLocation* throw_location, bool unbox_for_result,
+ALWAYS_INLINE bool ConvertPrimitiveValue(bool unbox_for_result,
Primitive::Type src_class, Primitive::Type dst_class,
const JValue& src, JValue* dst)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index ac1040d..61798c3 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1016,7 +1016,7 @@ bool Runtime::Init(const RuntimeOptions& raw_options, bool ignore_unrecognized)
}
// Pre-allocate an OutOfMemoryError for the double-OOME case.
- self->ThrowNewException(ThrowLocation(), "Ljava/lang/OutOfMemoryError;",
+ self->ThrowNewException("Ljava/lang/OutOfMemoryError;",
"OutOfMemoryError thrown while trying to throw OutOfMemoryError; "
"no stack trace available");
pre_allocated_OutOfMemoryError_ = GcRoot<mirror::Throwable>(self->GetException());
@@ -1024,7 +1024,7 @@ bool Runtime::Init(const RuntimeOptions& raw_options, bool ignore_unrecognized)
// Pre-allocate a NoClassDefFoundError for the common case of failing to find a system class
// ahead of checking the application's class loader.
- self->ThrowNewException(ThrowLocation(), "Ljava/lang/NoClassDefFoundError;",
+ self->ThrowNewException("Ljava/lang/NoClassDefFoundError;",
"Class not found using the boot class loader; no stack trace available");
pre_allocated_NoClassDefFoundError_ = GcRoot<mirror::Throwable>(self->GetException());
self->ClearException();
diff --git a/runtime/stack.cc b/runtime/stack.cc
index 97a8d01..48becf6 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -28,7 +28,6 @@
#include "runtime.h"
#include "thread.h"
#include "thread_list.h"
-#include "throw_location.h"
#include "verify_object-inl.h"
#include "vmap_table.h"
@@ -57,10 +56,6 @@ mirror::Object* ShadowFrame::GetThisObject(uint16_t num_ins) const {
}
}
-ThrowLocation ShadowFrame::GetCurrentLocationForThrow() const {
- return ThrowLocation(GetThisObject(), GetMethod(), GetDexPC());
-}
-
size_t ManagedStack::NumJniShadowFrameReferences() const {
size_t count = 0;
for (const ManagedStack* current_fragment = this; current_fragment != NULL;
diff --git a/runtime/stack.h b/runtime/stack.h
index b495f03..13bd47f 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -25,7 +25,6 @@
#include "gc_root.h"
#include "mirror/object_reference.h"
#include "read_barrier.h"
-#include "throw_location.h"
#include "utils.h"
#include "verify_object.h"
@@ -40,6 +39,7 @@ class Context;
class ShadowFrame;
class HandleScope;
class ScopedObjectAccess;
+class StackVisitor;
class Thread;
// The kind of vreg being accessed in calls to Set/GetVReg.
@@ -258,8 +258,6 @@ class ShadowFrame {
mirror::Object* GetThisObject(uint16_t num_ins) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- ThrowLocation GetCurrentLocationForThrow() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
bool Contains(StackReference<mirror::Object>* shadow_frame_entry_obj) const {
if (HasReferenceArray()) {
return ((&References()[0] <= shadow_frame_entry_obj) &&
diff --git a/runtime/thread.cc b/runtime/thread.cc
index da1fb6e..e8e9355 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1702,29 +1702,25 @@ jobjectArray Thread::InternalStackTraceToStackTraceElementArray(
return result;
}
-void Thread::ThrowNewExceptionF(const ThrowLocation& throw_location,
- const char* exception_class_descriptor, const char* fmt, ...) {
+void Thread::ThrowNewExceptionF(const char* exception_class_descriptor, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
- ThrowNewExceptionV(throw_location, exception_class_descriptor,
- fmt, args);
+ ThrowNewExceptionV(exception_class_descriptor, fmt, args);
va_end(args);
}
-void Thread::ThrowNewExceptionV(const ThrowLocation& throw_location,
- const char* exception_class_descriptor,
+void Thread::ThrowNewExceptionV(const char* exception_class_descriptor,
const char* fmt, va_list ap) {
std::string msg;
StringAppendV(&msg, fmt, ap);
- ThrowNewException(throw_location, exception_class_descriptor, msg.c_str());
+ ThrowNewException(exception_class_descriptor, msg.c_str());
}
-void Thread::ThrowNewException(const ThrowLocation& throw_location,
- const char* exception_class_descriptor,
+void Thread::ThrowNewException(const char* exception_class_descriptor,
const char* msg) {
// Callers should either clear or call ThrowNewWrappedException.
AssertNoPendingExceptionForNewException(msg);
- ThrowNewWrappedException(throw_location, exception_class_descriptor, msg);
+ ThrowNewWrappedException(exception_class_descriptor, msg);
}
static mirror::ClassLoader* GetCurrentClassLoader(Thread* self)
@@ -1735,8 +1731,7 @@ static mirror::ClassLoader* GetCurrentClassLoader(Thread* self)
: nullptr;
}
-void Thread::ThrowNewWrappedException(const ThrowLocation& throw_location ATTRIBUTE_UNUSED,
- const char* exception_class_descriptor,
+void Thread::ThrowNewWrappedException(const char* exception_class_descriptor,
const char* msg) {
DCHECK_EQ(this, Thread::Current());
ScopedObjectAccessUnchecked soa(this);
@@ -1840,7 +1835,7 @@ void Thread::ThrowOutOfMemoryError(const char* msg) {
msg, (tls32_.throwing_OutOfMemoryError ? " (recursive case)" : ""));
if (!tls32_.throwing_OutOfMemoryError) {
tls32_.throwing_OutOfMemoryError = true;
- ThrowNewException(GetCurrentLocationForThrow(), "Ljava/lang/OutOfMemoryError;", msg);
+ ThrowNewException("Ljava/lang/OutOfMemoryError;", msg);
tls32_.throwing_OutOfMemoryError = false;
} else {
Dump(LOG(WARNING)); // The pre-allocated OOME has no stack, so help out and log one.
@@ -2071,14 +2066,6 @@ mirror::ArtMethod* Thread::GetCurrentMethod(uint32_t* dex_pc, bool abort_on_erro
return visitor.method_;
}
-ThrowLocation Thread::GetCurrentLocationForThrow() {
- Context* context = GetLongJumpContext();
- CurrentMethodVisitor visitor(this, context, true);
- visitor.WalkStack(false);
- ReleaseLongJumpContext(context);
- return ThrowLocation(visitor.this_object_, visitor.method_, visitor.dex_pc_);
-}
-
bool Thread::HoldsLock(mirror::Object* object) const {
if (object == nullptr) {
return false;
diff --git a/runtime/thread.h b/runtime/thread.h
index 325c821..2e9ae3c 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -41,7 +41,6 @@
#include "runtime_stats.h"
#include "stack.h"
#include "thread_state.h"
-#include "throw_location.h"
namespace art {
@@ -364,8 +363,6 @@ class Thread {
bool IsExceptionThrownByCurrentMethod(mirror::Throwable* exception) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- ThrowLocation GetCurrentLocationForThrow() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
void SetTopOfStack(StackReference<mirror::ArtMethod>* top_method) {
tlsPtr_.managed_stack.SetTopQuickFrame(top_method);
}
@@ -380,24 +377,19 @@ class Thread {
}
// If 'msg' is NULL, no detail message is set.
- void ThrowNewException(const ThrowLocation& throw_location,
- const char* exception_class_descriptor, const char* msg)
+ void ThrowNewException(const char* exception_class_descriptor, const char* msg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// If 'msg' is NULL, no detail message is set. An exception must be pending, and will be
// used as the new exception's cause.
- void ThrowNewWrappedException(const ThrowLocation& throw_location,
- const char* exception_class_descriptor,
- const char* msg)
+ void ThrowNewWrappedException(const char* exception_class_descriptor, const char* msg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void ThrowNewExceptionF(const ThrowLocation& throw_location,
- const char* exception_class_descriptor, const char* fmt, ...)
- __attribute__((format(printf, 4, 5)))
+ void ThrowNewExceptionF(const char* exception_class_descriptor, const char* fmt, ...)
+ __attribute__((format(printf, 3, 4)))
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void ThrowNewExceptionV(const ThrowLocation& throw_location,
- const char* exception_class_descriptor, const char* fmt, va_list ap)
+ void ThrowNewExceptionV(const char* exception_class_descriptor, const char* fmt, va_list ap)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// OutOfMemoryError is special, because we need to pre-allocate an instance.
diff --git a/runtime/throw_location.cc b/runtime/throw_location.cc
deleted file mode 100644
index 4d2aec0..0000000
--- a/runtime/throw_location.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "throw_location.h"
-
-#include "mirror/art_method-inl.h"
-#include "mirror/class-inl.h"
-#include "mirror/object-inl.h"
-#include "utils.h"
-
-namespace art {
-
-std::string ThrowLocation::Dump() const {
- if (method_ != nullptr) {
- return StringPrintf("%s:%d", PrettyMethod(method_).c_str(),
- method_->GetLineNumFromDexPC(dex_pc_));
- } else {
- return "unknown throw location";
- }
-}
-
-void ThrowLocation::VisitRoots(RootCallback* visitor, void* arg) {
- if (this_object_ != nullptr) {
- visitor(&this_object_, arg, RootInfo(kRootVMInternal));
- DCHECK(this_object_ != nullptr);
- }
- if (method_ != nullptr) {
- visitor(reinterpret_cast<mirror::Object**>(&method_), arg, RootInfo(kRootVMInternal));
- DCHECK(method_ != nullptr);
- }
-}
-
-} // namespace art
diff --git a/runtime/throw_location.h b/runtime/throw_location.h
deleted file mode 100644
index bec0da4..0000000
--- a/runtime/throw_location.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ART_RUNTIME_THROW_LOCATION_H_
-#define ART_RUNTIME_THROW_LOCATION_H_
-
-#include "object_callbacks.h"
-#include "base/macros.h"
-#include "base/mutex.h"
-#include "gc_root.h"
-
-#include <stdint.h>
-#include <string>
-
-namespace art {
-
-namespace mirror {
-class ArtMethod;
-class Object;
-} // mirror
-
-class PACKED(4) ThrowLocation {
- public:
- ThrowLocation() {
- Clear();
- }
-
- ThrowLocation(mirror::Object* throw_this_object, mirror::ArtMethod* throw_method,
- uint32_t throw_dex_pc) :
- this_object_(throw_this_object),
- method_(throw_method),
- dex_pc_(throw_dex_pc)
-#ifdef __LP64__
- , pad_(0)
-#endif
-
- {
-#ifdef __LP64__
- UNUSED(pad_);
-#endif
- }
-
- mirror::Object* GetThis() const {
- return this_object_;
- }
-
- mirror::ArtMethod* GetMethod() const {
- return method_;
- }
-
- uint32_t GetDexPc() const {
- return dex_pc_;
- }
-
- void Clear() {
- this_object_ = NULL;
- method_ = NULL;
- dex_pc_ = -1;
- }
-
- std::string Dump() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
- void VisitRoots(RootCallback* visitor, void* arg);
-
- private:
- // The 'this' reference of the throwing method.
- mirror::Object* this_object_;
- // The throwing method.
- mirror::ArtMethod* method_;
- // The instruction within the throwing method.
- uint32_t dex_pc_;
- // Ensure 8byte alignment on 64bit.
-#ifdef __LP64__
- uint32_t pad_;
-#endif
-};
-
-} // namespace art
-
-#endif // ART_RUNTIME_THROW_LOCATION_H_
diff --git a/runtime/transaction.cc b/runtime/transaction.cc
index c0fd7a5..2199021 100644
--- a/runtime/transaction.cc
+++ b/runtime/transaction.cc
@@ -75,8 +75,7 @@ void Transaction::ThrowInternalError(Thread* self, bool rethrow) {
CHECK(IsAborted()) << "Rethrow InternalError while transaction is not aborted";
}
std::string abort_msg(GetAbortMessage());
- self->ThrowNewException(self->GetCurrentLocationForThrow(), "Ljava/lang/InternalError;",
- abort_msg.c_str());
+ self->ThrowNewException("Ljava/lang/InternalError;", abort_msg.c_str());
}
bool Transaction::IsAborted() {