1 /*
 2  * Copyright (c) 2020, 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  */
23 
24 #ifndef CPU_X86_VM_FOREIGN_GLOBALS_X86_HPP
25 #define CPU_X86_VM_FOREIGN_GLOBALS_X86_HPP
26 
27 #include "asm/macroAssembler.hpp"
28 #include "utilities/growableArray.hpp"
29 
30 constexpr size_t xmm_reg_size = 16; // size of XMM reg
31 
32 struct ABIDescriptor {
33     GrowableArray<Register> _integer_argument_registers;
34     GrowableArray<Register> _integer_return_registers;
35     GrowableArray<XMMRegister> _vector_argument_registers;
36     GrowableArray<XMMRegister> _vector_return_registers;
37     size_t _X87_return_registers_noof;
38 
39     GrowableArray<Register> _integer_additional_volatile_registers;
40     GrowableArray<XMMRegister> _vector_additional_volatile_registers;
41 
42     int32_t _stack_alignment_bytes;
43     int32_t _shadow_space_bytes;
44 
45     bool is_volatile_reg(Register reg) const;
46     bool is_volatile_reg(XMMRegister reg) const;
47 };
48 
49 struct BufferLayout {
50   size_t stack_args_bytes;
51   size_t stack_args;
52   size_t arguments_vector;
53   size_t arguments_integer;
54   size_t arguments_next_pc;
55   size_t returns_vector;
56   size_t returns_integer;
57   size_t returns_x87;
58   size_t buffer_size;
59 };
60 
61 #endif // CPU_X86_VM_FOREIGN_GLOBALS_X86_HPP