< prev index next >

src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp

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


  74 
  75   // input is NaN -> return 0
  76   __ bind(NaN);
  77   __ xorptr(result()->as_register(), result()->as_register());
  78 
  79   __ bind(do_return);
  80   __ jmp(_continuation);
  81 }
  82 
  83 void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
  84   __ bind(_entry);
  85   Metadata *m = _method->as_constant_ptr()->as_metadata();
  86   ce->store_parameter(m, 1);
  87   ce->store_parameter(_bci, 0);
  88   __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::counter_overflow_id)));
  89   ce->add_call_info_here(_info);
  90   ce->verify_oop_map(_info);
  91   __ jmp(_continuation);
  92 }
  93 
  94 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
  95                                bool throw_index_out_of_bounds_exception)
  96   : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception)
  97   , _index(index)
  98 {
  99   assert(info != NULL, "must have info");
 100   _info = new CodeEmitInfo(info);
 101 }
 102 





 103 
 104 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
 105   __ bind(_entry);
 106   if (_info->deoptimize_on_exception()) {
 107     address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
 108     __ call(RuntimeAddress(a));
 109     ce->add_call_info_here(_info);
 110     ce->verify_oop_map(_info);
 111     debug_only(__ should_not_reach_here());
 112     return;
 113   }
 114 
 115   // pass the array index on stack because all registers must be preserved
 116   if (_index->is_cpu_register()) {
 117     ce->store_parameter(_index->as_register(), 0);
 118   } else {
 119     ce->store_parameter(_index->as_jint(), 0);
 120   }
 121   Runtime1::StubID stub_id;
 122   if (_throw_index_out_of_bounds_exception) {
 123     stub_id = Runtime1::throw_index_exception_id;
 124   } else {
 125     stub_id = Runtime1::throw_range_check_failed_id;

 126   }
 127   __ call(RuntimeAddress(Runtime1::entry_for(stub_id)));
 128   ce->add_call_info_here(_info);
 129   ce->verify_oop_map(_info);
 130   debug_only(__ should_not_reach_here());
 131 }
 132 
 133 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
 134   _info = new CodeEmitInfo(info);
 135 }
 136 
 137 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
 138   __ bind(_entry);
 139   address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
 140   __ call(RuntimeAddress(a));
 141   ce->add_call_info_here(_info);
 142   ce->verify_oop_map(_info);
 143   debug_only(__ should_not_reach_here());
 144 }
 145 




  74 
  75   // input is NaN -> return 0
  76   __ bind(NaN);
  77   __ xorptr(result()->as_register(), result()->as_register());
  78 
  79   __ bind(do_return);
  80   __ jmp(_continuation);
  81 }
  82 
  83 void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
  84   __ bind(_entry);
  85   Metadata *m = _method->as_constant_ptr()->as_metadata();
  86   ce->store_parameter(m, 1);
  87   ce->store_parameter(_bci, 0);
  88   __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::counter_overflow_id)));
  89   ce->add_call_info_here(_info);
  90   ce->verify_oop_map(_info);
  91   __ jmp(_continuation);
  92 }
  93 
  94 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array)
  95   : _throw_index_out_of_bounds_exception(false), _index(index), _array(array) {



  96   assert(info != NULL, "must have info");
  97   _info = new CodeEmitInfo(info);
  98 }
  99 
 100 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
 101   : _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) {
 102   assert(info != NULL, "must have info");
 103   _info = new CodeEmitInfo(info);
 104 }
 105 
 106 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
 107   __ bind(_entry);
 108   if (_info->deoptimize_on_exception()) {
 109     address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
 110     __ call(RuntimeAddress(a));
 111     ce->add_call_info_here(_info);
 112     ce->verify_oop_map(_info);
 113     debug_only(__ should_not_reach_here());
 114     return;
 115   }
 116 
 117   // pass the array index on stack because all registers must be preserved
 118   if (_index->is_cpu_register()) {
 119     ce->store_parameter(_index->as_register(), 0);
 120   } else {
 121     ce->store_parameter(_index->as_jint(), 0);
 122   }
 123   Runtime1::StubID stub_id;
 124   if (_throw_index_out_of_bounds_exception) {
 125     stub_id = Runtime1::throw_index_exception_id;
 126   } else {
 127     stub_id = Runtime1::throw_range_check_failed_id;
 128     ce->store_parameter(_array->as_pointer_register(), 1);
 129   }
 130   __ call(RuntimeAddress(Runtime1::entry_for(stub_id)));
 131   ce->add_call_info_here(_info);
 132   ce->verify_oop_map(_info);
 133   debug_only(__ should_not_reach_here());
 134 }
 135 
 136 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
 137   _info = new CodeEmitInfo(info);
 138 }
 139 
 140 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
 141   __ bind(_entry);
 142   address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
 143   __ call(RuntimeAddress(a));
 144   ce->add_call_info_here(_info);
 145   ce->verify_oop_map(_info);
 146   debug_only(__ should_not_reach_here());
 147 }
 148 


< prev index next >