< prev index next >

src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp

Print this page
rev 49827 : 8201593: Print array length in ArrayIndexOutOfBoundsException.


  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(array == NULL), _index(index), _array(array)


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


< prev index next >