src/share/vm/c1/c1_CodeStubs.hpp

Print this page
rev 4136 : 7153771: array bound check elimination for c1
Summary: when possible optimize out array bound checks, inserting predicates when needed.
Reviewed-by:


 149  private:
 150   CodeEmitInfo* _info;
 151   LIR_Opr       _index;
 152   bool          _throw_index_out_of_bounds_exception;
 153 
 154  public:
 155   RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, bool throw_index_out_of_bounds_exception = false);
 156   virtual void emit_code(LIR_Assembler* e);
 157   virtual CodeEmitInfo* info() const             { return _info; }
 158   virtual bool is_exception_throw_stub() const   { return true; }
 159   virtual bool is_range_check_stub() const       { return true; }
 160   virtual void visit(LIR_OpVisitState* visitor) {
 161     visitor->do_slow_case(_info);
 162     visitor->do_input(_index);
 163   }
 164 #ifndef PRODUCT
 165   virtual void print_name(outputStream* out) const { out->print("RangeCheckStub"); }
 166 #endif // PRODUCT
 167 };
 168 
















 169 
 170 class DivByZeroStub: public CodeStub {
 171  private:
 172   CodeEmitInfo* _info;
 173   int           _offset;
 174 
 175  public:
 176   DivByZeroStub(CodeEmitInfo* info)
 177     : _info(info), _offset(-1) {
 178   }
 179   DivByZeroStub(int offset, CodeEmitInfo* info)
 180     : _info(info), _offset(offset) {
 181   }
 182   virtual void emit_code(LIR_Assembler* e);
 183   virtual CodeEmitInfo* info() const             { return _info; }
 184   virtual bool is_exception_throw_stub() const   { return true; }
 185   virtual bool is_divbyzero_stub() const         { return true; }
 186   virtual void visit(LIR_OpVisitState* visitor) {
 187     visitor->do_slow_case(_info);
 188   }




 149  private:
 150   CodeEmitInfo* _info;
 151   LIR_Opr       _index;
 152   bool          _throw_index_out_of_bounds_exception;
 153 
 154  public:
 155   RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, bool throw_index_out_of_bounds_exception = false);
 156   virtual void emit_code(LIR_Assembler* e);
 157   virtual CodeEmitInfo* info() const             { return _info; }
 158   virtual bool is_exception_throw_stub() const   { return true; }
 159   virtual bool is_range_check_stub() const       { return true; }
 160   virtual void visit(LIR_OpVisitState* visitor) {
 161     visitor->do_slow_case(_info);
 162     visitor->do_input(_index);
 163   }
 164 #ifndef PRODUCT
 165   virtual void print_name(outputStream* out) const { out->print("RangeCheckStub"); }
 166 #endif // PRODUCT
 167 };
 168 
 169 // stub used when predicate fails and deoptimization is needed
 170 class PredicateFailedStub: public CodeStub {
 171  private:
 172   CodeEmitInfo* _info;
 173 
 174  public:
 175   PredicateFailedStub(CodeEmitInfo* info);
 176   virtual void emit_code(LIR_Assembler* e);
 177   virtual CodeEmitInfo* info() const             { return _info; }
 178   virtual void visit(LIR_OpVisitState* visitor) {
 179     visitor->do_slow_case(_info);
 180   }
 181 #ifndef PRODUCT
 182   virtual void print_name(outputStream* out) const { out->print("PredicateFailedStub"); }
 183 #endif // PRODUCT
 184 };
 185 
 186 class DivByZeroStub: public CodeStub {
 187  private:
 188   CodeEmitInfo* _info;
 189   int           _offset;
 190 
 191  public:
 192   DivByZeroStub(CodeEmitInfo* info)
 193     : _info(info), _offset(-1) {
 194   }
 195   DivByZeroStub(int offset, CodeEmitInfo* info)
 196     : _info(info), _offset(offset) {
 197   }
 198   virtual void emit_code(LIR_Assembler* e);
 199   virtual CodeEmitInfo* info() const             { return _info; }
 200   virtual bool is_exception_throw_stub() const   { return true; }
 201   virtual bool is_divbyzero_stub() const         { return true; }
 202   virtual void visit(LIR_OpVisitState* visitor) {
 203     visitor->do_slow_case(_info);
 204   }