< prev index next >

src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp

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

@@ -48,18 +48,22 @@
 }
 
 
 // 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);
 
   if (_info->deoptimize_on_exception()) {

@@ -71,17 +75,19 @@
     ce->verify_oop_map(_info);
     debug_only(__ should_not_reach_here());
     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(2);
   if (_index->is_cpu_register()) {
     __ str_32(_index->as_register(), Address(SP));
   } else {
     __ mov_slow(Rtemp, _index->as_jint()); // Rtemp should be OK in C1
     __ str_32(Rtemp, Address(SP));
   }
+  __ mov_slow(Rtemp, _array->as_pointer_register());
+  __ str(Rtemp, Address(SP, BytesPerWord)); // ??? Correct offset? Correct instruction?
 
   if (_throw_index_out_of_bounds_exception) {
 #ifdef AARCH64
     __ NOT_TESTED();
 #endif
< prev index next >