1658 return basic_plus_adr(ary, offset); |
1658 return basic_plus_adr(ary, offset); |
1659 } |
1659 } |
1660 |
1660 |
1661 // must be correct type for alignment purposes |
1661 // must be correct type for alignment purposes |
1662 Node* base = basic_plus_adr(ary, header); |
1662 Node* base = basic_plus_adr(ary, header); |
1663 #ifdef _LP64 |
1663 idx = Compile::conv_I2X_index(&_gvn, idx, sizetype); |
1664 // The scaled index operand to AddP must be a clean 64-bit value. |
|
1665 // Java allows a 32-bit int to be incremented to a negative |
|
1666 // value, which appears in a 64-bit register as a large |
|
1667 // positive number. Using that large positive number as an |
|
1668 // operand in pointer arithmetic has bad consequences. |
|
1669 // On the other hand, 32-bit overflow is rare, and the possibility |
|
1670 // can often be excluded, if we annotate the ConvI2L node with |
|
1671 // a type assertion that its value is known to be a small positive |
|
1672 // number. (The prior range check has ensured this.) |
|
1673 // This assertion is used by ConvI2LNode::Ideal. |
|
1674 int index_max = max_jint - 1; // array size is max_jint, index is one less |
|
1675 if (sizetype != NULL) index_max = sizetype->_hi - 1; |
|
1676 const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax); |
|
1677 idx = _gvn.transform( new ConvI2LNode(idx, lidxtype) ); |
|
1678 #endif |
|
1679 Node* scale = _gvn.transform( new LShiftXNode(idx, intcon(shift)) ); |
1664 Node* scale = _gvn.transform( new LShiftXNode(idx, intcon(shift)) ); |
1680 return basic_plus_adr(ary, base, scale); |
1665 return basic_plus_adr(ary, base, scale); |
1681 } |
1666 } |
1682 |
1667 |
1683 //-------------------------load_array_element------------------------- |
1668 //-------------------------load_array_element------------------------- |