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 *
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 #if INCLUDE_ALL_GCS
38 #include "gc/g1/g1BarrierSet.hpp"
39 #endif // INCLUDE_ALL_GCS
40
41 #define __ ce->masm()->
42 #undef CHECK_BAILOUT
43 #define CHECK_BAILOUT() { if (ce->compilation()->bailed_out()) return; }
44
45 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
46 bool throw_index_out_of_bounds_exception) :
47 _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception),
48 _index(index) {
49 assert(info != NULL, "must have info");
50 _info = new CodeEmitInfo(info);
51 }
52
53 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
54 __ bind(_entry);
55 if (_info->deoptimize_on_exception()) {
56 address a = Runtime1::entry_for (Runtime1::predicate_failed_trap_id);
57 ce->emit_call_c(a);
58 CHECK_BAILOUT();
59 ce->add_call_info_here(_info);
60 ce->verify_oop_map(_info);
61 debug_only(__ should_not_reach_here());
62 return;
63 }
64
65 // Pass the array index in Z_R1_scratch which is not managed by linear scan.
66 if (_index->is_cpu_register()) {
67 __ lgr_if_needed(Z_R1_scratch, _index->as_register());
68 } else {
69 __ load_const_optimized(Z_R1_scratch, _index->as_jint());
70 }
71
72 Runtime1::StubID stub_id;
73 if (_throw_index_out_of_bounds_exception) {
74 stub_id = Runtime1::throw_index_exception_id;
75 } else {
76 stub_id = Runtime1::throw_range_check_failed_id;
77 }
78 ce->emit_call_c(Runtime1::entry_for (stub_id));
79 CHECK_BAILOUT();
80 ce->add_call_info_here(_info);
81 ce->verify_oop_map(_info);
82 debug_only(__ should_not_reach_here());
83 }
84
85 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
86 _info = new CodeEmitInfo(info);
87 }
88
89 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
90 __ bind(_entry);
91 address a = Runtime1::entry_for (Runtime1::predicate_failed_trap_id);
92 ce->emit_call_c(a);
93 CHECK_BAILOUT();
94 ce->add_call_info_here(_info);
95 ce->verify_oop_map(_info);
96 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 *
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 #if INCLUDE_ALL_GCS
38 #include "gc/g1/g1BarrierSet.hpp"
39 #endif // INCLUDE_ALL_GCS
40
41 #define __ ce->masm()->
42 #undef CHECK_BAILOUT
43 #define CHECK_BAILOUT() { if (ce->compilation()->bailed_out()) return; }
44
45 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array)
46 : _throw_index_out_of_bounds_exception(false), _index(index), _array(array) {
47 assert(info != NULL, "must have info");
48 _info = new CodeEmitInfo(info);
49 }
50
51 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
52 : _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) {
53 assert(info != NULL, "must have info");
54 _info = new CodeEmitInfo(info);
55 }
56
57 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
58 __ bind(_entry);
59 if (_info->deoptimize_on_exception()) {
60 address a = Runtime1::entry_for (Runtime1::predicate_failed_trap_id);
61 ce->emit_call_c(a);
62 CHECK_BAILOUT();
63 ce->add_call_info_here(_info);
64 ce->verify_oop_map(_info);
65 debug_only(__ should_not_reach_here());
66 return;
67 }
68
69 // Pass the array index in Z_R1_scratch which is not managed by linear scan.
70 if (_index->is_cpu_register()) {
71 __ lgr_if_needed(Z_R1_scratch, _index->as_register());
72 } else {
73 __ load_const_optimized(Z_R1_scratch, _index->as_jint());
74 }
75
76 Runtime1::StubID stub_id;
77 if (_throw_index_out_of_bounds_exception) {
78 stub_id = Runtime1::throw_index_exception_id;
79 } else {
80 stub_id = Runtime1::throw_range_check_failed_id;
81 __ lgr_if_needed(Z_R0_scratch, _array->as_pointer_register());
82 }
83 ce->emit_call_c(Runtime1::entry_for (stub_id));
84 CHECK_BAILOUT();
85 ce->add_call_info_here(_info);
86 ce->verify_oop_map(_info);
87 debug_only(__ should_not_reach_here());
88 }
89
90 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
91 _info = new CodeEmitInfo(info);
92 }
93
94 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
95 __ bind(_entry);
96 address a = Runtime1::entry_for (Runtime1::predicate_failed_trap_id);
97 ce->emit_call_c(a);
98 CHECK_BAILOUT();
99 ce->add_call_info_here(_info);
100 ce->verify_oop_map(_info);
101 debug_only(__ should_not_reach_here());
|