Remove ThrowLocation.
Note that this is a cleanup change, and has no functionality change.
The ThrowLocation had no use anymore.
Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
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 @@
}
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 @@
} 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 @@
} 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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
*/
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 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
ScopedQuickEntrypointChecks sqec(self);
self->NoteSignalBeingHandled();
- ThrowLocation throw_location = self->GetCurrentLocationForThrow();
- ThrowNullPointerExceptionFromDexPC(throw_location);
+ ThrowNullPointerExceptionFromDexPC();
self->NoteSignalHandlerDone();
self->QuickDeliverException();
}