102 address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
103 __ far_call(RuntimeAddress(a));
104 ce->add_call_info_here(_info);
105 ce->verify_oop_map(_info);
106 debug_only(__ should_not_reach_here());
107 }
108
109 void DivByZeroStub::emit_code(LIR_Assembler* ce) {
110 if (_offset != -1) {
111 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
112 }
113 __ bind(_entry);
114 __ far_call(Address(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type));
115 ce->add_call_info_here(_info);
116 ce->verify_oop_map(_info);
117 #ifdef ASSERT
118 __ should_not_reach_here();
119 #endif
120 }
121
122
123
124 // Implementation of NewInstanceStub
125
126 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
127 _result = result;
128 _klass = klass;
129 _klass_reg = klass_reg;
130 _info = new CodeEmitInfo(info);
131 assert(stub_id == Runtime1::new_instance_id ||
132 stub_id == Runtime1::fast_new_instance_id ||
133 stub_id == Runtime1::fast_new_instance_init_check_id,
134 "need new_instance id");
135 _stub_id = stub_id;
136 }
137
138
139
140 void NewInstanceStub::emit_code(LIR_Assembler* ce) {
141 assert(__ rsp_offset() == 0, "frame size should be fixed");
142 __ bind(_entry);
143 __ mov(r3, _klass_reg->as_register());
144 __ far_call(RuntimeAddress(Runtime1::entry_for(_stub_id)));
145 ce->add_call_info_here(_info);
146 ce->verify_oop_map(_info);
147 assert(_result->as_register() == r0, "result must in r0,");
148 __ b(_continuation);
149 }
150
151
152 // Implementation of NewTypeArrayStub
153
154 // Implementation of NewTypeArrayStub
155
156 NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
157 _klass_reg = klass_reg;
158 _length = length;
159 _result = result;
160 _info = new CodeEmitInfo(info);
161 }
162
163
164 void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
165 assert(__ rsp_offset() == 0, "frame size should be fixed");
166 __ bind(_entry);
167 assert(_length->as_register() == r19, "length must in r19,");
168 assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
169 __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_type_array_id)));
170 ce->add_call_info_here(_info);
171 ce->verify_oop_map(_info);
172 assert(_result->as_register() == r0, "result must in r0");
173 __ b(_continuation);
174 }
175
176
177 // Implementation of NewObjectArrayStub
178
179 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
180 _klass_reg = klass_reg;
181 _result = result;
182 _length = length;
183 _info = new CodeEmitInfo(info);
184 }
185
186
187 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
188 assert(__ rsp_offset() == 0, "frame size should be fixed");
189 __ bind(_entry);
190 assert(_length->as_register() == r19, "length must in r19,");
191 assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
192 __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
193 ce->add_call_info_here(_info);
194 ce->verify_oop_map(_info);
195 assert(_result->as_register() == r0, "result must in r0");
196 __ b(_continuation);
197 }
198 // Implementation of MonitorAccessStubs
199
200 MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
201 : MonitorAccessStub(obj_reg, lock_reg)
202 {
203 _info = new CodeEmitInfo(info);
204 }
205
206
207 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
208 assert(__ rsp_offset() == 0, "frame size should be fixed");
209 __ bind(_entry);
210 ce->store_parameter(_obj_reg->as_register(), 1);
211 ce->store_parameter(_lock_reg->as_register(), 0);
212 Runtime1::StubID enter_id;
213 if (ce->compilation()->has_fpu_code()) {
214 enter_id = Runtime1::monitorenter_id;
215 } else {
216 enter_id = Runtime1::monitorenter_nofpu_id;
217 }
218 __ far_call(RuntimeAddress(Runtime1::entry_for(enter_id)));
219 ce->add_call_info_here(_info);
220 ce->verify_oop_map(_info);
221 __ b(_continuation);
222 }
223
224
225 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
226 __ bind(_entry);
227 if (_compute_lock) {
228 // lock_reg was destroyed by fast unlocking attempt => recompute it
229 ce->monitor_address(_monitor_ix, _lock_reg);
|
102 address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
103 __ far_call(RuntimeAddress(a));
104 ce->add_call_info_here(_info);
105 ce->verify_oop_map(_info);
106 debug_only(__ should_not_reach_here());
107 }
108
109 void DivByZeroStub::emit_code(LIR_Assembler* ce) {
110 if (_offset != -1) {
111 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
112 }
113 __ bind(_entry);
114 __ far_call(Address(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type));
115 ce->add_call_info_here(_info);
116 ce->verify_oop_map(_info);
117 #ifdef ASSERT
118 __ should_not_reach_here();
119 #endif
120 }
121
122 // Implementation of LoadFlattenedArrayStub
123
124 LoadFlattenedArrayStub::LoadFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info) {
125 _array = array;
126 _index = index;
127 _result = result;
128 _scratch_reg = FrameMap::r0_oop_opr;
129 _info = new CodeEmitInfo(info);
130 }
131
132 void LoadFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
133 assert(__ rsp_offset() == 0, "frame size should be fixed");
134 __ bind(_entry);
135 ce->store_parameter(_array->as_register(), 1);
136 ce->store_parameter(_index->as_register(), 0);
137 __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::load_flattened_array_id)));
138 ce->add_call_info_here(_info);
139 ce->verify_oop_map(_info);
140 if (_result->as_register() != r0) {
141 __ mov(_result->as_register(), r0);
142 }
143 __ b(_continuation);
144 }
145
146
147 // Implementation of StoreFlattenedArrayStub
148
149 StoreFlattenedArrayStub::StoreFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr value, CodeEmitInfo* info) {
150 _array = array;
151 _index = index;
152 _value = value;
153 _scratch_reg = FrameMap::r0_oop_opr;
154 _info = new CodeEmitInfo(info);
155 }
156
157
158 void StoreFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
159 assert(__ rsp_offset() == 0, "frame size should be fixed");
160 __ bind(_entry);
161 ce->store_parameter(_array->as_register(), 2);
162 ce->store_parameter(_index->as_register(), 1);
163 ce->store_parameter(_value->as_register(), 0);
164 __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::store_flattened_array_id)));
165 ce->add_call_info_here(_info);
166 ce->verify_oop_map(_info);
167 __ b(_continuation);
168 }
169
170 // Implementation of SubstitutabilityCheckStub
171 SubstitutabilityCheckStub::SubstitutabilityCheckStub(LIR_Opr left, LIR_Opr right, CodeEmitInfo* info) {
172 _left = left;
173 _right = right;
174 _scratch_reg = FrameMap::r0_oop_opr;
175 _info = new CodeEmitInfo(info);
176 }
177
178 void SubstitutabilityCheckStub::emit_code(LIR_Assembler* ce) {
179 assert(__ rsp_offset() == 0, "frame size should be fixed");
180 __ bind(_entry);
181 ce->store_parameter(_left->as_register(), 1);
182 ce->store_parameter(_right->as_register(), 0);
183 __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::substitutability_check_id)));
184 ce->add_call_info_here(_info);
185 ce->verify_oop_map(_info);
186 __ b(_continuation);
187 }
188
189
190 // Implementation of NewInstanceStub
191
192 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
193 _result = result;
194 _klass = klass;
195 _klass_reg = klass_reg;
196 _info = new CodeEmitInfo(info);
197 assert(stub_id == Runtime1::new_instance_id ||
198 stub_id == Runtime1::fast_new_instance_id ||
199 stub_id == Runtime1::fast_new_instance_init_check_id,
200 "need new_instance id");
201 _stub_id = stub_id;
202 }
203
204 void NewInstanceStub::emit_code(LIR_Assembler* ce) {
205 assert(__ rsp_offset() == 0, "frame size should be fixed");
206 __ bind(_entry);
207 __ mov(r3, _klass_reg->as_register());
208 __ far_call(RuntimeAddress(Runtime1::entry_for(_stub_id)));
209 ce->add_call_info_here(_info);
210 ce->verify_oop_map(_info);
211 assert(_result->as_register() == r0, "result must in r0,");
212 __ b(_continuation);
213 }
214
215
216 // Implementation of NewTypeArrayStub
217
218 // Implementation of NewTypeArrayStub
219
220 NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
221 _klass_reg = klass_reg;
222 _length = length;
223 _result = result;
224 _info = new CodeEmitInfo(info);
225 }
226
227
228 void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
229 assert(__ rsp_offset() == 0, "frame size should be fixed");
230 __ bind(_entry);
231 assert(_length->as_register() == r19, "length must in r19,");
232 assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
233 __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_type_array_id)));
234 ce->add_call_info_here(_info);
235 ce->verify_oop_map(_info);
236 assert(_result->as_register() == r0, "result must in r0");
237 __ b(_continuation);
238 }
239
240
241 // Implementation of NewObjectArrayStub
242
243 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info, bool is_inline_type) {
244 _klass_reg = klass_reg;
245 _result = result;
246 _length = length;
247 _info = new CodeEmitInfo(info);
248 _is_inline_type = is_inline_type;
249 }
250
251
252 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
253 assert(__ rsp_offset() == 0, "frame size should be fixed");
254 __ bind(_entry);
255 assert(_length->as_register() == r19, "length must in r19,");
256 assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
257
258 if (_is_inline_type) {
259 __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_flat_array_id)));
260 } else {
261 __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
262 }
263
264 ce->add_call_info_here(_info);
265 ce->verify_oop_map(_info);
266 assert(_result->as_register() == r0, "result must in r0");
267 __ b(_continuation);
268 }
269 // Implementation of MonitorAccessStubs
270
271 MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info, CodeStub* throw_imse_stub, LIR_Opr scratch_reg)
272 : MonitorAccessStub(obj_reg, lock_reg)
273 {
274 _info = new CodeEmitInfo(info);
275 _scratch_reg = scratch_reg;
276 _throw_imse_stub = throw_imse_stub;
277 if (_throw_imse_stub != NULL) {
278 assert(_scratch_reg != LIR_OprFact::illegalOpr, "must be");
279 }
280 }
281
282
283 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
284 assert(__ rsp_offset() == 0, "frame size should be fixed");
285 __ bind(_entry);
286 if (_throw_imse_stub != NULL) {
287 // When we come here, _obj_reg has already been checked to be non-null.
288 __ ldr(rscratch1, Address(_obj_reg->as_register(), oopDesc::mark_offset_in_bytes()));
289 __ mov(rscratch2, markWord::always_locked_pattern);
290 __ andr(rscratch1, rscratch1, rscratch2);
291
292 __ cmp(rscratch1, rscratch2);
293 __ br(Assembler::NE, *_throw_imse_stub->entry());
294 }
295
296 ce->store_parameter(_obj_reg->as_register(), 1);
297 ce->store_parameter(_lock_reg->as_register(), 0);
298 Runtime1::StubID enter_id;
299 if (ce->compilation()->has_fpu_code()) {
300 enter_id = Runtime1::monitorenter_id;
301 } else {
302 enter_id = Runtime1::monitorenter_nofpu_id;
303 }
304 __ far_call(RuntimeAddress(Runtime1::entry_for(enter_id)));
305 ce->add_call_info_here(_info);
306 ce->verify_oop_map(_info);
307 __ b(_continuation);
308 }
309
310
311 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
312 __ bind(_entry);
313 if (_compute_lock) {
314 // lock_reg was destroyed by fast unlocking attempt => recompute it
315 ce->monitor_address(_monitor_ix, _lock_reg);
|