126 __ b(_continuation);
127 }
128
129
130 void DivByZeroStub::emit_code(LIR_Assembler* ce) {
131 if (_offset != -1) {
132 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
133 }
134 __ bind(_entry);
135 address stub = Runtime1::entry_for(StubId::c1_throw_div0_exception_id);
136 //__ load_const_optimized(R0, stub);
137 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(stub));
138 __ mtctr(R0);
139 __ bctrl();
140 ce->add_call_info_here(_info);
141 ce->verify_oop_map(_info);
142 DEBUG_ONLY(__ illtrap());
143 }
144
145
146 void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
147 address a;
148 if (_info->deoptimize_on_exception()) {
149 // Deoptimize, do not throw the exception, because it is probably wrong to do it here.
150 a = Runtime1::entry_for(StubId::c1_predicate_failed_trap_id);
151 } else {
152 a = Runtime1::entry_for(StubId::c1_throw_null_pointer_exception_id);
153 }
154
155 if (ImplicitNullChecks || TrapBasedNullChecks) {
156 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
157 }
158 __ bind(_entry);
159 //__ load_const_optimized(R0, a);
160 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(a));
161 __ mtctr(R0);
162 __ bctrl();
163 ce->add_call_info_here(_info);
164 ce->verify_oop_map(_info);
165 DEBUG_ONLY(__ illtrap());
214 _result = result;
215 _info = new CodeEmitInfo(info);
216 }
217
218 void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
219 __ bind(_entry);
220
221 address entry = Runtime1::entry_for(StubId::c1_new_type_array_id);
222 //__ load_const_optimized(R0, entry);
223 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(entry));
224 __ mr_if_needed(/*op->tmp1()->as_register()*/ R5_ARG3, _length->as_register()); // already sign-extended
225 __ mtctr(R0);
226 __ bctrl();
227 ce->add_call_info_here(_info);
228 ce->verify_oop_map(_info);
229 __ b(_continuation);
230 }
231
232
233 // Implementation of NewObjectArrayStub
234 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
235 _klass_reg = klass_reg;
236 _length = length;
237 _result = result;
238 _info = new CodeEmitInfo(info);
239 }
240
241 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
242 __ bind(_entry);
243
244 address entry = Runtime1::entry_for(StubId::c1_new_object_array_id);
245 //__ load_const_optimized(R0, entry);
246 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(entry));
247 __ mr_if_needed(/*op->tmp1()->as_register()*/ R5_ARG3, _length->as_register()); // already sign-extended
248 __ mtctr(R0);
249 __ bctrl();
250 ce->add_call_info_here(_info);
251 ce->verify_oop_map(_info);
252 __ b(_continuation);
253 }
254
255 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
256 __ bind(_entry);
257 address stub = Runtime1::entry_for(ce->compilation()->has_fpu_code() ? StubId::c1_monitorenter_id : StubId::c1_monitorenter_nofpu_id);
258 //__ load_const_optimized(R0, stub);
259 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(stub));
260 __ mr_if_needed(/*scratch_opr()->as_register()*/ R4_ARG2, _obj_reg->as_register());
261 assert(_lock_reg->as_register() == R5_ARG3, "");
262 __ mtctr(R0);
263 __ bctrl();
264 ce->add_call_info_here(_info);
265 ce->verify_oop_map(_info);
266 __ b(_continuation);
267 }
268
269 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
270 __ bind(_entry);
271
272 // lock_reg was destroyed by fast unlocking attempt => recompute it
273 ce->monitor_address(_monitor_ix, _lock_reg);
274
275 address stub = Runtime1::entry_for(ce->compilation()->has_fpu_code() ? StubId::c1_monitorexit_id : StubId::c1_monitorexit_nofpu_id);
276 //__ load_const_optimized(R0, stub);
|
126 __ b(_continuation);
127 }
128
129
130 void DivByZeroStub::emit_code(LIR_Assembler* ce) {
131 if (_offset != -1) {
132 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
133 }
134 __ bind(_entry);
135 address stub = Runtime1::entry_for(StubId::c1_throw_div0_exception_id);
136 //__ load_const_optimized(R0, stub);
137 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(stub));
138 __ mtctr(R0);
139 __ bctrl();
140 ce->add_call_info_here(_info);
141 ce->verify_oop_map(_info);
142 DEBUG_ONLY(__ illtrap());
143 }
144
145
146 // Implementation of LoadFlattenedArrayStub
147
148 LoadFlattenedArrayStub::LoadFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info) {
149 _array = array;
150 _index = index;
151 _result = result;
152 _scratch_reg = FrameMap::R3_oop_opr;
153 _info = new CodeEmitInfo(info);
154 }
155
156 void LoadFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
157 __ bind(_entry);
158 // Pass arguments on stack.
159 __ std(_array->as_register(), -16, R1_SP);
160 __ std(_index->as_register(), -8, R1_SP);
161 address stub = Runtime1::entry_for(StubId::c1_load_flat_array_id);
162 //__ load_const_optimized(R0, stub);
163 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(stub));
164 __ mtctr(R0);
165 __ bctrl();
166 ce->add_call_info_here(_info);
167 ce->verify_oop_map(_info);
168 __ mr_if_needed(_result->as_register(), R3_RET);
169 __ b(_continuation);
170 }
171
172
173 // Implementation of StoreFlattenedArrayStub
174
175 StoreFlattenedArrayStub::StoreFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr value, CodeEmitInfo* info) {
176 _array = array;
177 _index = index;
178 _value = value;
179 _scratch_reg = LIR_OprFact::illegalOpr;
180 _info = new CodeEmitInfo(info);
181 }
182
183 void StoreFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
184 __ bind(_entry);
185 // Pass arguments on stack.
186 __ std(_array->as_register(), -24, R1_SP);
187 __ std(_index->as_register(), -16, R1_SP);
188 __ std(_value->as_register(), -8, R1_SP);
189 address stub = Runtime1::entry_for(StubId::c1_store_flat_array_id);
190 //__ load_const_optimized(R0, stub);
191 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(stub));
192 __ mtctr(R0);
193 __ bctrl();
194 ce->add_call_info_here(_info);
195 ce->verify_oop_map(_info);
196 __ b(_continuation);
197 }
198
199
200 // Implementation of SubstitutabilityCheckStub
201 SubstitutabilityCheckStub::SubstitutabilityCheckStub(LIR_Opr left, LIR_Opr right, CodeEmitInfo* info) {
202 _left = left;
203 _right = right;
204 _scratch_reg = FrameMap::R3_oop_opr;
205 _info = new CodeEmitInfo(info);
206 }
207
208 void SubstitutabilityCheckStub::emit_code(LIR_Assembler* ce) {
209 __ bind(_entry);
210 // Pass arguments on stack.
211 __ std(_left->as_register(), -16, R1_SP);
212 __ std(_right->as_register(), -8, R1_SP);
213 address stub = Runtime1::entry_for(StubId::c1_substitutability_check_id);
214 //__ load_const_optimized(R0, stub);
215 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(stub));
216 __ mtctr(R0);
217 __ bctrl();
218 ce->add_call_info_here(_info);
219 ce->verify_oop_map(_info);
220 // Result is in R3_RET (_scratch_reg)
221 __ b(_continuation);
222 }
223
224
225 void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
226 address a;
227 if (_info->deoptimize_on_exception()) {
228 // Deoptimize, do not throw the exception, because it is probably wrong to do it here.
229 a = Runtime1::entry_for(StubId::c1_predicate_failed_trap_id);
230 } else {
231 a = Runtime1::entry_for(StubId::c1_throw_null_pointer_exception_id);
232 }
233
234 if (ImplicitNullChecks || TrapBasedNullChecks) {
235 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
236 }
237 __ bind(_entry);
238 //__ load_const_optimized(R0, a);
239 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(a));
240 __ mtctr(R0);
241 __ bctrl();
242 ce->add_call_info_here(_info);
243 ce->verify_oop_map(_info);
244 DEBUG_ONLY(__ illtrap());
293 _result = result;
294 _info = new CodeEmitInfo(info);
295 }
296
297 void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
298 __ bind(_entry);
299
300 address entry = Runtime1::entry_for(StubId::c1_new_type_array_id);
301 //__ load_const_optimized(R0, entry);
302 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(entry));
303 __ mr_if_needed(/*op->tmp1()->as_register()*/ R5_ARG3, _length->as_register()); // already sign-extended
304 __ mtctr(R0);
305 __ bctrl();
306 ce->add_call_info_here(_info);
307 ce->verify_oop_map(_info);
308 __ b(_continuation);
309 }
310
311
312 // Implementation of NewObjectArrayStub
313 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result,
314 CodeEmitInfo* info, bool is_null_free) {
315 _klass_reg = klass_reg;
316 _length = length;
317 _result = result;
318 _info = new CodeEmitInfo(info);
319 _is_null_free = is_null_free;
320 }
321
322 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
323 __ bind(_entry);
324
325 address entry = _is_null_free ? Runtime1::entry_for(StubId::c1_new_null_free_array_id)
326 : Runtime1::entry_for(StubId::c1_new_object_array_id);
327 //__ load_const_optimized(R0, entry);
328 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(entry));
329 __ mr_if_needed(/*op->tmp1()->as_register()*/ R5_ARG3, _length->as_register()); // already sign-extended
330 __ mtctr(R0);
331 __ bctrl();
332 ce->add_call_info_here(_info);
333 ce->verify_oop_map(_info);
334 __ b(_continuation);
335 }
336
337 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
338 __ bind(_entry);
339 if (_throw_ie_stub != nullptr) {
340 // When we come here, _obj_reg has already been checked to be non-null.
341 const int is_value_mask = markWord::inline_type_pattern;
342 __ ld(R0, oopDesc::mark_offset_in_bytes(), _obj_reg->as_register());
343 __ andi(R0, R0, is_value_mask);
344 __ cmpdi(CR0, R0, is_value_mask);
345 __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CR0, Assembler::equal), *_throw_ie_stub->entry());
346 }
347
348 address stub = Runtime1::entry_for(ce->compilation()->has_fpu_code() ? StubId::c1_monitorenter_id : StubId::c1_monitorenter_nofpu_id);
349 //__ load_const_optimized(R0, stub);
350 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(stub));
351 __ mr_if_needed(/*scratch_opr()->as_register()*/ R4_ARG2, _obj_reg->as_register());
352 assert(_lock_reg->as_register() == R5_ARG3, "");
353 __ mtctr(R0);
354 __ bctrl();
355 ce->add_call_info_here(_info);
356 ce->verify_oop_map(_info);
357 __ b(_continuation);
358 }
359
360 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
361 __ bind(_entry);
362
363 // lock_reg was destroyed by fast unlocking attempt => recompute it
364 ce->monitor_address(_monitor_ix, _lock_reg);
365
366 address stub = Runtime1::entry_for(ce->compilation()->has_fpu_code() ? StubId::c1_monitorexit_id : StubId::c1_monitorexit_nofpu_id);
367 //__ load_const_optimized(R0, stub);
|