862 throw_if_not_2( throw_entry_point, Rscratch, ok);
863 }
864 void InterpreterMacroAssembler::throw_if_not_x( Condition ok_condition,
865 address throw_entry_point,
866 Register Rscratch ) {
867 Label ok;
868 if (ok_condition != never) {
869 throw_if_not_1_x( ok_condition, ok);
870 delayed()->nop();
871 }
872 throw_if_not_2( throw_entry_point, Rscratch, ok);
873 }
874
875 // Check that index is in range for array, then shift index by index_shift, and put arrayOop + shifted_index into res
876 // Note: res is still shy of address by array offset into object.
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);
919 }
920
921
922 void InterpreterMacroAssembler::get_constant_pool(Register Rdst) {
|
862 throw_if_not_2( throw_entry_point, Rscratch, ok);
863 }
864 void InterpreterMacroAssembler::throw_if_not_x( Condition ok_condition,
865 address throw_entry_point,
866 Register Rscratch ) {
867 Label ok;
868 if (ok_condition != never) {
869 throw_if_not_1_x( ok_condition, ok);
870 delayed()->nop();
871 }
872 throw_if_not_2( throw_entry_point, Rscratch, ok);
873 }
874
875 // Check that index is in range for array, then shift index by index_shift, and put arrayOop + shifted_index into res
876 // Note: res is still shy of address by array offset into object.
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) {
896 delayed()->sll(index, index_shift, index);
897 } else {
898 delayed()->add(array, index, res); // addr - const offset in index
899 }
900 // Pass the array to create more detailed exceptions.
901 // Convention: move aberrant index into Otos_i for exception message.
902 mov(index, Otos_i);
903 mov(array, G3_scratch);
904 throw_if_not_2(Interpreter::_throw_ArrayIndexOutOfBoundsException_entry, G4_scratch, index_ok);
905
906 // add offset if didn't do it in delay slot
907 if (index_shift > 0) { add(array, index, res); } // addr - const offset in index
908 }
909
910
911 void InterpreterMacroAssembler::index_check(Register array, Register index, int index_shift, Register tmp, Register res) {
912 assert_not_delayed();
913
914 // pop array
915 pop_ptr(array);
916
917 // check array
918 index_check_without_pop(array, index, index_shift, tmp, res);
919 }
920
921
922 void InterpreterMacroAssembler::get_const(Register Rdst) {
923 ld_ptr(Lmethod, in_bytes(Method::const_offset()), Rdst);
924 }
925
926
927 void InterpreterMacroAssembler::get_constant_pool(Register Rdst) {
|