1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2015 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_ppc.hpp"
33 #include "runtime/sharedRuntime.hpp"
34 #include "utilities/macros.hpp"
35 #include "vmreg_ppc.inline.hpp"
36
37 #define __ ce->masm()->
38
39
40 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
41 bool throw_index_out_of_bounds_exception)
42 : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception)
43 , _index(index) {
44 assert(info != NULL, "must have info");
45 _info = new CodeEmitInfo(info);
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 // May be used by optimizations like LoopInvariantCodeMotion or RangeCheckEliminator.
54 DEBUG_ONLY( __ untested("RangeCheckStub: predicate_failed_trap_id"); )
55 //__ load_const_optimized(R0, a);
56 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(a));
57 __ mtctr(R0);
58 __ bctrl();
59 ce->add_call_info_here(_info);
60 ce->verify_oop_map(_info);
61 debug_only(__ illtrap());
62 return;
63 }
64
65 address stub = _throw_index_out_of_bounds_exception ? Runtime1::entry_for(Runtime1::throw_index_exception_id)
66 : Runtime1::entry_for(Runtime1::throw_range_check_failed_id);
67 //__ load_const_optimized(R0, stub);
68 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(stub));
69 __ mtctr(R0);
70
71 Register index = R0; // pass in R0
72 if (_index->is_register()) {
73 __ extsw(index, _index->as_register());
74 } else {
75 __ load_const_optimized(index, _index->as_jint());
76 }
77
78 __ bctrl();
79 ce->add_call_info_here(_info);
80 ce->verify_oop_map(_info);
81 debug_only(__ illtrap());
82 }
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 //__ load_const_optimized(R0, a);
93 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(a));
94 __ mtctr(R0);
95 __ bctrl();
96 ce->add_call_info_here(_info);
|
1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 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_ppc.hpp"
33 #include "runtime/sharedRuntime.hpp"
34 #include "utilities/macros.hpp"
35 #include "vmreg_ppc.inline.hpp"
36
37 #define __ ce->masm()->
38
39
40 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array)
41 : _throw_index_out_of_bounds_exception(false), _index(index), _array(array) {
42 assert(info != NULL, "must have info");
43 _info = new CodeEmitInfo(info);
44 }
45
46 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
47 : _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) {
48 assert(info != NULL, "must have info");
49 _info = new CodeEmitInfo(info);
50 }
51
52 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
53 __ bind(_entry);
54
55 if (_info->deoptimize_on_exception()) {
56 address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
57 // May be used by optimizations like LoopInvariantCodeMotion or RangeCheckEliminator.
58 DEBUG_ONLY( __ untested("RangeCheckStub: predicate_failed_trap_id"); )
59 //__ load_const_optimized(R0, a);
60 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(a));
61 __ mtctr(R0);
62 __ bctrl();
63 ce->add_call_info_here(_info);
64 ce->verify_oop_map(_info);
65 debug_only(__ illtrap());
66 return;
67 }
68
69 address stub = _throw_index_out_of_bounds_exception ? Runtime1::entry_for(Runtime1::throw_index_exception_id)
70 : Runtime1::entry_for(Runtime1::throw_range_check_failed_id);
71 //__ load_const_optimized(R0, stub);
72 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(stub));
73 __ mtctr(R0);
74
75 Register index = R0;
76 if (_index->is_register()) {
77 __ extsw(index, _index->as_register());
78 } else {
79 __ load_const_optimized(index, _index->as_jint());
80 }
81 if (_array) {
82 __ std(_array->as_pointer_register(), -8, R1_SP);
83 }
84 __ std(index, -16, R1_SP);
85
86 __ bctrl();
87 ce->add_call_info_here(_info);
88 ce->verify_oop_map(_info);
89 debug_only(__ illtrap());
90 }
91
92
93 PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
94 _info = new CodeEmitInfo(info);
95 }
96
97 void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
98 __ bind(_entry);
99 address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
100 //__ load_const_optimized(R0, a);
101 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(a));
102 __ mtctr(R0);
103 __ bctrl();
104 ce->add_call_info_here(_info);
|