diff -r bf691f42c812 -r dedd5ddb0f95 hotspot/src/share/vm/opto/compile.cpp --- a/hotspot/src/share/vm/opto/compile.cpp Fri Feb 20 14:14:08 2015 -0800 +++ b/hotspot/src/share/vm/opto/compile.cpp Tue Feb 24 07:39:22 2015 -0800 @@ -42,6 +42,7 @@ #include "opto/chaitin.hpp" #include "opto/compile.hpp" #include "opto/connode.hpp" +#include "opto/convertnode.hpp" #include "opto/divnode.hpp" #include "opto/escape.hpp" #include "opto/idealGraphPrinter.hpp" @@ -3867,6 +3868,26 @@ return SSC_full_test; } +Node* Compile::conv_I2X_index(PhaseGVN *phase, Node* idx, const TypeInt* sizetype) { +#ifdef _LP64 + // The scaled index operand to AddP must be a clean 64-bit value. + // Java allows a 32-bit int to be incremented to a negative + // value, which appears in a 64-bit register as a large + // positive number. Using that large positive number as an + // operand in pointer arithmetic has bad consequences. + // On the other hand, 32-bit overflow is rare, and the possibility + // can often be excluded, if we annotate the ConvI2L node with + // a type assertion that its value is known to be a small positive + // number. (The prior range check has ensured this.) + // This assertion is used by ConvI2LNode::Ideal. + int index_max = max_jint - 1; // array size is max_jint, index is one less + if (sizetype != NULL) index_max = sizetype->_hi - 1; + const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax); + idx = phase->transform(new ConvI2LNode(idx, lidxtype)); +#endif + return idx; +} + // The message about the current inlining is accumulated in // _print_inlining_stream and transfered into the _print_inlining_list // once we know whether inlining succeeds or not. For regular