< prev index next >

src/hotspot/cpu/x86/templateTable_x86.cpp

Print this page
rev 49948 : 8201593: Print array length in ArrayIndexOutOfBoundsException.
Reviewed-by: dholmes, mdoerr, smonteith


 740 
 741 void TemplateTable::index_check(Register array, Register index) {
 742   // Pop ptr into array
 743   __ pop_ptr(array);
 744   index_check_without_pop(array, index);
 745 }
 746 
 747 void TemplateTable::index_check_without_pop(Register array, Register index) {
 748   // destroys rbx
 749   // check array
 750   __ null_check(array, arrayOopDesc::length_offset_in_bytes());
 751   // sign extend index for use by indexed load
 752   __ movl2ptr(index, index);
 753   // check index
 754   __ cmpl(index, Address(array, arrayOopDesc::length_offset_in_bytes()));
 755   if (index != rbx) {
 756     // ??? convention: move aberrant index into rbx for exception message
 757     assert(rbx != array, "different registers");
 758     __ movl(rbx, index);
 759   }
 760   __ jump_cc(Assembler::aboveEqual,
 761              ExternalAddress(Interpreter::_throw_ArrayIndexOutOfBoundsException_entry));




 762 }
 763 
 764 
 765 void TemplateTable::iaload() {
 766   transition(itos, itos);
 767   // rax: index
 768   // rdx: array
 769   index_check(rdx, rax); // kills rbx
 770   __ movl(rax, Address(rdx, rax,
 771                        Address::times_4,
 772                        arrayOopDesc::base_offset_in_bytes(T_INT)));
 773 }
 774 
 775 void TemplateTable::laload() {
 776   transition(itos, ltos);
 777   // rax: index
 778   // rdx: array
 779   index_check(rdx, rax); // kills rbx
 780   NOT_LP64(__ mov(rbx, rax));
 781   // rbx,: index
 782   __ movptr(rax, Address(rdx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_LONG) + 0 * wordSize));
 783   NOT_LP64(__ movl(rdx, Address(rdx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_LONG) + 1 * wordSize)));




 740 
 741 void TemplateTable::index_check(Register array, Register index) {
 742   // Pop ptr into array
 743   __ pop_ptr(array);
 744   index_check_without_pop(array, index);
 745 }
 746 
 747 void TemplateTable::index_check_without_pop(Register array, Register index) {
 748   // destroys rbx
 749   // check array
 750   __ null_check(array, arrayOopDesc::length_offset_in_bytes());
 751   // sign extend index for use by indexed load
 752   __ movl2ptr(index, index);
 753   // check index
 754   __ cmpl(index, Address(array, arrayOopDesc::length_offset_in_bytes()));
 755   if (index != rbx) {
 756     // ??? convention: move aberrant index into rbx for exception message
 757     assert(rbx != array, "different registers");
 758     __ movl(rbx, index);
 759   }
 760   Label skip;
 761   __ jccb(Assembler::below, skip);
 762   // Pass array to create more detailed exceptions.
 763   __ mov(NOT_LP64(rax) LP64_ONLY(c_rarg1), array);
 764   __ jump(ExternalAddress(Interpreter::_throw_ArrayIndexOutOfBoundsException_entry));
 765   __ bind(skip);
 766 }

 767 
 768 void TemplateTable::iaload() {
 769   transition(itos, itos);
 770   // rax: index
 771   // rdx: array
 772   index_check(rdx, rax); // kills rbx
 773   __ movl(rax, Address(rdx, rax,
 774                        Address::times_4,
 775                        arrayOopDesc::base_offset_in_bytes(T_INT)));
 776 }
 777 
 778 void TemplateTable::laload() {
 779   transition(itos, ltos);
 780   // rax: index
 781   // rdx: array
 782   index_check(rdx, rax); // kills rbx
 783   NOT_LP64(__ mov(rbx, rax));
 784   // rbx,: index
 785   __ movptr(rax, Address(rdx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_LONG) + 0 * wordSize));
 786   NOT_LP64(__ movl(rdx, Address(rdx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_LONG) + 1 * wordSize)));


< prev index next >