261 //---------------------------------------------------------------------- |
261 //---------------------------------------------------------------------- |
262 |
262 |
263 |
263 |
264 void LIRGenerator::do_StoreIndexed(StoreIndexed* x) { |
264 void LIRGenerator::do_StoreIndexed(StoreIndexed* x) { |
265 assert(x->is_pinned(),""); |
265 assert(x->is_pinned(),""); |
266 bool needs_range_check = true; |
266 bool needs_range_check = x->compute_needs_range_check(); |
267 bool use_length = x->length() != NULL; |
267 bool use_length = x->length() != NULL; |
268 bool obj_store = x->elt_type() == T_ARRAY || x->elt_type() == T_OBJECT; |
268 bool obj_store = x->elt_type() == T_ARRAY || x->elt_type() == T_OBJECT; |
269 bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL || |
269 bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL || |
270 !get_jobject_constant(x->value())->is_null_object() || |
270 !get_jobject_constant(x->value())->is_null_object() || |
271 x->should_profile()); |
271 x->should_profile()); |
276 LIRItem length(this); |
276 LIRItem length(this); |
277 |
277 |
278 array.load_item(); |
278 array.load_item(); |
279 index.load_nonconstant(); |
279 index.load_nonconstant(); |
280 |
280 |
281 if (use_length) { |
281 if (use_length && needs_range_check) { |
282 needs_range_check = x->compute_needs_range_check(); |
282 length.set_instruction(x->length()); |
283 if (needs_range_check) { |
283 length.load_item(); |
284 length.set_instruction(x->length()); |
284 |
285 length.load_item(); |
|
286 } |
|
287 } |
285 } |
288 if (needs_store_check) { |
286 if (needs_store_check) { |
289 value.load_item(); |
287 value.load_item(); |
290 } else { |
288 } else { |
291 value.load_for_store(x->elt_type()); |
289 value.load_for_store(x->elt_type()); |