< prev index next >

src/hotspot/cpu/s390/c1_CodeStubs_s390.cpp

Print this page
rev 49948 : 8201593: Print array length in ArrayIndexOutOfBoundsException.
Reviewed-by: dholmes, mdoerr, smonteith
   1 /*
   2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2016 SAP SE. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "c1/c1_CodeStubs.hpp"
  28 #include "c1/c1_FrameMap.hpp"
  29 #include "c1/c1_LIRAssembler.hpp"
  30 #include "c1/c1_MacroAssembler.hpp"
  31 #include "c1/c1_Runtime1.hpp"
  32 #include "nativeInst_s390.hpp"
  33 #include "runtime/sharedRuntime.hpp"
  34 #include "utilities/align.hpp"
  35 #include "utilities/macros.hpp"
  36 #include "vmreg_s390.inline.hpp"
  37 
  38 #define __ ce->masm()->
  39 #undef  CHECK_BAILOUT
  40 #define CHECK_BAILOUT() { if (ce->compilation()->bailed_out()) return; }
  41 
  42 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
  43                                bool throw_index_out_of_bounds_exception) :
  44   _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception),
  45   _index(index) {




  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   if (_info->deoptimize_on_exception()) {
  53     address a = Runtime1::entry_for (Runtime1::predicate_failed_trap_id);
  54     ce->emit_call_c(a);
  55     CHECK_BAILOUT();
  56     ce->add_call_info_here(_info);
  57     ce->verify_oop_map(_info);
  58     debug_only(__ should_not_reach_here());
  59     return;
  60   }
  61 
  62   // Pass the array index in Z_R1_scratch which is not managed by linear scan.
  63   if (_index->is_cpu_register()) {
  64     __ lgr_if_needed(Z_R1_scratch, _index->as_register());
  65   } else {
  66     __ load_const_optimized(Z_R1_scratch, _index->as_jint());
  67   }
  68 
  69   Runtime1::StubID stub_id;
  70   if (_throw_index_out_of_bounds_exception) {
  71     stub_id = Runtime1::throw_index_exception_id;
  72   } else {
  73     stub_id = Runtime1::throw_range_check_failed_id;

  74   }
  75   ce->emit_call_c(Runtime1::entry_for (stub_id));
  76   CHECK_BAILOUT();
  77   ce->add_call_info_here(_info);
  78   ce->verify_oop_map(_info);
  79   debug_only(__ should_not_reach_here());
  80 }
  81 
  82 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
  83   _info = new CodeEmitInfo(info);
  84 }
  85 
  86 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
  87   __ bind(_entry);
  88   address a = Runtime1::entry_for (Runtime1::predicate_failed_trap_id);
  89   ce->emit_call_c(a);
  90   CHECK_BAILOUT();
  91   ce->add_call_info_here(_info);
  92   ce->verify_oop_map(_info);
  93   debug_only(__ should_not_reach_here());


   1 /*
   2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2016, 2018 SAP SE. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "c1/c1_CodeStubs.hpp"
  28 #include "c1/c1_FrameMap.hpp"
  29 #include "c1/c1_LIRAssembler.hpp"
  30 #include "c1/c1_MacroAssembler.hpp"
  31 #include "c1/c1_Runtime1.hpp"
  32 #include "nativeInst_s390.hpp"
  33 #include "runtime/sharedRuntime.hpp"
  34 #include "utilities/align.hpp"
  35 #include "utilities/macros.hpp"
  36 #include "vmreg_s390.inline.hpp"
  37 
  38 #define __ ce->masm()->
  39 #undef  CHECK_BAILOUT
  40 #define CHECK_BAILOUT() { if (ce->compilation()->bailed_out()) return; }
  41 
  42 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array)
  43   : _throw_index_out_of_bounds_exception(false), _index(index), _array(array) {
  44   assert(info != NULL, "must have info");
  45   _info = new CodeEmitInfo(info);
  46 }
  47 
  48 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
  49   : _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) {
  50   assert(info != NULL, "must have info");
  51   _info = new CodeEmitInfo(info);
  52 }
  53 
  54 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
  55   __ bind(_entry);
  56   if (_info->deoptimize_on_exception()) {
  57     address a = Runtime1::entry_for (Runtime1::predicate_failed_trap_id);
  58     ce->emit_call_c(a);
  59     CHECK_BAILOUT();
  60     ce->add_call_info_here(_info);
  61     ce->verify_oop_map(_info);
  62     debug_only(__ should_not_reach_here());
  63     return;
  64   }
  65 
  66   // Pass the array index in Z_R1_scratch which is not managed by linear scan.
  67   if (_index->is_cpu_register()) {
  68     __ lgr_if_needed(Z_R1_scratch, _index->as_register());
  69   } else {
  70     __ load_const_optimized(Z_R1_scratch, _index->as_jint());
  71   }
  72 
  73   Runtime1::StubID stub_id;
  74   if (_throw_index_out_of_bounds_exception) {
  75     stub_id = Runtime1::throw_index_exception_id;
  76   } else {
  77     stub_id = Runtime1::throw_range_check_failed_id;
  78     __ lgr_if_needed(Z_R0_scratch, _array->as_pointer_register());
  79   }
  80   ce->emit_call_c(Runtime1::entry_for (stub_id));
  81   CHECK_BAILOUT();
  82   ce->add_call_info_here(_info);
  83   ce->verify_oop_map(_info);
  84   debug_only(__ should_not_reach_here());
  85 }
  86 
  87 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
  88   _info = new CodeEmitInfo(info);
  89 }
  90 
  91 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
  92   __ bind(_entry);
  93   address a = Runtime1::entry_for (Runtime1::predicate_failed_trap_id);
  94   ce->emit_call_c(a);
  95   CHECK_BAILOUT();
  96   ce->add_call_info_here(_info);
  97   ce->verify_oop_map(_info);
  98   debug_only(__ should_not_reach_here());


< prev index next >