< prev index next >

src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp

Print this page
rev 49869 : 8201593: Print array length in ArrayIndexOutOfBoundsException.
Reviewed-by: dholmes


  36 #if INCLUDE_ALL_GCS
  37 #include "gc/g1/g1BarrierSet.hpp"
  38 #endif // INCLUDE_ALL_GCS
  39 
  40 #define __ ce->masm()->
  41 
  42 void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
  43   __ bind(_entry);
  44   ce->store_parameter(_bci, 0);
  45   ce->store_parameter(_method->as_constant_ptr()->as_metadata(), 1);
  46   __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type);
  47   ce->add_call_info_here(_info);
  48   ce->verify_oop_map(_info);
  49 
  50   __ b(_continuation);
  51 }
  52 
  53 
  54 // TODO: ARM - is it possible to inline these stubs into the main code stream?
  55 
  56 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
  57                                bool throw_index_out_of_bounds_exception)
  58   : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception)
  59   , _index(index)
  60 {
  61   _info = info == NULL ? NULL : new CodeEmitInfo(info);
  62 }
  63 





  64 
  65 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
  66   __ bind(_entry);
  67 
  68   if (_info->deoptimize_on_exception()) {
  69 #ifdef AARCH64
  70     __ NOT_TESTED();
  71 #endif
  72     __ call(Runtime1::entry_for(Runtime1::predicate_failed_trap_id), relocInfo::runtime_call_type);
  73     ce->add_call_info_here(_info);
  74     ce->verify_oop_map(_info);
  75     debug_only(__ should_not_reach_here());
  76     return;
  77   }
  78   // Pass the array index on stack because all registers must be preserved
  79   ce->verify_reserved_argument_area_size(1);
  80   if (_index->is_cpu_register()) {
  81     __ str_32(_index->as_register(), Address(SP));
  82   } else {
  83     __ mov_slow(Rtemp, _index->as_jint()); // Rtemp should be OK in C1
  84     __ str_32(Rtemp, Address(SP));
  85   }


  86 
  87   if (_throw_index_out_of_bounds_exception) {
  88 #ifdef AARCH64
  89     __ NOT_TESTED();
  90 #endif
  91     __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type);
  92   } else {
  93     __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type);
  94   }
  95   ce->add_call_info_here(_info);
  96   ce->verify_oop_map(_info);
  97   DEBUG_ONLY(STOP("RangeCheck");)
  98 }
  99 
 100 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
 101   _info = new CodeEmitInfo(info);
 102 }
 103 
 104 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
 105   __ bind(_entry);




  36 #if INCLUDE_ALL_GCS
  37 #include "gc/g1/g1BarrierSet.hpp"
  38 #endif // INCLUDE_ALL_GCS
  39 
  40 #define __ ce->masm()->
  41 
  42 void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
  43   __ bind(_entry);
  44   ce->store_parameter(_bci, 0);
  45   ce->store_parameter(_method->as_constant_ptr()->as_metadata(), 1);
  46   __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type);
  47   ce->add_call_info_here(_info);
  48   ce->verify_oop_map(_info);
  49 
  50   __ b(_continuation);
  51 }
  52 
  53 
  54 // TODO: ARM - is it possible to inline these stubs into the main code stream?
  55 
  56 
  57 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array)
  58   : _throw_index_out_of_bounds_exception(false), _index(index), _array(array) {
  59   assert(info != NULL, "must have info");
  60   _info = new CodeEmitInfo(info);

  61 }
  62 
  63 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
  64   : _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) {
  65   assert(info != NULL, "must have info");
  66   _info = new CodeEmitInfo(info);
  67 }
  68 
  69 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
  70   __ bind(_entry);
  71 
  72   if (_info->deoptimize_on_exception()) {
  73 #ifdef AARCH64
  74     __ NOT_TESTED();
  75 #endif
  76     __ call(Runtime1::entry_for(Runtime1::predicate_failed_trap_id), relocInfo::runtime_call_type);
  77     ce->add_call_info_here(_info);
  78     ce->verify_oop_map(_info);
  79     debug_only(__ should_not_reach_here());
  80     return;
  81   }
  82   // Pass the array index on stack because all registers must be preserved
  83   ce->verify_reserved_argument_area_size(1);
  84   if (_index->is_cpu_register()) {
  85     __ str_32(_index->as_register(), Address(SP));
  86   } else {
  87     __ mov_slow(Rtemp, _index->as_jint()); // Rtemp should be OK in C1
  88     __ str_32(Rtemp, Address(SP));
  89   }
  90   __ mov_slow(Rtemp, _array->as_pointer_register());
  91   __ str(Rtemp, Address(SP, BytesPerWord)); // ??? Correct offset? Correct instruction?
  92 
  93   if (_throw_index_out_of_bounds_exception) {
  94 #ifdef AARCH64
  95     __ NOT_TESTED();
  96 #endif
  97     __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type);
  98   } else {
  99     __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type);
 100   }
 101   ce->add_call_info_here(_info);
 102   ce->verify_oop_map(_info);
 103   DEBUG_ONLY(STOP("RangeCheck");)
 104 }
 105 
 106 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
 107   _info = new CodeEmitInfo(info);
 108 }
 109 
 110 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
 111   __ bind(_entry);


< prev index next >