< prev index next >

src/hotspot/cpu/sparc/interp_masm_sparc.cpp

Print this page
rev 49800 : 8201593: Print array length in ArrayIndexOutOfBoundsException.


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

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

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




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


< prev index next >