< prev index next >

src/hotspot/share/oops/arrayOop.hpp

Print this page
rev 49674 : 8198285: More consistent Access API for arraycopy

*** 86,95 **** --- 86,107 ---- // Returns the address of the first element. The elements in the array will not // relocate from this address until a subsequent thread transition. inline void* base(BasicType type) const; inline void* base_raw(BasicType type) const; // GC barrier invariant + template <typename T> + static T* obj_offset_to_raw(arrayOop obj, size_t offset_in_bytes, T* raw) { + if (obj != NULL) { + assert(raw == NULL, "either raw or in-heap"); + char* base = reinterpret_cast<char*>((void*) obj); + raw = reinterpret_cast<T*>(base + offset_in_bytes); + } else { + assert(raw != NULL, "either raw or in-heap"); + } + return raw; + } + // Tells whether index is within bounds. bool is_within_bounds(int index) const { return 0 <= index && index < length(); } // Accessors for instance variable which is not a C++ declared nonstatic // field.
< prev index next >