1 /*
 2  * Copyright (c) 2017, 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  *
23  */
24 
25 #ifndef SHARE_VM_CI_CIINLINEKLASS_HPP
26 #define SHARE_VM_CI_CIINLINEKLASS_HPP
27 
28 #include "ci/ciInstanceKlass.hpp"
29 #include "oops/inlineKlass.hpp"
30 
31 // ciInlineKlass
32 //
33 // Specialized ciInstanceKlass for inline types.
34 class ciInlineKlass : public ciInstanceKlass {
35   CI_PACKAGE_ACCESS
36 
37 private:
38 
39   InlineKlass* to_InlineKlass() const {
40     return InlineKlass::cast(get_Klass());
41   }
42 
43 protected:
44   ciInlineKlass(Klass* h_k) : ciInstanceKlass(h_k) {
45     assert(is_final(), "InlineKlass must be final");
46   };
47 
48   ciInlineKlass(ciSymbol* name, jobject loader) :
49     ciInstanceKlass(name, loader, T_OBJECT) {}
50 
51   const char* type_string() override { return "ciInlineKlass"; }
52 
53 public:
54   bool is_inlinetype() const override { return true; }
55 
56   // Inline type fields
57   int payload_offset() const;
58 
59   bool maybe_flat_in_array() const override;
60   bool is_always_flat_in_array() const;
61 
62   // Scalarized calling convention support: pass/return this inline type as its
63   // field components in the calling convention (registers/stack), not as a single oop.
64   // See InlineKlass::initialize_calling_convention for details.
65   bool can_be_passed_as_fields() const;
66   bool can_be_returned_as_fields() const;
67 
68   bool is_empty();
69   int inline_arg_length() const;
70   int inline_arg_slots() const;
71   bool contains_oops() const;
72   int oop_count() const;
73   address pack_handler() const;
74   address unpack_handler() const;
75   InlineKlass* get_InlineKlass() const;
76   bool has_null_free_non_atomic_layout() const;
77   bool has_null_free_atomic_layout() const;
78   bool has_nullable_atomic_layout() const;
79   int null_marker_offset_in_payload() const;
80   BasicType atomic_size_to_basic_type(bool null_free) const;
81 
82   bool is_naturally_atomic(bool null_free);
83   int field_map_offset() const;
84   ciConstant get_field_map() const;
85   ciConstant get_null_reset_value();
86 };
87 
88 #endif // SHARE_VM_CI_CIINLINEKLASS_HPP