< prev index next >

src/hotspot/share/oops/instanceKlassFlags.hpp

Print this page

 37 
 38 class InstanceKlassFlags {
 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(trust_final_fields                 , 1 << 14) /* All instance final fields in this class should be trusted */ \






 58     /* end of list */
 59 





 60 #define IK_FLAGS_ENUM_NAME(name, value)    _misc_##name = value,
 61   enum {
 62     IK_FLAGS_DO(IK_FLAGS_ENUM_NAME)
 63   };
 64 #undef IK_FLAGS_ENUM_NAME
 65 
 66 #define IK_STATUS_DO(status)  \
 67     status(is_being_redefined                , 1 << 0) /* True if the klass is being redefined */ \
 68     status(has_resolved_methods              , 1 << 1) /* True if the klass has resolved MethodHandle methods */ \
 69     status(has_been_redefined                , 1 << 2) /* class has been redefined */ \
 70     status(is_scratch_class                  , 1 << 3) /* class is the redefined scratch class */ \
 71     status(is_marked_dependent               , 1 << 4) /* class is the redefined scratch class */ \
 72     status(has_init_deps_processed           , 1 << 5) /* all init dependencies are processed */ \
 73     /* end of list */
 74 
 75 #define IK_STATUS_ENUM_NAME(name, value)    _misc_##name = value,
 76   enum {
 77     IK_STATUS_DO(IK_STATUS_ENUM_NAME)
 78   };
 79 #undef IK_STATUS_ENUM_NAME
 80 
 81   u2 builtin_loader_type_bits() const {
 82     return _misc_defined_by_boot_loader|_misc_defined_by_platform_loader|_misc_defined_by_app_loader;
 83   }
 84 
 85   // These flags are write-once before the class is published and then read-only so don't require atomic updates.
 86   u2 _flags;
 87 
 88   // These flags are written during execution so require atomic stores
 89   u1 _status;
 90 
 91  public:
 92 
 93   InstanceKlassFlags() : _flags(0), _status(0) {}
 94 
 95   // Create getters and setters for the flag values.
 96 #define IK_FLAGS_GET_SET(name, ignore)          \
 97   bool name() const { return (_flags & _misc_##name) != 0; } \
 98   void set_##name(bool b) {         \
 99     assert_is_safe(name());         \
100     if (b) _flags |= _misc_##name; \
101   }
102   IK_FLAGS_DO(IK_FLAGS_GET_SET)
103 #undef IK_FLAGS_GET_SET
104 
105   bool defined_by_other_loaders() const {
106     return (_flags & builtin_loader_type_bits()) == 0;
107   }
108 
109   void set_class_loader_type(const ClassLoaderData* cld);
110 







111   void assert_is_safe(bool set) NOT_DEBUG_RETURN;
112 
113   // Create getters and setters for the status values.
114 #define IK_STATUS_GET_SET(name, ignore)          \
115   bool name() const { return (_status & _misc_##name) != 0; } \
116   void set_##name(bool b) {         \
117     if (b) { \
118       atomic_set_bits(_misc_##name); \
119     } else { \
120       atomic_clear_bits(_misc_##name); \
121     } \
122   }
123   IK_STATUS_DO(IK_STATUS_GET_SET)
124 #undef IK_STATUS_GET_SET
125 
126   void atomic_set_bits(u1 bits)   { AtomicAccess::fetch_then_or(&_status, bits); }
127   void atomic_clear_bits(u1 bits) { AtomicAccess::fetch_then_and(&_status, (u1)(~bits)); }
128   void print_on(outputStream* st) const;
129 };
130 

 37 
 38 class InstanceKlassFlags {
 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_inlined_fields                 , 1 << 14) /* has inlined fields and related embedded section is not empty */ \
 58     flag(is_empty_inline_type               , 1 << 15) /* empty inline type (*) */ \
 59     flag(is_naturally_atomic                , 1 << 16) /* loaded/stored in one instruction*/ \
 60     flag(must_be_atomic                     , 1 << 17) /* doesn't allow tearing */ \
 61     flag(has_loosely_consistent_annotation  , 1 << 18) /* the class has the LooselyConsistentValue annotation WARNING: it doesn't automatically mean that the class allows tearing */ \
 62     flag(has_strict_static_fields           , 1 << 19) /* True if strict static fields declared */ \
 63     flag(trust_final_fields                 , 1 << 20) /* All instance final fields in this class should be trusted */ \
 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 #define IK_FLAGS_ENUM_NAME(name, value)    _misc_##name = value,
 72   enum {
 73     IK_FLAGS_DO(IK_FLAGS_ENUM_NAME)
 74   };
 75 #undef IK_FLAGS_ENUM_NAME
 76 
 77 #define IK_STATUS_DO(status)  \
 78     status(is_being_redefined                , 1 << 0) /* True if the klass is being redefined */ \
 79     status(has_resolved_methods              , 1 << 1) /* True if the klass has resolved MethodHandle methods */ \
 80     status(has_been_redefined                , 1 << 2) /* class has been redefined */ \
 81     status(is_scratch_class                  , 1 << 3) /* class is the redefined scratch class */ \
 82     status(is_marked_dependent               , 1 << 4) /* class is the redefined scratch class */ \
 83     status(has_init_deps_processed           , 1 << 5) /* all init dependencies are processed */ \
 84     /* end of list */
 85 
 86 #define IK_STATUS_ENUM_NAME(name, value)    _misc_##name = value,
 87   enum {
 88     IK_STATUS_DO(IK_STATUS_ENUM_NAME)
 89   };
 90 #undef IK_STATUS_ENUM_NAME
 91 
 92   u2 builtin_loader_type_bits() const {
 93     return _misc_defined_by_boot_loader|_misc_defined_by_platform_loader|_misc_defined_by_app_loader;
 94   }
 95 
 96   // These flags are write-once before the class is published and then read-only so don't require atomic updates.
 97   u4 _flags;
 98 
 99   // These flags are written during execution so require atomic stores
100   u1 _status;
101 
102  public:
103 
104   InstanceKlassFlags() : _flags(0), _status(0) {}
105 
106   // Create getters and setters for the flag values.
107 #define IK_FLAGS_GET_SET(name, ignore)          \
108   bool name() const { return (_flags & _misc_##name) != 0; } \
109   void set_##name(bool b) {         \
110     assert_is_safe(name());         \
111     if (b) _flags |= _misc_##name; \
112   }
113   IK_FLAGS_DO(IK_FLAGS_GET_SET)
114 #undef IK_FLAGS_GET_SET
115 
116   bool defined_by_other_loaders() const {
117     return (_flags & builtin_loader_type_bits()) == 0;
118   }
119 
120   void set_class_loader_type(const ClassLoaderData* cld);
121 
122 
123   u4 flags() const { return _flags; }
124 
125   static u4 is_empty_inline_type_value() {
126     return _misc_is_empty_inline_type;
127   }
128 
129   void assert_is_safe(bool set) NOT_DEBUG_RETURN;
130 
131   // Create getters and setters for the status values.
132 #define IK_STATUS_GET_SET(name, ignore)          \
133   bool name() const { return (_status & _misc_##name) != 0; } \
134   void set_##name(bool b) {         \
135     if (b) { \
136       atomic_set_bits(_misc_##name); \
137     } else { \
138       atomic_clear_bits(_misc_##name); \
139     } \
140   }
141   IK_STATUS_DO(IK_STATUS_GET_SET)
142 #undef IK_STATUS_GET_SET
143 
144   void atomic_set_bits(u1 bits)   { AtomicAccess::fetch_then_or(&_status, bits); }
145   void atomic_clear_bits(u1 bits) { AtomicAccess::fetch_then_and(&_status, (u1)(~bits)); }
146   void print_on(outputStream* st) const;
147 };
148 
< prev index next >