< prev index next >

src/hotspot/cpu/sparc/interp_masm_sparc.cpp

Print this page
rev 49869 : 8201593: Print array length in ArrayIndexOutOfBoundsException.
Reviewed-by: dholmes


 877 
 878 void InterpreterMacroAssembler::index_check_without_pop(Register array, Register index, int index_shift, Register tmp, Register res) {
 879   assert_not_delayed();
 880 
 881   verify_oop(array);
 882   // sign extend since tos (index) can be a 32bit value
 883   sra(index, G0, index);
 884 
 885   // check array
 886   Label ptr_ok;
 887   tst(array);
 888   throw_if_not_1_x( notZero, ptr_ok );
 889   delayed()->ld( array, arrayOopDesc::length_offset_in_bytes(), tmp ); // check index
 890   throw_if_not_2( Interpreter::_throw_NullPointerException_entry, G3_scratch, ptr_ok);
 891 
 892   Label index_ok;
 893   cmp(index, tmp);
 894   throw_if_not_1_icc( lessUnsigned, index_ok );
 895   if (index_shift > 0)  delayed()->sll(index, index_shift, index);
 896   else                  delayed()->add(array, index, res); // addr - const offset in index

 897   // convention: move aberrant index into G3_scratch for exception message
 898   mov(index, G3_scratch);

 899   throw_if_not_2( Interpreter::_throw_ArrayIndexOutOfBoundsException_entry, G4_scratch, index_ok);
 900 
 901   // add offset if didn't do it in delay slot
 902   if (index_shift > 0)   add(array, index, res); // addr - const offset in index
 903 }
 904 
 905 
 906 void InterpreterMacroAssembler::index_check(Register array, Register index, int index_shift, Register tmp, Register res) {
 907   assert_not_delayed();
 908 
 909   // pop array
 910   pop_ptr(array);
 911 
 912   // check array
 913   index_check_without_pop(array, index, index_shift, tmp, res);
 914 }
 915 
 916 
 917 void InterpreterMacroAssembler::get_const(Register Rdst) {
 918   ld_ptr(Lmethod, in_bytes(Method::const_offset()), Rdst);




 877 
 878 void InterpreterMacroAssembler::index_check_without_pop(Register array, Register index, int index_shift, Register tmp, Register res) {
 879   assert_not_delayed();
 880 
 881   verify_oop(array);
 882   // sign extend since tos (index) can be a 32bit value
 883   sra(index, G0, index);
 884 
 885   // check array
 886   Label ptr_ok;
 887   tst(array);
 888   throw_if_not_1_x( notZero, ptr_ok );
 889   delayed()->ld( array, arrayOopDesc::length_offset_in_bytes(), tmp ); // check index
 890   throw_if_not_2( Interpreter::_throw_NullPointerException_entry, G3_scratch, ptr_ok);
 891 
 892   Label index_ok;
 893   cmp(index, tmp);
 894   throw_if_not_1_icc( lessUnsigned, index_ok );
 895   if (index_shift > 0)  delayed()->sll(index, index_shift, index);
 896   else                  delayed()->add(array, index, res); // addr - const offset in index
 897   // Pass the array to create more detailed exceptions.
 898   // convention: move aberrant index into G3_scratch for exception message
 899   mov(index, Otos_i);
 900   mov(array, G3_scratch);
 901   throw_if_not_2( Interpreter::_throw_ArrayIndexOutOfBoundsException_entry, G4_scratch, index_ok);
 902 
 903   // add offset if didn't do it in delay slot
 904   if (index_shift > 0)   add(array, index, res); // addr - const offset in index
 905 }
 906 
 907 
 908 void InterpreterMacroAssembler::index_check(Register array, Register index, int index_shift, Register tmp, Register res) {
 909   assert_not_delayed();
 910 
 911   // pop array
 912   pop_ptr(array);
 913 
 914   // check array
 915   index_check_without_pop(array, index, index_shift, tmp, res);
 916 }
 917 
 918 
 919 void InterpreterMacroAssembler::get_const(Register Rdst) {
 920   ld_ptr(Lmethod, in_bytes(Method::const_offset()), Rdst);


< prev index next >