int offset_from_char_index(int index) const { GUARANTEE(is_char_array(), "Array must be char array"); GUARANTEE(is_within_bounds(index), "Array index out of bounds"); return base_offset() + (index * sizeof(jchar)); }
int offset_from_ubyte_index(int index) const { GUARANTEE(ObjectHeap::is_gc_active() || is_byte_array(), "Array must be byte array"); GUARANTEE(is_within_bounds(index), "Array index out of bounds"); return base_offset() + (index * sizeof(jubyte)); }
int offset_from_bool_index(int index) const { GUARANTEE(is_bool_array(), "Array must be bool array"); GUARANTEE(is_within_bounds(index), "Array index out of bounds"); return base_offset() + (index * sizeof(jboolean)); }
int offset_from_double_index(int index) const { GUARANTEE(is_double_array(), "Array must be double array"); GUARANTEE(is_within_bounds(index), "Array index out of bounds"); return base_offset() + (index * sizeof(jdouble)); }
int offset_from_float_index(int index) const { GUARANTEE(is_float_array(), "Array must be float array"); GUARANTEE(is_within_bounds(index), "Array index out of bounds"); return base_offset() + (index * sizeof(jfloat)); }
int offset_from_long_index(int index) const { GUARANTEE(is_long_array(), "Array must be long array"); GUARANTEE(is_within_bounds(index), "Array index out of bounds"); return base_offset() + (index * sizeof(jlong)); }
// Returns the address of the index'th element oop* obj_at_addr(int index) const { assert(is_within_bounds(index), "index out of bounds"); return &base()[index]; }
template <class T> T* obj_at_addr(int index) const { assert(is_within_bounds(index), "index out of bounds"); return &((T*)base())[index]; }