1424 const TypeInt* length_type = phase->find_int_type(length);
1425 const TypeAryPtr* ary_type = oop_type->isa_aryptr();
1426
1427 if (ary_type != NULL && length_type != NULL) {
1428 const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
1429 if (narrow_length_type != length_type) {
1430 // Assert one of:
1431 // - the narrow_length is 0
1432 // - the narrow_length is not wider than length
1433 assert(narrow_length_type == TypeInt::ZERO ||
1434 length_type->is_con() && narrow_length_type->is_con() &&
1435 (narrow_length_type->_hi <= length_type->_lo) ||
1436 (narrow_length_type->_hi <= length_type->_hi &&
1437 narrow_length_type->_lo >= length_type->_lo),
1438 "narrow type must be narrower than length type");
1439
1440 // Return NULL if new nodes are not allowed
1441 if (!allow_new_nodes) return NULL;
1442 // Create a cast which is control dependent on the initialization to
1443 // propagate the fact that the array length must be positive.
1444 length = new CastIINode(length, narrow_length_type);
1445 length->set_req(0, initialization()->proj_out_or_null(0));
1446 }
1447 }
1448
1449 return length;
1450 }
1451
1452 //=============================================================================
1453 uint LockNode::size_of() const { return sizeof(*this); }
1454
1455 // Redundant lock elimination
1456 //
1457 // There are various patterns of locking where we release and
1458 // immediately reacquire a lock in a piece of code where no operations
1459 // occur in between that would be observable. In those cases we can
1460 // skip releasing and reacquiring the lock without violating any
1461 // fairness requirements. Doing this around a loop could cause a lock
1462 // to be held for a very long time so we concentrate on non-looping
1463 // control flow. We also require that the operations are fully
1464 // redundant meaning that we don't introduce new lock operations on
1465 // some paths so to be able to eliminate it on others ala PRE. This
|
1424 const TypeInt* length_type = phase->find_int_type(length);
1425 const TypeAryPtr* ary_type = oop_type->isa_aryptr();
1426
1427 if (ary_type != NULL && length_type != NULL) {
1428 const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
1429 if (narrow_length_type != length_type) {
1430 // Assert one of:
1431 // - the narrow_length is 0
1432 // - the narrow_length is not wider than length
1433 assert(narrow_length_type == TypeInt::ZERO ||
1434 length_type->is_con() && narrow_length_type->is_con() &&
1435 (narrow_length_type->_hi <= length_type->_lo) ||
1436 (narrow_length_type->_hi <= length_type->_hi &&
1437 narrow_length_type->_lo >= length_type->_lo),
1438 "narrow type must be narrower than length type");
1439
1440 // Return NULL if new nodes are not allowed
1441 if (!allow_new_nodes) return NULL;
1442 // Create a cast which is control dependent on the initialization to
1443 // propagate the fact that the array length must be positive.
1444 InitializeNode* init = initialization();
1445 assert(init != NULL, "initialization not found");
1446 length = new CastIINode(length, narrow_length_type);
1447 length->set_req(0, init->proj_out_or_null(0));
1448 }
1449 }
1450
1451 return length;
1452 }
1453
1454 //=============================================================================
1455 uint LockNode::size_of() const { return sizeof(*this); }
1456
1457 // Redundant lock elimination
1458 //
1459 // There are various patterns of locking where we release and
1460 // immediately reacquire a lock in a piece of code where no operations
1461 // occur in between that would be observable. In those cases we can
1462 // skip releasing and reacquiring the lock without violating any
1463 // fairness requirements. Doing this around a loop could cause a lock
1464 // to be held for a very long time so we concentrate on non-looping
1465 // control flow. We also require that the operations are fully
1466 // redundant meaning that we don't introduce new lock operations on
1467 // some paths so to be able to eliminate it on others ala PRE. This
|