1 /*
2 * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2016, 2023 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.
23 *
24 */
25
26 #ifndef CPU_S390_C1_MACROASSEMBLER_S390_HPP
27 #define CPU_S390_C1_MACROASSEMBLER_S390_HPP
28
29 void pd_init() { /* nothing to do */ }
30
31 public:
32 void try_allocate(
33 Register obj, // result: Pointer to object after successful allocation.
34 Register var_size_in_bytes, // Object size in bytes if unknown at compile time; invalid otherwise.
35 int con_size_in_bytes, // Object size in bytes if known at compile time.
36 Register t1, // temp register
37 Label& slow_case // Continuation point if fast allocation fails.
38 );
39
40 void initialize_header(Register obj, Register klass, Register len, Register Rzero, Register t1);
41 void initialize_body(Register objectFields, Register len_in_bytes, Register Rzero);
42
43 // locking
44 // Rmark : Used to hold locked markWord to be CASed into obj, contents destroyed.
45 // Roop : Must point to the object to lock, contents preserved.
46 // Rbox : Must point to the displaced header location, contents preserved.
47 // Z_R1_scratch : Used as temp and will be killed
48 void lock_object(Register Rmark, Register Roop, Register Rbox, Label& slow_case);
49
50 // unlocking
51 // Rmark : Used to hold original markWord to be CASed back into obj, contents destroyed.
52 // Roop : Must point to the object to lock, contents preserved.
53 // Rbox : Must point to the displaced header location, contents destroyed.
54 // Z_R1_scratch : Used as temp and will be killed
55 void unlock_object(Register Rmark, Register Roop, Register Rbox, Label& slow_case);
56
57 void initialize_object(
58 Register obj, // result: Pointer to object after successful allocation.
59 Register klass, // object klass
60 Register var_size_in_bytes, // Object size in bytes if unknown at compile time; invalid otherwise.
61 int con_size_in_bytes, // Object size in bytes if known at compile time.
62 Register t1, // temp register
63 Register t2 // temp register
64 );
65
66 // Allocation of fixed-size objects.
67 // This can also be used to allocate fixed-size arrays, by setting
68 // hdr_size correctly and storing the array length afterwards.
69 void allocate_object(
70 Register obj, // result: Pointer to object after successful allocation.
71 Register t1, // temp register
72 Register t2, // temp register
73 int base_offset_in_bytes, // elements offset in bytes
74 int obj_size, // object size in words
75 Register klass, // object klass
76 Label& slow_case // Continuation point if fast allocation fails.
77 );
78
79 enum {
80 max_array_allocation_length = 0x01000000
81 };
82
83 // Allocation of arrays.
84 void allocate_array(
85 Register obj, // result: Pointer to array after successful allocation.
86 Register len, // array length
87 Register t1, // temp register
88 Register t2, // temp register
89 int hdr_size, // object header size in words
90 int elt_size, // element size in bytes
91 Register klass, // object klass
92 Label& slow_case // Continuation point if fast allocation fails.
93 );
94
95 // Invalidates registers in this window.
96 void invalidate_registers(Register preserve1 = noreg, Register preserve2 = noreg,
97 Register preserve3 = noreg) PRODUCT_RETURN;
98
99 // This platform only uses signal-based null checks. The Label is not needed.
100 void null_check(Register r, Label *Lnull = nullptr) { MacroAssembler::null_check(r); }
101
102 #endif // CPU_S390_C1_MACROASSEMBLER_S390_HPP