< prev index next >

src/hotspot/share/c1/c1_CodeStubs.hpp

Print this page
rev 49887 : 8201593: Print array length in ArrayIndexOutOfBoundsException.
Reviewed-by: dholmes, mdoerr
   1 /*
   2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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  *


 130   LIR_Opr         result()   { return _result; }
 131 
 132   virtual void emit_code(LIR_Assembler* e);
 133   virtual void visit(LIR_OpVisitState* visitor) {
 134     visitor->do_slow_case();
 135     visitor->do_input(_input);
 136     visitor->do_output(_result);
 137   }
 138 #ifndef PRODUCT
 139   virtual void print_name(outputStream* out) const { out->print("ConversionStub"); }
 140 #endif // PRODUCT
 141 };
 142 
 143 
 144 // Throws ArrayIndexOutOfBoundsException by default but can be
 145 // configured to throw IndexOutOfBoundsException in constructor
 146 class RangeCheckStub: public CodeStub {
 147  private:
 148   CodeEmitInfo* _info;
 149   LIR_Opr       _index;

 150   bool          _throw_index_out_of_bounds_exception;
 151 
 152  public:
 153   RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, bool throw_index_out_of_bounds_exception = false);



 154   virtual void emit_code(LIR_Assembler* e);
 155   virtual CodeEmitInfo* info() const             { return _info; }
 156   virtual bool is_exception_throw_stub() const   { return true; }
 157   virtual bool is_range_check_stub() const       { return true; }
 158   virtual void visit(LIR_OpVisitState* visitor) {
 159     visitor->do_slow_case(_info);
 160     visitor->do_input(_index);

 161   }
 162 #ifndef PRODUCT
 163   virtual void print_name(outputStream* out) const { out->print("RangeCheckStub"); }
 164 #endif // PRODUCT
 165 };
 166 
 167 // stub used when predicate fails and deoptimization is needed
 168 class PredicateFailedStub: public CodeStub {
 169  private:
 170   CodeEmitInfo* _info;
 171 
 172  public:
 173   PredicateFailedStub(CodeEmitInfo* info);
 174   virtual void emit_code(LIR_Assembler* e);
 175   virtual CodeEmitInfo* info() const             { return _info; }
 176   virtual void visit(LIR_OpVisitState* visitor) {
 177     visitor->do_slow_case(_info);
 178   }
 179 #ifndef PRODUCT
 180   virtual void print_name(outputStream* out) const { out->print("PredicateFailedStub"); }


   1 /*
   2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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  *


 130   LIR_Opr         result()   { return _result; }
 131 
 132   virtual void emit_code(LIR_Assembler* e);
 133   virtual void visit(LIR_OpVisitState* visitor) {
 134     visitor->do_slow_case();
 135     visitor->do_input(_input);
 136     visitor->do_output(_result);
 137   }
 138 #ifndef PRODUCT
 139   virtual void print_name(outputStream* out) const { out->print("ConversionStub"); }
 140 #endif // PRODUCT
 141 };
 142 
 143 
 144 // Throws ArrayIndexOutOfBoundsException by default but can be
 145 // configured to throw IndexOutOfBoundsException in constructor
 146 class RangeCheckStub: public CodeStub {
 147  private:
 148   CodeEmitInfo* _info;
 149   LIR_Opr       _index;
 150   LIR_Opr       _array;
 151   bool          _throw_index_out_of_bounds_exception;
 152 
 153  public:
 154   // For ArrayIndexOutOfBoundsException.
 155   RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array);
 156   // For IndexOutOfBoundsException.
 157   RangeCheckStub(CodeEmitInfo* info, LIR_Opr index);
 158   virtual void emit_code(LIR_Assembler* e);
 159   virtual CodeEmitInfo* info() const             { return _info; }
 160   virtual bool is_exception_throw_stub() const   { return true; }
 161   virtual bool is_range_check_stub() const       { return true; }
 162   virtual void visit(LIR_OpVisitState* visitor) {
 163     visitor->do_slow_case(_info);
 164     visitor->do_input(_index);
 165     if (_array) { visitor->do_input(_array); }
 166   }
 167 #ifndef PRODUCT
 168   virtual void print_name(outputStream* out) const { out->print("RangeCheckStub"); }
 169 #endif // PRODUCT
 170 };
 171 
 172 // stub used when predicate fails and deoptimization is needed
 173 class PredicateFailedStub: public CodeStub {
 174  private:
 175   CodeEmitInfo* _info;
 176 
 177  public:
 178   PredicateFailedStub(CodeEmitInfo* info);
 179   virtual void emit_code(LIR_Assembler* e);
 180   virtual CodeEmitInfo* info() const             { return _info; }
 181   virtual void visit(LIR_OpVisitState* visitor) {
 182     visitor->do_slow_case(_info);
 183   }
 184 #ifndef PRODUCT
 185   virtual void print_name(outputStream* out) const { out->print("PredicateFailedStub"); }


< prev index next >