mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-09 01:48:34 +00:00
8314468: Improve Compiler loops
Co-authored-by: Dean Long <dlong@openjdk.org> Reviewed-by: rhalade, mschoene, iveresov, kvn
This commit is contained in:
parent
fac49b8375
commit
ed238e8b88
@ -421,8 +421,11 @@ void RangeCheckEliminator::add_access_indexed_info(InstructionList &indices, int
|
||||
aii->_max = idx;
|
||||
aii->_list = new AccessIndexedList();
|
||||
} else if (idx >= aii->_min && idx <= aii->_max) {
|
||||
remove_range_check(ai);
|
||||
return;
|
||||
// Guard against underflow/overflow (see 'range_cond' check in RangeCheckEliminator::in_block_motion)
|
||||
if (aii->_max < 0 || (aii->_max + min_jint) <= aii->_min) {
|
||||
remove_range_check(ai);
|
||||
return;
|
||||
}
|
||||
}
|
||||
aii->_min = MIN2(aii->_min, idx);
|
||||
aii->_max = MAX2(aii->_max, idx);
|
||||
@ -484,7 +487,7 @@ void RangeCheckEliminator::in_block_motion(BlockBegin *block, AccessIndexedList
|
||||
if (ao->op() == Bytecodes::_isub) {
|
||||
value = -value;
|
||||
}
|
||||
base += value;
|
||||
base = java_add(base, value);
|
||||
last_integer = base;
|
||||
last_instruction = other;
|
||||
}
|
||||
@ -506,12 +509,12 @@ void RangeCheckEliminator::in_block_motion(BlockBegin *block, AccessIndexedList
|
||||
assert(info != nullptr, "Info must not be null");
|
||||
|
||||
// if idx < 0, max > 0, max + idx may fall between 0 and
|
||||
// length-1 and if min < 0, min + idx may overflow and be >=
|
||||
// length-1 and if min < 0, min + idx may underflow/overflow and be >=
|
||||
// 0. The predicate wouldn't trigger but some accesses could
|
||||
// be with a negative index. This test guarantees that for the
|
||||
// min and max value that are kept the predicate can't let
|
||||
// some incorrect accesses happen.
|
||||
bool range_cond = (info->_max < 0 || info->_max + min_jint <= info->_min);
|
||||
bool range_cond = (info->_max < 0 || (info->_max + min_jint) <= info->_min);
|
||||
|
||||
// Generate code only if more than 2 range checks can be eliminated because of that.
|
||||
// 2 because at least 2 comparisons are done
|
||||
@ -859,7 +862,7 @@ void RangeCheckEliminator::process_access_indexed(BlockBegin *loop_header, Block
|
||||
);
|
||||
|
||||
remove_range_check(ai);
|
||||
} else if (_optimistic && loop_header) {
|
||||
} else if (false && _optimistic && loop_header) {
|
||||
assert(ai->array(), "Array must not be null!");
|
||||
assert(ai->index(), "Index must not be null!");
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user