1 /*
 2  * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
 3  * Copyright (c) 2016 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   void initialize_object(
44     Register obj,                      // result: Pointer to object after successful allocation.
45     Register klass,                    // object klass
46     Register var_size_in_bytes,        // Object size in bytes if unknown at compile time; invalid otherwise.
47     int      con_size_in_bytes,        // Object size in bytes if   known at compile time.
48     Register t1,                       // temp register
49     Register t2                        // temp register
50   );
51 
52   // Allocation of fixed-size objects.
53   // This can also be used to allocate fixed-size arrays, by setting
54   // hdr_size correctly and storing the array length afterwards.
55   void allocate_object(
56     Register obj,                      // result: Pointer to object after successful allocation.
57     Register t1,                       // temp register
58     Register t2,                       // temp register
59     int      hdr_size,                 // object header size in words
60     int      obj_size,                 // object size in words
61     Register klass,                    // object klass
62     Label&   slow_case                 // Continuation point if fast allocation fails.
63   );
64 
65   enum {
66     max_array_allocation_length = 0x01000000
67   };
68 
69   // Allocation of arrays.
70   void allocate_array(
71     Register obj,                      // result: Pointer to array after successful allocation.
72     Register len,                      // array length
73     Register t1,                       // temp register
74     Register t2,                       // temp register
75     int      hdr_size,                 // object header size in words
76     int      elt_size,                 // element size in bytes
77     Register klass,                    // object klass
78     Label&   slow_case                 // Continuation point if fast allocation fails.
79   );
80 
81   // Invalidates registers in this window.
82   void invalidate_registers(Register preserve1 = noreg, Register preserve2 = noreg,
83                             Register preserve3 = noreg) PRODUCT_RETURN;
84 
85   // This platform only uses signal-based null checks. The Label is not needed.
86   void null_check(Register r, Label *Lnull = NULL) { MacroAssembler::null_check(r); }
87 
88 #endif // CPU_S390_C1_MACROASSEMBLER_S390_HPP