< 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


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





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


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




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

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


< prev index next >