1 /*
2 * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2025 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.
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);
452 // serves as dummy and the bl will be patched later.
453 __ code()->set_insts_mark();
454 __ bl(__ pc());
455 ce->add_call_info_here(info());
456 ce->verify_oop_map(info());
457
458 #ifndef PRODUCT
459 if (PrintC1Statistics) {
460 const address counter = (address)&Runtime1::_arraycopy_slowcase_cnt;
461 const Register tmp = R3, tmp2 = R4;
462 int simm16_offs = __ load_const_optimized(tmp, counter, tmp2, true);
463 __ lwz(tmp2, simm16_offs, tmp);
464 __ addi(tmp2, tmp2, 1);
465 __ stw(tmp2, simm16_offs, tmp);
466 }
467 #endif
468
469 __ b(_continuation);
470 }
471
472 #undef __
|
1 /*
2 * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2025 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.
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,
235 CodeEmitInfo* info, bool is_null_free) {
236 _klass_reg = klass_reg;
237 _length = length;
238 _result = result;
239 _info = new CodeEmitInfo(info);
240 _is_null_free = is_null_free; // unimplemented
241 }
242
243 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
244 __ bind(_entry);
245
246 address entry = Runtime1::entry_for(StubId::c1_new_object_array_id);
247 //__ load_const_optimized(R0, entry);
248 __ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(entry));
249 __ mr_if_needed(/*op->tmp1()->as_register()*/ R5_ARG3, _length->as_register()); // already sign-extended
250 __ mtctr(R0);
251 __ bctrl();
252 ce->add_call_info_here(_info);
253 ce->verify_oop_map(_info);
254 __ b(_continuation);
255 }
256
257 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
258 __ bind(_entry);
259 address stub = Runtime1::entry_for(ce->compilation()->has_fpu_code() ? StubId::c1_monitorenter_id : StubId::c1_monitorenter_nofpu_id);
260 //__ load_const_optimized(R0, stub);
454 // serves as dummy and the bl will be patched later.
455 __ code()->set_insts_mark();
456 __ bl(__ pc());
457 ce->add_call_info_here(info());
458 ce->verify_oop_map(info());
459
460 #ifndef PRODUCT
461 if (PrintC1Statistics) {
462 const address counter = (address)&Runtime1::_arraycopy_slowcase_cnt;
463 const Register tmp = R3, tmp2 = R4;
464 int simm16_offs = __ load_const_optimized(tmp, counter, tmp2, true);
465 __ lwz(tmp2, simm16_offs, tmp);
466 __ addi(tmp2, tmp2, 1);
467 __ stw(tmp2, simm16_offs, tmp);
468 }
469 #endif
470
471 __ b(_continuation);
472 }
473
474 // Implementation of SubstitutabilityCheckStub
475 SubstitutabilityCheckStub::SubstitutabilityCheckStub(LIR_Opr left, LIR_Opr right, CodeEmitInfo* info) {
476 Unimplemented();
477 }
478
479 void SubstitutabilityCheckStub::emit_code(LIR_Assembler* ce) {
480 Unimplemented();
481 }
482
483 LoadFlattenedArrayStub::LoadFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info) {
484 Unimplemented();
485 }
486
487 void LoadFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
488 Unimplemented();
489 }
490
491 // Implementation of StoreFlattenedArrayStub
492
493 StoreFlattenedArrayStub::StoreFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr value, CodeEmitInfo* info) {
494 Unimplemented();
495 }
496
497 void StoreFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
498 Unimplemented();
499 }
500 #undef __
|