equal
deleted
inserted
replaced
48 } |
48 } |
49 |
49 |
50 |
50 |
51 // TODO: ARM - is it possible to inline these stubs into the main code stream? |
51 // TODO: ARM - is it possible to inline these stubs into the main code stream? |
52 |
52 |
53 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, |
53 |
54 bool throw_index_out_of_bounds_exception) |
54 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array) |
55 : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception) |
55 : _throw_index_out_of_bounds_exception(false), _index(index), _array(array) { |
56 , _index(index) |
56 assert(info != NULL, "must have info"); |
57 { |
57 _info = new CodeEmitInfo(info); |
58 _info = info == NULL ? NULL : new CodeEmitInfo(info); |
58 } |
59 } |
59 |
60 |
60 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index) |
|
61 : _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) { |
|
62 assert(info != NULL, "must have info"); |
|
63 _info = new CodeEmitInfo(info); |
|
64 } |
61 |
65 |
62 void RangeCheckStub::emit_code(LIR_Assembler* ce) { |
66 void RangeCheckStub::emit_code(LIR_Assembler* ce) { |
63 __ bind(_entry); |
67 __ bind(_entry); |
64 |
68 |
65 if (_info->deoptimize_on_exception()) { |
69 if (_info->deoptimize_on_exception()) { |
71 ce->verify_oop_map(_info); |
75 ce->verify_oop_map(_info); |
72 debug_only(__ should_not_reach_here()); |
76 debug_only(__ should_not_reach_here()); |
73 return; |
77 return; |
74 } |
78 } |
75 // Pass the array index on stack because all registers must be preserved |
79 // Pass the array index on stack because all registers must be preserved |
76 ce->verify_reserved_argument_area_size(1); |
80 ce->verify_reserved_argument_area_size(_throw_index_out_of_bounds_exception ? 1 : 2); |
77 if (_index->is_cpu_register()) { |
81 if (_index->is_cpu_register()) { |
78 __ str_32(_index->as_register(), Address(SP)); |
82 __ str_32(_index->as_register(), Address(SP)); |
79 } else { |
83 } else { |
80 __ mov_slow(Rtemp, _index->as_jint()); // Rtemp should be OK in C1 |
84 __ mov_slow(Rtemp, _index->as_jint()); // Rtemp should be OK in C1 |
81 __ str_32(Rtemp, Address(SP)); |
85 __ str_32(Rtemp, Address(SP)); |
85 #ifdef AARCH64 |
89 #ifdef AARCH64 |
86 __ NOT_TESTED(); |
90 __ NOT_TESTED(); |
87 #endif |
91 #endif |
88 __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type); |
92 __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type); |
89 } else { |
93 } else { |
|
94 __ str(_array->as_pointer_register(), Address(SP, BytesPerWord)); // ??? Correct offset? Correct instruction? |
90 __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type); |
95 __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type); |
91 } |
96 } |
92 ce->add_call_info_here(_info); |
97 ce->add_call_info_here(_info); |
93 ce->verify_oop_map(_info); |
98 ce->verify_oop_map(_info); |
94 DEBUG_ONLY(STOP("RangeCheck");) |
99 DEBUG_ONLY(STOP("RangeCheck");) |