< prev index next >

src/hotspot/cpu/sparc/c1_CodeStubs_sparc.cpp

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


  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_CodeStubs.hpp"
  27 #include "c1/c1_FrameMap.hpp"
  28 #include "c1/c1_LIRAssembler.hpp"
  29 #include "c1/c1_MacroAssembler.hpp"
  30 #include "c1/c1_Runtime1.hpp"
  31 #include "nativeInst_sparc.hpp"
  32 #include "runtime/sharedRuntime.hpp"
  33 #include "utilities/macros.hpp"
  34 #include "vmreg_sparc.inline.hpp"
  35 
  36 #define __ ce->masm()->
  37 
  38 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
  39                                bool throw_index_out_of_bounds_exception)
  40   : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception)
  41   , _index(index)
  42 {
  43   assert(info != NULL, "must have info");
  44   _info = new CodeEmitInfo(info);
  45 }
  46 





  47 
  48 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
  49   __ bind(_entry);
  50 
  51   if (_info->deoptimize_on_exception()) {
  52     address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
  53     __ call(a, relocInfo::runtime_call_type);
  54     __ delayed()->nop();
  55     ce->add_call_info_here(_info);
  56     ce->verify_oop_map(_info);
  57     debug_only(__ should_not_reach_here());
  58     return;
  59   }
  60 
  61   if (_index->is_register()) {
  62     __ mov(_index->as_register(), G4);
  63   } else {
  64     __ set(_index->as_jint(), G4);
  65   }
  66   if (_throw_index_out_of_bounds_exception) {
  67     __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type);
  68   } else {

  69     __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type);
  70   }
  71   __ delayed()->nop();
  72   ce->add_call_info_here(_info);
  73   ce->verify_oop_map(_info);
  74   debug_only(__ should_not_reach_here());
  75 }
  76 
  77 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
  78   _info = new CodeEmitInfo(info);
  79 }
  80 
  81 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
  82   __ bind(_entry);
  83   address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
  84   __ call(a, relocInfo::runtime_call_type);
  85   __ delayed()->nop();
  86   ce->add_call_info_here(_info);
  87   ce->verify_oop_map(_info);
  88   debug_only(__ should_not_reach_here());




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_CodeStubs.hpp"
  27 #include "c1/c1_FrameMap.hpp"
  28 #include "c1/c1_LIRAssembler.hpp"
  29 #include "c1/c1_MacroAssembler.hpp"
  30 #include "c1/c1_Runtime1.hpp"
  31 #include "nativeInst_sparc.hpp"
  32 #include "runtime/sharedRuntime.hpp"
  33 #include "utilities/macros.hpp"
  34 #include "vmreg_sparc.inline.hpp"
  35 
  36 #define __ ce->masm()->
  37 
  38 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array)
  39   : _throw_index_out_of_bounds_exception(false), _index(index), _array(array) {



  40   assert(info != NULL, "must have info");
  41   _info = new CodeEmitInfo(info);
  42 }
  43 
  44 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
  45   : _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) {
  46   assert(info != NULL, "must have info");
  47   _info = new CodeEmitInfo(info);
  48 }
  49 
  50 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
  51   __ bind(_entry);
  52 
  53   if (_info->deoptimize_on_exception()) {
  54     address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
  55     __ call(a, relocInfo::runtime_call_type);
  56     __ delayed()->nop();
  57     ce->add_call_info_here(_info);
  58     ce->verify_oop_map(_info);
  59     debug_only(__ should_not_reach_here());
  60     return;
  61   }
  62 
  63   if (_index->is_register()) {
  64     __ mov(_index->as_register(), G4);
  65   } else {
  66     __ set(_index->as_jint(), G4);
  67   }
  68   if (_throw_index_out_of_bounds_exception) {
  69     __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type);
  70   } else {
  71     __ mov(_array->as_pointer_register(), G5);
  72     __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type);
  73   }
  74   __ delayed()->nop();
  75   ce->add_call_info_here(_info);
  76   ce->verify_oop_map(_info);
  77   debug_only(__ should_not_reach_here());
  78 }
  79 
  80 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
  81   _info = new CodeEmitInfo(info);
  82 }
  83 
  84 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
  85   __ bind(_entry);
  86   address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
  87   __ call(a, relocInfo::runtime_call_type);
  88   __ delayed()->nop();
  89   ce->add_call_info_here(_info);
  90   ce->verify_oop_map(_info);
  91   debug_only(__ should_not_reach_here());


< prev index next >