diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-03-10 11:03:29 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-03-10 14:51:11 +0000 |
commit | 0aa50ce2fb75bfc2e815a0c33adf9b049561923b (patch) | |
tree | 9a3f9603ab30d5cbc7fc21aee0ceb48bbb0dd25a /runtime/entrypoints | |
parent | e8e42f3548fd894f860912bb1b71ce6fa2d7daf3 (diff) | |
download | art-0aa50ce2fb75bfc2e815a0c33adf9b049561923b.zip art-0aa50ce2fb75bfc2e815a0c33adf9b049561923b.tar.gz art-0aa50ce2fb75bfc2e815a0c33adf9b049561923b.tar.bz2 |
Remove ThrowLocation.
Note that this is a cleanup change, and has no functionality change.
The ThrowLocation had no use anymore.
Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
Diffstat (limited to 'runtime/entrypoints')
-rw-r--r-- | runtime/entrypoints/entrypoint_utils-inl.h | 12 | ||||
-rw-r--r-- | runtime/entrypoints/entrypoint_utils.cc | 26 | ||||
-rw-r--r-- | runtime/entrypoints/quick/quick_field_entrypoints.cc | 36 | ||||
-rw-r--r-- | runtime/entrypoints/quick/quick_lock_entrypoints.cc | 8 | ||||
-rw-r--r-- | runtime/entrypoints/quick/quick_throw_entrypoints.cc | 7 |
5 files changed, 24 insertions, 65 deletions
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(); } |