36 // These flags are JVM internal and not part of the AccessFlags classfile specification.
37
38 class InstanceKlassFlags {
39 friend class VMStructs;
40
41 #define IK_FLAGS_DO(flag) \
42 flag(rewritten , 1 << 0) /* methods rewritten. */ \
43 flag(has_nonstatic_fields , 1 << 1) /* for sizing with UseCompressedOops */ \
44 flag(should_verify_class , 1 << 2) /* allow caching of preverification */ \
45 flag(is_contended , 1 << 3) /* marked with contended annotation */ \
46 flag(has_nonstatic_concrete_methods , 1 << 4) /* class/superclass/implemented interfaces has non-static, concrete methods */ \
47 flag(declares_nonstatic_concrete_methods, 1 << 5) /* directly declares non-static, concrete methods */ \
48 flag(shared_loading_failed , 1 << 6) /* class has been loaded from shared archive */ \
49 flag(defined_by_boot_loader , 1 << 7) /* defining class loader is boot class loader */ \
50 flag(defined_by_platform_loader , 1 << 8) /* defining class loader is platform class loader */ \
51 flag(defined_by_app_loader , 1 << 9) /* defining class loader is app class loader */ \
52 flag(has_contended_annotations , 1 << 10) /* has @Contended annotation */ \
53 flag(has_localvariable_table , 1 << 11) /* has localvariable information */ \
54 flag(has_miranda_methods , 1 << 12) /* True if this class has miranda methods in it's vtable */ \
55 flag(has_final_method , 1 << 13) /* True if klass has final method */ \
56 flag(trust_final_fields , 1 << 14) /* All instance final fields in this class should be trusted */ \
57 /* end of list */
58
59 #define IK_FLAGS_ENUM_NAME(name, value) _misc_##name = value,
60 enum {
61 IK_FLAGS_DO(IK_FLAGS_ENUM_NAME)
62 };
63 #undef IK_FLAGS_ENUM_NAME
64
65 #define IK_STATUS_DO(status) \
66 status(is_being_redefined , 1 << 0) /* True if the klass is being redefined */ \
67 status(has_resolved_methods , 1 << 1) /* True if the klass has resolved MethodHandle methods */ \
68 status(has_been_redefined , 1 << 2) /* class has been redefined */ \
69 status(is_scratch_class , 1 << 3) /* class is the redefined scratch class */ \
70 status(is_marked_dependent , 1 << 4) /* class is the redefined scratch class */ \
71 status(has_init_deps_processed , 1 << 5) /* all init dependencies are processed */ \
72 /* end of list */
73
74 #define IK_STATUS_ENUM_NAME(name, value) _misc_##name = value,
75 enum {
76 IK_STATUS_DO(IK_STATUS_ENUM_NAME)
77 };
78 #undef IK_STATUS_ENUM_NAME
79
80 u2 builtin_loader_type_bits() const {
81 return _misc_defined_by_boot_loader|_misc_defined_by_platform_loader|_misc_defined_by_app_loader;
82 }
83
84 // These flags are write-once before the class is published and then read-only so don't require atomic updates.
85 u2 _flags;
86
87 // These flags are written during execution so require atomic stores
88 u1 _status;
89
90 public:
91
92 InstanceKlassFlags() : _flags(0), _status(0) {}
93
94 // Create getters and setters for the flag values.
95 #define IK_FLAGS_GET_SET(name, ignore) \
96 bool name() const { return (_flags & _misc_##name) != 0; } \
97 void set_##name(bool b) { \
98 assert_is_safe(name()); \
99 if (b) _flags |= _misc_##name; \
100 }
101 IK_FLAGS_DO(IK_FLAGS_GET_SET)
102 #undef IK_FLAGS_GET_SET
103
104 bool defined_by_other_loaders() const {
105 return (_flags & builtin_loader_type_bits()) == 0;
106 }
107
108 void set_class_loader_type(const ClassLoaderData* cld);
109
110 void assert_is_safe(bool set) NOT_DEBUG_RETURN;
111
112 // Create getters and setters for the status values.
113 #define IK_STATUS_GET_SET(name, ignore) \
114 bool name() const { return (_status & _misc_##name) != 0; } \
115 void set_##name(bool b) { \
116 if (b) { \
117 atomic_set_bits(_misc_##name); \
118 } else { \
119 atomic_clear_bits(_misc_##name); \
120 } \
121 }
122 IK_STATUS_DO(IK_STATUS_GET_SET)
123 #undef IK_STATUS_GET_SET
124
125 void atomic_set_bits(u1 bits) { AtomicAccess::fetch_then_or(&_status, bits); }
126 void atomic_clear_bits(u1 bits) { AtomicAccess::fetch_then_and(&_status, (u1)(~bits)); }
127 void print_on(outputStream* st) const;
128 };
129
130 #endif // SHARE_OOPS_INSTANCEKLASSFLAGS_HPP
|
36 // These flags are JVM internal and not part of the AccessFlags classfile specification.
37
38 class InstanceKlassFlags {
39 friend class VMStructs;
40
41 #define IK_FLAGS_DO(flag) \
42 flag(rewritten , 1 << 0) /* methods rewritten. */ \
43 flag(has_nonstatic_fields , 1 << 1) /* for sizing with UseCompressedOops */ \
44 flag(should_verify_class , 1 << 2) /* allow caching of preverification */ \
45 flag(is_contended , 1 << 3) /* marked with contended annotation */ \
46 flag(has_nonstatic_concrete_methods , 1 << 4) /* class/superclass/implemented interfaces has non-static, concrete methods */ \
47 flag(declares_nonstatic_concrete_methods, 1 << 5) /* directly declares non-static, concrete methods */ \
48 flag(shared_loading_failed , 1 << 6) /* class has been loaded from shared archive */ \
49 flag(defined_by_boot_loader , 1 << 7) /* defining class loader is boot class loader */ \
50 flag(defined_by_platform_loader , 1 << 8) /* defining class loader is platform class loader */ \
51 flag(defined_by_app_loader , 1 << 9) /* defining class loader is app class loader */ \
52 flag(has_contended_annotations , 1 << 10) /* has @Contended annotation */ \
53 flag(has_localvariable_table , 1 << 11) /* has localvariable information */ \
54 flag(has_miranda_methods , 1 << 12) /* True if this class has miranda methods in it's vtable */ \
55 flag(has_final_method , 1 << 13) /* True if klass has final method */ \
56 flag(has_inlined_fields , 1 << 14) /* has inlined fields and related embedded section is not empty */ \
57 flag(is_empty_inline_type , 1 << 15) /* empty inline type (*) */ \
58 flag(is_naturally_atomic , 1 << 16) /* loaded/stored in one instruction*/ \
59 flag(must_be_atomic , 1 << 17) /* doesn't allow tearing */ \
60 flag(has_loosely_consistent_annotation , 1 << 18) /* the class has the LooselyConsistentValue annotation WARNING: it doesn't automatically mean that the class allows tearing */ \
61 flag(has_strict_static_fields , 1 << 19) /* True if strict static fields declared */ \
62 flag(trust_final_fields , 1 << 20) /* All instance final fields in this class should be trusted */ \
63 flag(has_null_restricted_static_fields , 1 << 21) /* True if static null restricted fields declared */ \
64 /* end of list */
65
66 // (*) An inline type is considered empty if it contains no non-static fields or
67 // if it contains only empty inline fields. Note that JITs have a slightly different
68 // definition: empty inline fields must be flat otherwise the container won't
69 // be considered empty.
70
71 public:
72 #define IK_FLAGS_ENUM_NAME(name, value) _misc_##name = value,
73 enum {
74 IK_FLAGS_DO(IK_FLAGS_ENUM_NAME)
75 };
76 #undef IK_FLAGS_ENUM_NAME
77
78 private:
79 #define IK_STATUS_DO(status) \
80 status(is_being_redefined , 1 << 0) /* True if the klass is being redefined */ \
81 status(has_resolved_methods , 1 << 1) /* True if the klass has resolved MethodHandle methods */ \
82 status(has_been_redefined , 1 << 2) /* class has been redefined */ \
83 status(is_scratch_class , 1 << 3) /* class is the redefined scratch class */ \
84 status(is_marked_dependent , 1 << 4) /* class is the redefined scratch class */ \
85 status(has_init_deps_processed , 1 << 5) /* all init dependencies are processed */ \
86 /* end of list */
87
88 #define IK_STATUS_ENUM_NAME(name, value) _misc_##name = value,
89 enum {
90 IK_STATUS_DO(IK_STATUS_ENUM_NAME)
91 };
92 #undef IK_STATUS_ENUM_NAME
93
94 u2 builtin_loader_type_bits() const {
95 return _misc_defined_by_boot_loader|_misc_defined_by_platform_loader|_misc_defined_by_app_loader;
96 }
97
98 // These flags are write-once before the class is published and then read-only so don't require atomic updates.
99 u4 _flags;
100
101 // These flags are written during execution so require atomic stores
102 u1 _status;
103
104 public:
105
106 InstanceKlassFlags() : _flags(0), _status(0) {}
107
108 // Create getters and setters for the flag values.
109 #define IK_FLAGS_GET_SET(name, ignore) \
110 bool name() const { return (_flags & _misc_##name) != 0; } \
111 void set_##name(bool b) { \
112 assert_is_safe(name()); \
113 if (b) _flags |= _misc_##name; \
114 }
115 IK_FLAGS_DO(IK_FLAGS_GET_SET)
116 #undef IK_FLAGS_GET_SET
117
118 bool defined_by_other_loaders() const {
119 return (_flags & builtin_loader_type_bits()) == 0;
120 }
121
122 void set_class_loader_type(const ClassLoaderData* cld);
123
124 u4 flags() const { return _flags; }
125
126 static u4 is_empty_inline_type_value() {
127 return _misc_is_empty_inline_type;
128 }
129
130 void assert_is_safe(bool set) NOT_DEBUG_RETURN;
131
132 // Create getters and setters for the status values.
133 #define IK_STATUS_GET_SET(name, ignore) \
134 bool name() const { return (_status & _misc_##name) != 0; } \
135 void set_##name(bool b) { \
136 if (b) { \
137 atomic_set_bits(_misc_##name); \
138 } else { \
139 atomic_clear_bits(_misc_##name); \
140 } \
141 }
142 IK_STATUS_DO(IK_STATUS_GET_SET)
143 #undef IK_STATUS_GET_SET
144
145 void atomic_set_bits(u1 bits) { AtomicAccess::fetch_then_or(&_status, bits); }
146 void atomic_clear_bits(u1 bits) { AtomicAccess::fetch_then_and(&_status, (u1)(~bits)); }
147 void print_on(outputStream* st) const;
148
149 static ByteSize flags_offset() { return byte_offset_of(InstanceKlassFlags, _flags); }
150 };
151
152 #endif // SHARE_OOPS_INSTANCEKLASSFLAGS_HPP
|