diff -r b1fe5872f8f0 -r 4493ad6de04d hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Mon Sep 26 08:51:36 2016 +0200 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Mon Sep 19 15:08:03 2016 +0200 @@ -147,10 +147,11 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index, int shift, int disp, BasicType type) { assert(base->is_register(), "must be"); + intx large_disp = disp; // accumulate fixed displacements if (index->is_constant()) { - disp += index->as_constant_ptr()->as_jint() << shift; + large_disp += (intx)(index->as_constant_ptr()->as_jint()) << shift; index = LIR_OprFact::illegalOpr; } @@ -161,31 +162,31 @@ __ shift_left(index, shift, tmp); index = tmp; } - if (disp != 0) { + if (large_disp != 0) { LIR_Opr tmp = new_pointer_register(); - if (Assembler::is_simm13(disp)) { - __ add(tmp, LIR_OprFact::intptrConst(disp), tmp); + if (Assembler::is_simm13(large_disp)) { + __ add(tmp, LIR_OprFact::intptrConst(large_disp), tmp); index = tmp; } else { - __ move(LIR_OprFact::intptrConst(disp), tmp); + __ move(LIR_OprFact::intptrConst(large_disp), tmp); __ add(tmp, index, tmp); index = tmp; } - disp = 0; + large_disp = 0; } - } else if (disp != 0 && !Assembler::is_simm13(disp)) { + } else if (large_disp != 0 && !Assembler::is_simm13(large_disp)) { // index is illegal so replace it with the displacement loaded into a register index = new_pointer_register(); - __ move(LIR_OprFact::intptrConst(disp), index); - disp = 0; + __ move(LIR_OprFact::intptrConst(large_disp), index); + large_disp = 0; } // at this point we either have base + index or base + displacement - if (disp == 0) { + if (large_disp == 0) { return new LIR_Address(base, index, type); } else { - assert(Assembler::is_simm13(disp), "must be"); - return new LIR_Address(base, disp, type); + assert(Assembler::is_simm13(large_disp), "must be"); + return new LIR_Address(base, large_disp, type); } } @@ -196,11 +197,11 @@ int shift = exact_log2(elem_size); LIR_Opr base_opr; - int offset = arrayOopDesc::base_offset_in_bytes(type); + intx offset = arrayOopDesc::base_offset_in_bytes(type); if (index_opr->is_constant()) { - int i = index_opr->as_constant_ptr()->as_jint(); - int array_offset = i * elem_size; + intx i = index_opr->as_constant_ptr()->as_jint(); + intx array_offset = i * elem_size; if (Assembler::is_simm13(array_offset + offset)) { base_opr = array_opr; offset = array_offset + offset;