mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
7153771: array bound check elimination for c1
When possible optimize out array bound checks, inserting predicates when needed. Reviewed-by: never, kvn, twisti
This commit is contained in:
parent
2f4ecb86a2
commit
06ef4cddf7
40 changed files with 2861 additions and 153 deletions
|
@ -263,7 +263,7 @@ void LIRGenerator::store_stack_parameter (LIR_Opr item, ByteSize offset_from_sp)
|
|||
|
||||
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 ||
|
||||
|
@ -278,12 +278,10 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
|
|||
array.load_item();
|
||||
index.load_nonconstant();
|
||||
|
||||
if (use_length) {
|
||||
needs_range_check = x->compute_needs_range_check();
|
||||
if (needs_range_check) {
|
||||
length.set_instruction(x->length());
|
||||
length.load_item();
|
||||
}
|
||||
if (use_length && needs_range_check) {
|
||||
length.set_instruction(x->length());
|
||||
length.load_item();
|
||||
|
||||
}
|
||||
if (needs_store_check) {
|
||||
value.load_item();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue