1 /*
2 * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
25 #include "c1/c1_MacroAssembler.hpp"
26 #include "c1/c1_Runtime1.hpp"
27 #include "gc/shared/barrierSet.hpp"
28 #include "gc/shared/barrierSetAssembler.hpp"
29 #include "gc/shared/collectedHeap.hpp"
30 #include "gc/shared/tlab_globals.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "oops/arrayOop.hpp"
33 #include "oops/markWord.hpp"
34 #include "runtime/basicLock.hpp"
35 #include "runtime/os.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #include "runtime/stubRoutines.hpp"
38 #include "utilities/powerOfTwo.hpp"
39
40 // Note: Rtemp usage is this file should not impact C2 and should be
41 // correct as long as it is not implicitly used in lower layers (the
42 // arm [macro]assembler) and used with care in the other C1 specific
43 // files.
44
45 void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_bytes) {
46 assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
47 assert((frame_size_in_bytes % StackAlignmentInBytes) == 0, "frame size should be aligned");
48
49
50 arm_stack_overflow_check(bang_size_in_bytes, Rtemp);
51
52 // FP can no longer be used to memorize SP. It may be modified
53 // if this method contains a methodHandle call site
54 raw_push(FP, LR);
55 sub_slow(SP, SP, frame_size_in_bytes);
56
57 // Insert nmethod entry barrier into frame.
58 BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
59 bs->nmethod_entry_barrier(this);
60 }
61
62 void C1_MacroAssembler::remove_frame(int frame_size_in_bytes) {
63 add_slow(SP, SP, frame_size_in_bytes);
64 raw_pop(FP, LR);
65 }
66
67 void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
68 if (breakAtEntry) {
69 breakpoint();
70 }
71 }
72
73 // Puts address of allocated object into register `obj` and end of allocated object into register `obj_end`.
74 void C1_MacroAssembler::try_allocate(Register obj, Register obj_end, Register tmp1, Register tmp2,
75 RegisterOrConstant size_expression, Label& slow_case) {
76 if (UseTLAB) {
77 tlab_allocate(obj, obj_end, tmp1, size_expression, slow_case);
78 } else {
79 b(slow_case);
80 }
81 }
82
83
84 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register tmp) {
85 assert_different_registers(obj, klass, len, tmp);
86
221 fast_unlock(obj, t1, t2, t3, 1 /* savemask - save t1 */, slow_case);
222 // Success: fall through
223 }
224
225 #ifndef PRODUCT
226
227 void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
228 if (!VerifyOops) return;
229 verify_oop_addr(Address(SP, stack_offset));
230 }
231
232 void C1_MacroAssembler::verify_not_null_oop(Register r) {
233 Label not_null;
234 cbnz(r, not_null);
235 stop("non-null oop required");
236 bind(not_null);
237 if (!VerifyOops) return;
238 verify_oop(r);
239 }
240
241 #endif // !PRODUCT
|
1 /*
2 * Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
25 #include "c1/c1_MacroAssembler.hpp"
26 #include "c1/c1_Runtime1.hpp"
27 #include "gc/shared/barrierSet.hpp"
28 #include "gc/shared/barrierSetAssembler.hpp"
29 #include "gc/shared/collectedHeap.hpp"
30 #include "gc/shared/tlab_globals.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "oops/arrayOop.hpp"
33 #include "oops/markWord.hpp"
34 #include "runtime/basicLock.hpp"
35 #include "runtime/os.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #include "runtime/stubRoutines.hpp"
38 #include "utilities/powerOfTwo.hpp"
39
40 // Note: Rtemp usage is this file should not impact C2 and should be
41 // correct as long as it is not implicitly used in lower layers (the
42 // arm [macro]assembler) and used with care in the other C1 specific
43 // files.
44
45 void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_bytes,
46 int sp_offset_for_orig_pc,
47 bool needs_stack_repair, bool has_scalarized_args,
48 Label* verified_inline_entry_label) {
49 assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
50 assert((frame_size_in_bytes % StackAlignmentInBytes) == 0, "frame size should be aligned");
51
52
53 arm_stack_overflow_check(bang_size_in_bytes, Rtemp);
54
55 // FP can no longer be used to memorize SP. It may be modified
56 // if this method contains a methodHandle call site
57 raw_push(FP, LR);
58 sub_slow(SP, SP, frame_size_in_bytes);
59
60 // Insert nmethod entry barrier into frame.
61 BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
62 bs->nmethod_entry_barrier(this);
63 }
64
65 void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
66 if (breakAtEntry) {
67 breakpoint();
68 }
69 }
70
71 // Puts address of allocated object into register `obj` and end of allocated object into register `obj_end`.
72 void C1_MacroAssembler::try_allocate(Register obj, Register obj_end, Register tmp1, Register tmp2,
73 RegisterOrConstant size_expression, Label& slow_case) {
74 if (UseTLAB) {
75 tlab_allocate(obj, obj_end, tmp1, size_expression, slow_case);
76 } else {
77 b(slow_case);
78 }
79 }
80
81
82 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register tmp) {
83 assert_different_registers(obj, klass, len, tmp);
84
219 fast_unlock(obj, t1, t2, t3, 1 /* savemask - save t1 */, slow_case);
220 // Success: fall through
221 }
222
223 #ifndef PRODUCT
224
225 void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
226 if (!VerifyOops) return;
227 verify_oop_addr(Address(SP, stack_offset));
228 }
229
230 void C1_MacroAssembler::verify_not_null_oop(Register r) {
231 Label not_null;
232 cbnz(r, not_null);
233 stop("non-null oop required");
234 bind(not_null);
235 if (!VerifyOops) return;
236 verify_oop(r);
237 }
238
239 int C1_MacroAssembler::scalarized_entry(const CompiledEntrySignature* ces, int frame_size_in_bytes, int bang_size_in_bytes, int sp_offset_for_orig_pc, Label& verified_inline_entry_label, bool is_inline_ro_entry) {
240 Unimplemented();
241 }
242
243 #endif // !PRODUCT
|