< prev index next >

src/hotspot/share/oops/instanceKlassFlags.hpp

Print this page

 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_vanilla_constructor            , 1 << 13) /* True if klass has a vanilla default constructor */ \
 57     flag(has_final_method                   , 1 << 14) /* True if klass has final method */ \








 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     /* 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 shared_loader_type_bits() const {
 81     return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
 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 is_shared_unregistered_class() const {
105     return (_flags & shared_loader_type_bits()) == 0;
106   }
107 
108   void set_shared_class_loader_type(s2 loader_type);
109 
110   void assign_class_loader_type(const ClassLoaderData* cld);







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

 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_vanilla_constructor            , 1 << 13) /* True if klass has a vanilla default constructor */ \
 57     flag(has_final_method                   , 1 << 14) /* True if klass has final method */ \
 58     flag(has_inline_type_fields             , 1 << 15) /* has inline fields and related embedded section is not empty */ \
 59     flag(is_empty_inline_type               , 1 << 16) /* empty inline type (*) */ \
 60     flag(is_naturally_atomic                , 1 << 17) /* loaded/stored in one instruction */ \
 61     flag(must_be_atomic                     , 1 << 18) /* doesn't allow tearing */ \
 62     flag(carries_value_modifier             , 1 << 19) /* the class or one of its super types has the ACC_VALUE modifier */ \
 63     flag(carries_identity_modifier          , 1 << 20) /* the class or one of its super types has the ACC_IDENTITY modifier */ \
 64     flag(has_loosely_consistent_annotation  , 1 << 21) /* the class has the LooselyConsistentValue annotation WARNING: it doesn't automatically mean that the class allows tearing */ \
 65     flag(is_implicitly_constructible        , 1 << 22) /* the class has the ImplicitlyConstrutible annotation */
 66     /* end of list */
 67 
 68   /* (*) An inline type is considered empty if it contains no non-static fields or
 69      if it contains only empty inline fields. Note that JITs have a slightly different
 70      definition: empty inline fields must be flat otherwise the container won't
 71      be considered empty */
 72 
 73 #define IK_FLAGS_ENUM_NAME(name, value)    _misc_##name = value,
 74   enum {
 75     IK_FLAGS_DO(IK_FLAGS_ENUM_NAME)
 76   };
 77 #undef IK_FLAGS_ENUM_NAME
 78 
 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     /* 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 shared_loader_type_bits() const {
 94     return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
 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 is_shared_unregistered_class() const {
118     return (_flags & shared_loader_type_bits()) == 0;
119   }
120 
121   void set_shared_class_loader_type(s2 loader_type);
122 
123   void assign_class_loader_type(const ClassLoaderData* cld);
124 
125   u4 flags() const { return _flags; }
126 
127   static u4 is_empty_inline_type_value() {
128     return _misc_is_empty_inline_type;
129   }
130 
131   void assert_is_safe(bool set) NOT_DEBUG_RETURN;
132 
133   // Create getters and setters for the status values.
134 #define IK_STATUS_GET_SET(name, ignore)          \
135   bool name() const { return (_status & _misc_##name) != 0; } \
136   void set_##name(bool b) {         \
137     if (b) { \
138       atomic_set_bits(_misc_##name); \
139     } else { \
140       atomic_clear_bits(_misc_##name); \
141     } \
142   }
143   IK_STATUS_DO(IK_STATUS_GET_SET)
144 #undef IK_STATUS_GET_SET
145 
146   void atomic_set_bits(u1 bits)   { Atomic::fetch_then_or(&_status, bits); }
147   void atomic_clear_bits(u1 bits) { Atomic::fetch_then_and(&_status, (u1)(~bits)); }
148   void print_on(outputStream* st) const;
149 };
150 
< prev index next >