< prev index next >

src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp

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


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





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

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




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



  93   assert(info != NULL, "must have info");
  94   _info = new CodeEmitInfo(info);
  95 }
  96 
  97 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
  98   : _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) {
  99   assert(info != NULL, "must have info");
 100   _info = new CodeEmitInfo(info);
 101 }
 102 
 103 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
 104   __ bind(_entry);
 105   if (_info->deoptimize_on_exception()) {
 106     address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
 107     __ call(RuntimeAddress(a));
 108     ce->add_call_info_here(_info);
 109     ce->verify_oop_map(_info);
 110     debug_only(__ should_not_reach_here());
 111     return;
 112   }
 113 
 114   // pass the array index on stack because all registers must be preserved
 115   if (_index->is_cpu_register()) {
 116     ce->store_parameter(_index->as_register(), 0);
 117   } else {
 118     ce->store_parameter(_index->as_jint(), 0);
 119   }
 120   Runtime1::StubID stub_id;
 121   if (_throw_index_out_of_bounds_exception) {
 122     stub_id = Runtime1::throw_index_exception_id;
 123   } else {
 124     stub_id = Runtime1::throw_range_check_failed_id;
 125     ce->store_parameter(_array->as_pointer_register(), 1);
 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 


< prev index next >