Avoid direct access to length_.
Should use accessors for fields of any Java heap object. Interestingly
in this case, as the objects are packed GCC for ARM implements the word
load as 4 byte loads, so this code is more optimal.
Change-Id: Iafd3d8ee9f41fb19b3a68b3e90ad51a8acd3d61b
diff --git a/src/object.h b/src/object.h
index efd456e..63228bc 100644
--- a/src/object.h
+++ b/src/object.h
@@ -1110,7 +1110,7 @@
protected:
bool IsValidIndex(int32_t index) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- if (UNLIKELY(index < 0 || index >= length_)) {
+ if (UNLIKELY(index < 0 || index >= GetLength())) {
return ThrowArrayIndexOutOfBoundsException(index);
}
return true;