mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 02:24:40 +02:00
8201593: Print array length in ArrayIndexOutOfBoundsException
Reviewed-by: dholmes, mdoerr, smonteith, shade, rriggs
This commit is contained in:
parent
b812ae6e51
commit
ac3043c692
34 changed files with 675 additions and 142 deletions
|
@ -50,14 +50,18 @@ void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
|
|||
|
||||
// TODO: ARM - is it possible to inline these stubs into the main code stream?
|
||||
|
||||
RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
|
||||
bool throw_index_out_of_bounds_exception)
|
||||
: _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception)
|
||||
, _index(index)
|
||||
{
|
||||
_info = info == NULL ? NULL : new CodeEmitInfo(info);
|
||||
|
||||
RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array)
|
||||
: _throw_index_out_of_bounds_exception(false), _index(index), _array(array) {
|
||||
assert(info != NULL, "must have info");
|
||||
_info = new CodeEmitInfo(info);
|
||||
}
|
||||
|
||||
RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
|
||||
: _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) {
|
||||
assert(info != NULL, "must have info");
|
||||
_info = new CodeEmitInfo(info);
|
||||
}
|
||||
|
||||
void RangeCheckStub::emit_code(LIR_Assembler* ce) {
|
||||
__ bind(_entry);
|
||||
|
@ -73,7 +77,7 @@ void RangeCheckStub::emit_code(LIR_Assembler* ce) {
|
|||
return;
|
||||
}
|
||||
// Pass the array index on stack because all registers must be preserved
|
||||
ce->verify_reserved_argument_area_size(1);
|
||||
ce->verify_reserved_argument_area_size(_throw_index_out_of_bounds_exception ? 1 : 2);
|
||||
if (_index->is_cpu_register()) {
|
||||
__ str_32(_index->as_register(), Address(SP));
|
||||
} else {
|
||||
|
@ -87,6 +91,7 @@ void RangeCheckStub::emit_code(LIR_Assembler* ce) {
|
|||
#endif
|
||||
__ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type);
|
||||
} else {
|
||||
__ str(_array->as_pointer_register(), Address(SP, BytesPerWord)); // ??? Correct offset? Correct instruction?
|
||||
__ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type);
|
||||
}
|
||||
ce->add_call_info_here(_info);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue