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