@@ -90,91 +90,111 @@ inline jdouble* typeArrayOopDesc::double_at_addr(int which) const {
90
90
}
91
91
92
92
inline jbyte typeArrayOopDesc::byte_at (int which) const {
93
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
93
94
ptrdiff_t offset = element_offset<jbyte>(which);
94
95
return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
95
96
}
96
97
inline void typeArrayOopDesc::byte_at_put (int which, jbyte contents) {
98
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
97
99
ptrdiff_t offset = element_offset<jbyte>(which);
98
100
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
99
101
}
100
102
101
103
inline jboolean typeArrayOopDesc::bool_at (int which) const {
104
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
102
105
ptrdiff_t offset = element_offset<jboolean>(which);
103
106
return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
104
107
}
105
108
inline void typeArrayOopDesc::bool_at_put (int which, jboolean contents) {
109
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
106
110
ptrdiff_t offset = element_offset<jboolean>(which);
107
111
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, jboolean (contents & 1 ));
108
112
}
109
113
110
114
inline jchar typeArrayOopDesc::char_at (int which) const {
115
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
111
116
ptrdiff_t offset = element_offset<jchar>(which);
112
117
return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
113
118
}
114
119
inline void typeArrayOopDesc::char_at_put (int which, jchar contents) {
120
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
115
121
ptrdiff_t offset = element_offset<jchar>(which);
116
122
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
117
123
}
118
124
119
125
inline jint typeArrayOopDesc::int_at (int which) const {
126
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
120
127
ptrdiff_t offset = element_offset<jint>(which);
121
128
return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
122
129
}
123
130
inline void typeArrayOopDesc::int_at_put (int which, jint contents) {
131
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
124
132
ptrdiff_t offset = element_offset<jint>(which);
125
133
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
126
134
}
127
135
128
136
inline jshort typeArrayOopDesc::short_at (int which) const {
137
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
129
138
ptrdiff_t offset = element_offset<jshort>(which);
130
139
return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
131
140
}
132
141
inline void typeArrayOopDesc::short_at_put (int which, jshort contents) {
142
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
133
143
ptrdiff_t offset = element_offset<jshort>(which);
134
144
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
135
145
}
136
146
137
147
inline jushort typeArrayOopDesc::ushort_at (int which) const {
148
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
138
149
ptrdiff_t offset = element_offset<jushort>(which);
139
150
return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
140
151
}
141
152
inline void typeArrayOopDesc::ushort_at_put (int which, jushort contents) {
153
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
142
154
ptrdiff_t offset = element_offset<jushort>(which);
143
155
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
144
156
}
145
157
146
158
inline jlong typeArrayOopDesc::long_at (int which) const {
159
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
147
160
ptrdiff_t offset = element_offset<jlong>(which);
148
161
return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
149
162
}
150
163
inline void typeArrayOopDesc::long_at_put (int which, jlong contents) {
164
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
151
165
ptrdiff_t offset = element_offset<jlong>(which);
152
166
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
153
167
}
154
168
155
169
inline jfloat typeArrayOopDesc::float_at (int which) const {
170
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
156
171
ptrdiff_t offset = element_offset<jfloat>(which);
157
172
return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
158
173
}
159
174
inline void typeArrayOopDesc::float_at_put (int which, jfloat contents) {
175
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
160
176
ptrdiff_t offset = element_offset<jfloat>(which);
161
177
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
162
178
}
163
179
164
180
inline jdouble typeArrayOopDesc::double_at (int which) const {
181
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
165
182
ptrdiff_t offset = element_offset<jdouble>(which);
166
183
return HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
167
184
}
168
185
inline void typeArrayOopDesc::double_at_put (int which, jdouble contents) {
186
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
169
187
ptrdiff_t offset = element_offset<jdouble>(which);
170
188
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, contents);
171
189
}
172
190
173
191
inline jbyte typeArrayOopDesc::byte_at_acquire (int which) const {
192
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
174
193
ptrdiff_t offset = element_offset<jbyte>(which);
175
194
return HeapAccess<MO_ACQUIRE | IS_ARRAY>::load_at (as_oop (), offset);
176
195
}
177
196
inline void typeArrayOopDesc::release_byte_at_put (int which, jbyte contents) {
197
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
178
198
ptrdiff_t offset = element_offset<jbyte>(which);
179
199
HeapAccess<MO_RELEASE | IS_ARRAY>::store_at (as_oop (), offset, contents);
180
200
}
@@ -184,19 +204,23 @@ inline void typeArrayOopDesc::release_byte_at_put(int which, jbyte contents) {
184
204
// casting
185
205
#ifdef _LP64
186
206
inline Symbol* typeArrayOopDesc::symbol_at (int which) const {
207
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
187
208
ptrdiff_t offset = element_offset<jlong>(which);
188
209
return (Symbol*)(jlong) HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
189
210
}
190
211
inline void typeArrayOopDesc::symbol_at_put (int which, Symbol* contents) {
212
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
191
213
ptrdiff_t offset = element_offset<jlong>(which);
192
214
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, (jlong)contents);
193
215
}
194
216
#else
195
217
inline Symbol* typeArrayOopDesc::symbol_at (int which) const {
218
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
196
219
ptrdiff_t offset = element_offset<jint>(which);
197
220
return (Symbol*)(jint) HeapAccess<IS_ARRAY>::load_at (as_oop (), offset);
198
221
}
199
222
inline void typeArrayOopDesc::symbol_at_put (int which, Symbol* contents) {
223
+ assert (is_within_bounds (which), " index %d out of bounds %d" , which, length ());
200
224
ptrdiff_t offset = element_offset<jint>(which);
201
225
HeapAccess<IS_ARRAY>::store_at (as_oop (), offset, (jint)contents);
202
226
}
0 commit comments