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