< 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(is_shared_boot_class               , 1 << 7) /* defining class loader is boot class loader */ \
 51     flag(is_shared_platform_class           , 1 << 8) /* defining class loader is platform class loader */ \
 52     flag(is_shared_app_class                , 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     /* 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     /* end of list */
 72 
 73 #define IK_STATUS_ENUM_NAME(name, value)    _misc_##name = value,
 74   enum {
 75     IK_STATUS_DO(IK_STATUS_ENUM_NAME)
 76   };
 77 #undef IK_STATUS_ENUM_NAME
 78 
 79   u2 shared_loader_type_bits() const {
 80     return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
 81   }
 82 
 83   // These flags are write-once before the class is published and then read-only so don't require atomic updates.
 84   u2 _flags;
 85 
 86   // These flags are written during execution so require atomic stores
 87   u1 _status;
 88 
 89  public:
 90 
 91   InstanceKlassFlags() : _flags(0), _status(0) {}
 92 
 93   // Create getters and setters for the flag values.
 94 #define IK_FLAGS_GET_SET(name, ignore)          \
 95   bool name() const { return (_flags & _misc_##name) != 0; } \
 96   void set_##name(bool b) {         \
 97     assert_is_safe(name());         \
 98     if (b) _flags |= _misc_##name; \
 99   }
100   IK_FLAGS_DO(IK_FLAGS_GET_SET)
101 #undef IK_FLAGS_GET_SET
102 
103   bool is_shared_unregistered_class() const {
104     return (_flags & shared_loader_type_bits()) == 0;
105   }
106 
107   void set_shared_class_loader_type(s2 loader_type);
108 
109   void assign_class_loader_type(const ClassLoaderData* cld);







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)   { Atomic::fetch_then_or(&_status, bits); }
126   void atomic_clear_bits(u1 bits) { Atomic::fetch_then_and(&_status, (u1)(~bits)); }
127   void print_on(outputStream* st) const;
128 };
129 

 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(is_shared_boot_class               , 1 << 7) /* defining class loader is boot class loader */ \
 51     flag(is_shared_platform_class           , 1 << 8) /* defining class loader is platform class loader */ \
 52     flag(is_shared_app_class                , 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_inline_type_fields             , 1 << 14) /* has inline 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(is_implicitly_constructible        , 1 << 19) /* the class has the ImplicitlyConstrutible annotation */ \
 63     /* end of list */
 64 
 65   /* (*) An inline type is considered empty if it contains no non-static fields or
 66      if it contains only empty inline fields. Note that JITs have a slightly different
 67      definition: empty inline fields must be flat otherwise the container won't
 68      be considered empty */
 69 
 70 #define IK_FLAGS_ENUM_NAME(name, value)    _misc_##name = value,
 71   enum {
 72     IK_FLAGS_DO(IK_FLAGS_ENUM_NAME)
 73   };
 74 #undef IK_FLAGS_ENUM_NAME
 75 
 76 #define IK_STATUS_DO(status)  \
 77     status(is_being_redefined                , 1 << 0) /* True if the klass is being redefined */ \
 78     status(has_resolved_methods              , 1 << 1) /* True if the klass has resolved MethodHandle methods */ \
 79     status(has_been_redefined                , 1 << 2) /* class has been redefined */ \
 80     status(is_scratch_class                  , 1 << 3) /* class is the redefined scratch class */ \
 81     status(is_marked_dependent               , 1 << 4) /* class is the redefined scratch class */ \
 82     /* end of list */
 83 
 84 #define IK_STATUS_ENUM_NAME(name, value)    _misc_##name = value,
 85   enum {
 86     IK_STATUS_DO(IK_STATUS_ENUM_NAME)
 87   };
 88 #undef IK_STATUS_ENUM_NAME
 89 
 90   u2 shared_loader_type_bits() const {
 91     return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
 92   }
 93 
 94   // These flags are write-once before the class is published and then read-only so don't require atomic updates.
 95   u4 _flags;
 96 
 97   // These flags are written during execution so require atomic stores
 98   u1 _status;
 99 
100  public:
101 
102   InstanceKlassFlags() : _flags(0), _status(0) {}
103 
104   // Create getters and setters for the flag values.
105 #define IK_FLAGS_GET_SET(name, ignore)          \
106   bool name() const { return (_flags & _misc_##name) != 0; } \
107   void set_##name(bool b) {         \
108     assert_is_safe(name());         \
109     if (b) _flags |= _misc_##name; \
110   }
111   IK_FLAGS_DO(IK_FLAGS_GET_SET)
112 #undef IK_FLAGS_GET_SET
113 
114   bool is_shared_unregistered_class() const {
115     return (_flags & shared_loader_type_bits()) == 0;
116   }
117 
118   void set_shared_class_loader_type(s2 loader_type);
119 
120   void assign_class_loader_type(const ClassLoaderData* cld);
121 
122   u4 flags() const { return _flags; }
123 
124   static u4 is_empty_inline_type_value() {
125     return _misc_is_empty_inline_type;
126   }
127 
128   void assert_is_safe(bool set) NOT_DEBUG_RETURN;
129 
130   // Create getters and setters for the status values.
131 #define IK_STATUS_GET_SET(name, ignore)          \
132   bool name() const { return (_status & _misc_##name) != 0; } \
133   void set_##name(bool b) {         \
134     if (b) { \
135       atomic_set_bits(_misc_##name); \
136     } else { \
137       atomic_clear_bits(_misc_##name); \
138     } \
139   }
140   IK_STATUS_DO(IK_STATUS_GET_SET)
141 #undef IK_STATUS_GET_SET
142 
143   void atomic_set_bits(u1 bits)   { Atomic::fetch_then_or(&_status, bits); }
144   void atomic_clear_bits(u1 bits) { Atomic::fetch_then_and(&_status, (u1)(~bits)); }
145   void print_on(outputStream* st) const;
146 };
147 
< prev index next >