Make Array's throw routines void.
The "bool" return type of Array::ThrowArrayIndexOutOfBoundsException and
Array::ThrowArrayStoreException is useless. Make them void.
Note on ARM, this removes a "cmp" instruction in AGET/APUT instructions.
Change-Id: I843e895aa4622ca56aaa3f2eb2d5b5100a92c1ae
diff --git a/src/mirror/array.cc b/src/mirror/array.cc
index e2e63a6..88cd309 100644
--- a/src/mirror/array.cc
+++ b/src/mirror/array.cc
@@ -134,14 +134,12 @@
return new_array;
}
-bool Array::ThrowArrayIndexOutOfBoundsException(int32_t index) const {
+void Array::ThrowArrayIndexOutOfBoundsException(int32_t index) const {
art::ThrowArrayIndexOutOfBoundsException(index, GetLength());
- return false;
}
-bool Array::ThrowArrayStoreException(Object* object) const {
+void Array::ThrowArrayStoreException(Object* object) const {
art::ThrowArrayStoreException(object->GetClass(), this->GetClass());
- return false;
}
template<typename T>
diff --git a/src/mirror/array.h b/src/mirror/array.h
index 33c0aeb..98b8ea0 100644
--- a/src/mirror/array.h
+++ b/src/mirror/array.h
@@ -73,15 +73,16 @@
bool IsValidIndex(int32_t index) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
if (UNLIKELY(index < 0 || index >= GetLength())) {
- return ThrowArrayIndexOutOfBoundsException(index);
+ ThrowArrayIndexOutOfBoundsException(index);
+ return false;
}
return true;
}
protected:
- bool ThrowArrayIndexOutOfBoundsException(int32_t index) const
+ void ThrowArrayIndexOutOfBoundsException(int32_t index) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- bool ThrowArrayStoreException(Object* object) const
+ void ThrowArrayStoreException(Object* object) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
private: