< prev index next >

src/hotspot/share/c1/c1_LIRGenerator.cpp

Print this page

*** 1568,1580 **** --- 1568,1588 ---- ciValueKlass* elem_klass = value_array_klass->element_klass()->as_value_klass(); int array_header_size = value_array_klass->array_header_in_bytes(); #ifndef _LP64 LIR_Opr index_op = index.result(); + // FIXME -- on 32-bit, the shift below can overflow, so we need to check that + // the top (value_array_klass->log2_element_size()+1) bits of index_op must be zero, or + // else throw ArrayIndexOutOfBoundsException #else LIR_Opr index_op = new_register(T_LONG); + if (index.result()->is_constant()) { + jint const_index = index.result()->as_jint(); + __ move(LIR_OprFact::longConst(const_index), index_op); + } else { __ convert(Bytecodes::_i2l, index.result(), index_op); + } #endif // Need to shift manually, as LIR_Address can scale only up to 3. __ shift_left(index_op, value_array_klass->log2_element_size(), index_op); LIR_Opr elm_op = new_pointer_register();
< prev index next >