114 _inner_classes = NULL; 115 _local_interfaces = NULL; 116 _transitive_interfaces = NULL; 117 _combined_annotations = NULL; 118 _annotations = _type_annotations = NULL; 119 _fields_annotations = _fields_type_annotations = NULL; 120 } 121 122 class AnnotationCollector { 123 public: 124 enum Location { _in_field, _in_method, _in_class }; 125 enum ID { 126 _unknown = 0, 127 _method_CallerSensitive, 128 _method_ForceInline, 129 _method_DontInline, 130 _method_InjectedProfile, 131 _method_LambdaForm_Compiled, 132 _method_LambdaForm_Hidden, 133 _method_HotSpotIntrinsicCandidate, 134 _sun_misc_Contended, 135 _field_Stable, 136 _annotation_LIMIT 137 }; 138 const Location _location; 139 int _annotations_present; 140 u2 _contended_group; 141 142 AnnotationCollector(Location location) 143 : _location(location), _annotations_present(0) 144 { 145 assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, ""); 146 } 147 // If this annotation name has an ID, report it (or _none). 148 ID annotation_index(ClassLoaderData* loader_data, Symbol* name); 149 // Set the annotation name: 150 void set_annotation(ID id) { 151 assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob"); 152 _annotations_present |= nth_bit((int)id); 153 } 154 155 void remove_annotation(ID id) { 156 assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob"); 157 _annotations_present &= ~nth_bit((int)id); 158 } 159 160 // Report if the annotation is present. 161 bool has_any_annotations() const { return _annotations_present != 0; } 162 bool has_annotation(ID id) const { return (nth_bit((int)id) & _annotations_present) != 0; } 163 164 void set_contended_group(u2 group) { _contended_group = group; } 165 u2 contended_group() const { return _contended_group; } 166 167 bool is_contended() const { return has_annotation(_sun_misc_Contended); } 168 169 void set_stable(bool stable) { set_annotation(_field_Stable); } 170 bool is_stable() const { return has_annotation(_field_Stable); } 171 }; 172 173 // This class also doubles as a holder for metadata cleanup. 174 class FieldAnnotationCollector: public AnnotationCollector { 175 ClassLoaderData* _loader_data; 176 AnnotationArray* _field_annotations; 177 AnnotationArray* _field_type_annotations; 178 public: 179 FieldAnnotationCollector(ClassLoaderData* loader_data) : 180 AnnotationCollector(_in_field), 181 _loader_data(loader_data), 182 _field_annotations(NULL), 183 _field_type_annotations(NULL) {} 184 void apply_to(FieldInfo* f); 185 ~FieldAnnotationCollector(); 186 AnnotationArray* field_annotations() { return _field_annotations; } 187 AnnotationArray* field_type_annotations() { return _field_type_annotations; } 188 189 void set_field_annotations(AnnotationArray* a) { _field_annotations = a; } 190 void set_field_type_annotations(AnnotationArray* a) { _field_type_annotations = a; } | 114 _inner_classes = NULL; 115 _local_interfaces = NULL; 116 _transitive_interfaces = NULL; 117 _combined_annotations = NULL; 118 _annotations = _type_annotations = NULL; 119 _fields_annotations = _fields_type_annotations = NULL; 120 } 121 122 class AnnotationCollector { 123 public: 124 enum Location { _in_field, _in_method, _in_class }; 125 enum ID { 126 _unknown = 0, 127 _method_CallerSensitive, 128 _method_ForceInline, 129 _method_DontInline, 130 _method_InjectedProfile, 131 _method_LambdaForm_Compiled, 132 _method_LambdaForm_Hidden, 133 _method_HotSpotIntrinsicCandidate, 134 _method_Accessor_Method, 135 _sun_misc_Contended, 136 _field_Stable, 137 _annotation_LIMIT 138 }; 139 const Location _location; 140 int _annotations_present; 141 u2 _contended_group; 142 u2 _accessor_field_name; 143 144 AnnotationCollector(Location location) 145 : _location(location), _annotations_present(0) 146 { 147 assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, ""); 148 } 149 // If this annotation name has an ID, report it (or _none). 150 ID annotation_index(ClassLoaderData* loader_data, Symbol* name); 151 // Set the annotation name: 152 void set_annotation(ID id) { 153 assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob"); 154 _annotations_present |= nth_bit((int)id); 155 } 156 157 void remove_annotation(ID id) { 158 assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob"); 159 _annotations_present &= ~nth_bit((int)id); 160 } 161 162 // Report if the annotation is present. 163 bool has_any_annotations() const { return _annotations_present != 0; } 164 bool has_annotation(ID id) const { return (nth_bit((int)id) & _annotations_present) != 0; } 165 166 void set_contended_group(u2 group) { _contended_group = group; } 167 u2 contended_group() const { return _contended_group; } 168 169 bool is_contended() const { return has_annotation(_sun_misc_Contended); } 170 171 void set_stable(bool stable) { set_annotation(_field_Stable); } 172 bool is_stable() const { return has_annotation(_field_Stable); } 173 174 void set_accessor_field_name(u2 fname) { _accessor_field_name = fname; } 175 u2 accessor_field_name() { return _accessor_field_name; } 176 177 bool is_accessor() const { return has_annotation(_method_Accessor_Method); } 178 179 }; 180 181 // This class also doubles as a holder for metadata cleanup. 182 class FieldAnnotationCollector: public AnnotationCollector { 183 ClassLoaderData* _loader_data; 184 AnnotationArray* _field_annotations; 185 AnnotationArray* _field_type_annotations; 186 public: 187 FieldAnnotationCollector(ClassLoaderData* loader_data) : 188 AnnotationCollector(_in_field), 189 _loader_data(loader_data), 190 _field_annotations(NULL), 191 _field_type_annotations(NULL) {} 192 void apply_to(FieldInfo* f); 193 ~FieldAnnotationCollector(); 194 AnnotationArray* field_annotations() { return _field_annotations; } 195 AnnotationArray* field_type_annotations() { return _field_type_annotations; } 196 197 void set_field_annotations(AnnotationArray* a) { _field_annotations = a; } 198 void set_field_type_annotations(AnnotationArray* a) { _field_type_annotations = a; } |