src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp
Print this page
rev 4136 : 7153771: array bound check elimination for c1
Summary: when possible optimize out array bound checks, inserting predicates when needed.
Reviewed-by:
@@ -322,11 +322,11 @@
//----------------------------------------------------------------------
void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
assert(x->is_pinned(),"");
- bool needs_range_check = true;
+ bool needs_range_check = x->compute_needs_range_check();
bool use_length = x->length() != NULL;
bool obj_store = x->elt_type() == T_ARRAY || x->elt_type() == T_OBJECT;
bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL ||
!get_jobject_constant(x->value())->is_null_object() ||
x->should_profile());
@@ -337,17 +337,14 @@
LIRItem length(this);
array.load_item();
index.load_nonconstant();
- if (use_length) {
- needs_range_check = x->compute_needs_range_check();
- if (needs_range_check) {
+ if (use_length && needs_range_check) {
length.set_instruction(x->length());
length.load_item();
}
- }
if (needs_store_check) {
value.load_item();
} else {
value.load_for_store(x->elt_type());
}