1 /*
2 * Copyright (c) 2017, 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 *
23 */
24
25 #ifndef SHARE_VM_CI_CIINLINEKLASS_HPP
26 #define SHARE_VM_CI_CIINLINEKLASS_HPP
27
28 #include "ci/ciConstantPoolCache.hpp"
29 #include "ci/ciEnv.hpp"
30 #include "ci/ciFlags.hpp"
31 #include "ci/ciInstanceKlass.hpp"
32 #include "ci/ciSymbol.hpp"
33 #include "oops/inlineKlass.hpp"
34
35 // ciInlineKlass
36 //
37 // Specialized ciInstanceKlass for inline types.
38 class ciInlineKlass : public ciInstanceKlass {
39 CI_PACKAGE_ACCESS
40
41 private:
42
43 InlineKlass* to_InlineKlass() const {
44 return InlineKlass::cast(get_Klass());
45 }
46
47 protected:
48 ciInlineKlass(Klass* h_k) : ciInstanceKlass(h_k) {
49 assert(is_final(), "InlineKlass must be final");
50 };
51
52 ciInlineKlass(ciSymbol* name, jobject loader) :
53 ciInstanceKlass(name, loader, T_OBJECT) {}
54
55 const char* type_string() { return "ciInlineKlass"; }
56
57 public:
58 bool is_inlinetype() const { return true; }
59
60 // Inline type fields
61 int payload_offset() const;
62
63 bool maybe_flat_in_array() const;
64 bool can_be_passed_as_fields() const;
65 bool can_be_returned_as_fields() const;
66 bool is_empty();
67 int inline_arg_slots();
68 bool contains_oops() const;
69 int oop_count() const;
70 address pack_handler() const;
71 address unpack_handler() const;
72 InlineKlass* get_InlineKlass() const;
73 int nullable_size_in_bytes() const;
74 bool has_non_atomic_layout() const;
75 bool has_atomic_layout() const;
76 bool has_nullable_atomic_layout() const;
77 int null_marker_offset_in_payload() const;
78 BasicType atomic_size_to_basic_type(bool null_free) const;
79
80 bool must_be_atomic() const;
81 bool is_naturally_atomic(bool null_free);
82 };
83
84 #endif // SHARE_VM_CI_CIINLINEKLASS_HPP