@@ -90,91 +90,111 @@ inline jdouble* typeArrayOopDesc::double_at_addr(int which) const {
9090}
9191
9292inline jbyte typeArrayOopDesc::byte_at (int which) const {
93+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
9394 ptrdiff_t offset = element_offset<jbyte>(which);
9495 return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
9596}
9697inline void typeArrayOopDesc::byte_at_put (int which, jbyte contents) {
98+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
9799 ptrdiff_t offset = element_offset<jbyte>(which);
98100 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
99101}
100102
101103inline jboolean typeArrayOopDesc::bool_at (int which) const {
104+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
102105 ptrdiff_t offset = element_offset<jboolean>(which);
103106 return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
104107}
105108inline void typeArrayOopDesc::bool_at_put (int which, jboolean contents) {
109+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
106110 ptrdiff_t offset = element_offset<jboolean>(which);
107111 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, jboolean (contents & 1 ));
108112}
109113
110114inline jchar typeArrayOopDesc::char_at (int which) const {
115+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
111116 ptrdiff_t offset = element_offset<jchar>(which);
112117 return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
113118}
114119inline void typeArrayOopDesc::char_at_put (int which, jchar contents) {
120+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
115121 ptrdiff_t offset = element_offset<jchar>(which);
116122 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
117123}
118124
119125inline jint typeArrayOopDesc::int_at (int which) const {
126+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
120127 ptrdiff_t offset = element_offset<jint>(which);
121128 return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
122129}
123130inline void typeArrayOopDesc::int_at_put (int which, jint contents) {
131+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
124132 ptrdiff_t offset = element_offset<jint>(which);
125133 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
126134}
127135
128136inline jshort typeArrayOopDesc::short_at (int which) const {
137+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
129138 ptrdiff_t offset = element_offset<jshort>(which);
130139 return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
131140}
132141inline void typeArrayOopDesc::short_at_put (int which, jshort contents) {
142+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
133143 ptrdiff_t offset = element_offset<jshort>(which);
134144 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
135145}
136146
137147inline jushort typeArrayOopDesc::ushort_at (int which) const {
148+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
138149 ptrdiff_t offset = element_offset<jushort>(which);
139150 return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
140151}
141152inline void typeArrayOopDesc::ushort_at_put (int which, jushort contents) {
153+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
142154 ptrdiff_t offset = element_offset<jushort>(which);
143155 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
144156}
145157
146158inline jlong typeArrayOopDesc::long_at (int which) const {
159+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
147160 ptrdiff_t offset = element_offset<jlong>(which);
148161 return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
149162}
150163inline void typeArrayOopDesc::long_at_put (int which, jlong contents) {
164+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
151165 ptrdiff_t offset = element_offset<jlong>(which);
152166 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
153167}
154168
155169inline jfloat typeArrayOopDesc::float_at (int which) const {
170+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
156171 ptrdiff_t offset = element_offset<jfloat>(which);
157172 return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
158173}
159174inline void typeArrayOopDesc::float_at_put (int which, jfloat contents) {
175+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
160176 ptrdiff_t offset = element_offset<jfloat>(which);
161177 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
162178}
163179
164180inline jdouble typeArrayOopDesc::double_at (int which) const {
181+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
165182 ptrdiff_t offset = element_offset<jdouble>(which);
166183 return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
167184}
168185inline void typeArrayOopDesc::double_at_put (int which, jdouble contents) {
186+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
169187 ptrdiff_t offset = element_offset<jdouble>(which);
170188 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
171189}
172190
173191inline jbyte typeArrayOopDesc::byte_at_acquire (int which) const {
192+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
174193 ptrdiff_t offset = element_offset<jbyte>(which);
175194 return HeapAccess<MO_ACQUIRE | IS_ARRAY>::load_at (as_oop (), offset);
176195}
177196inline void typeArrayOopDesc::release_byte_at_put (int which, jbyte contents) {
197+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
178198 ptrdiff_t offset = element_offset<jbyte>(which);
179199 HeapAccess<MO_RELEASE | IS_ARRAY>::store_at (as_oop (), offset, contents);
180200}
@@ -184,19 +204,23 @@ inline void typeArrayOopDesc::release_byte_at_put(int which, jbyte contents) {
184204// casting
185205#ifdef _LP64
186206inline Symbol* typeArrayOopDesc::symbol_at (int which) const {
207+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
187208 ptrdiff_t offset = element_offset<jlong>(which);
188209 return (Symbol*)(jlong) HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
189210}
190211inline void typeArrayOopDesc::symbol_at_put (int which, Symbol* contents) {
212+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
191213 ptrdiff_t offset = element_offset<jlong>(which);
192214 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, (jlong)contents);
193215}
194216#else
195217inline Symbol* typeArrayOopDesc::symbol_at (int which) const {
218+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
196219 ptrdiff_t offset = element_offset<jint>(which);
197220 return (Symbol*)(jint) HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
198221}
199222inline void typeArrayOopDesc::symbol_at_put (int which, Symbol* contents) {
223+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
200224 ptrdiff_t offset = element_offset<jint>(which);
201225 HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, (jint)contents);
202226}
0 commit comments