--- old/src/share/vm/opto/parse2.cpp 2016-01-15 16:13:05.025000266 +0100 +++ new/src/share/vm/opto/parse2.cpp 2016-01-15 16:13:04.917000271 +0100 @@ -166,7 +166,9 @@ // Check for always knowing you are throwing a range-check exception if (stopped()) return top(); - Node* ptr = array_element_address(ary, idx, type, sizetype); + // Make array address computation control dependent to prevent it + // from floating above the range check during loop optimizations. + Node* ptr = array_element_address(ary, idx, type, sizetype, control()); if (result2 != NULL) *result2 = elemtype; @@ -466,12 +468,14 @@ // of all possible ranges for a switch statement // The key_val input must be converted to a pointer offset and scaled. // Compare Parse::array_addressing above. -#ifdef _LP64 + // Clean the 32-bit int into a real 64-bit offset. // Otherwise, the jint value 0 might turn into an offset of 0x0800000000. - const TypeLong* lkeytype = TypeLong::make(CONST64(0), num_cases-1, Type::WidenMin); - key_val = _gvn.transform( new ConvI2LNode(key_val, lkeytype) ); -#endif + const TypeInt* ikeytype = TypeInt::make(0, num_cases, Type::WidenMin); + // Make I2L conversion control dependent to prevent it from + // floating above the range check during loop optimizations. + key_val = C->conv_I2X_index(&_gvn, key_val, ikeytype, control()); + // Shift the value by wordsize so we have an index into the table, rather // than a switch value Node *shiftWord = _gvn.MakeConX(wordSize);