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