Mercurial > hg > graal-compiler
comparison src/share/vm/classfile/classFileParser.hpp @ 7587:4a916f2ce331
8003985: Support @Contended Annotation - JEP 142
Summary: HotSpot changes to support @Contended annotation.
Reviewed-by: coleenp, kvn, jrose
Contributed-by: Aleksey Shipilev <aleksey.shipilev@oracle.com>
author | jwilhelm |
---|---|
date | Mon, 14 Jan 2013 15:17:47 +0100 |
parents | 35431a769282 |
children | 927a311d00f9 |
comparison
equal
deleted
inserted
replaced
7586:90a92d5bca17 | 7587:4a916f2ce331 |
---|---|
93 _unknown = 0, | 93 _unknown = 0, |
94 _method_ForceInline, | 94 _method_ForceInline, |
95 _method_DontInline, | 95 _method_DontInline, |
96 _method_LambdaForm_Compiled, | 96 _method_LambdaForm_Compiled, |
97 _method_LambdaForm_Hidden, | 97 _method_LambdaForm_Hidden, |
98 _sun_misc_Contended, | |
98 _annotation_LIMIT | 99 _annotation_LIMIT |
99 }; | 100 }; |
100 const Location _location; | 101 const Location _location; |
101 int _annotations_present; | 102 int _annotations_present; |
103 u2 _contended_group; | |
104 | |
102 AnnotationCollector(Location location) | 105 AnnotationCollector(Location location) |
103 : _location(location), _annotations_present(0) | 106 : _location(location), _annotations_present(0) |
104 { | 107 { |
105 assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, ""); | 108 assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, ""); |
106 } | 109 } |
107 // If this annotation name has an ID, report it (or _none). | 110 // If this annotation name has an ID, report it (or _none). |
108 ID annotation_index(Symbol* name); | 111 ID annotation_index(ClassLoaderData* loader_data, Symbol* name); |
109 // Set the annotation name: | 112 // Set the annotation name: |
110 void set_annotation(ID id) { | 113 void set_annotation(ID id) { |
111 assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob"); | 114 assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob"); |
112 _annotations_present |= nth_bit((int)id); | 115 _annotations_present |= nth_bit((int)id); |
113 } | 116 } |
114 // Report if the annotation is present. | 117 // Report if the annotation is present. |
115 bool has_any_annotations() { return _annotations_present != 0; } | 118 bool has_any_annotations() { return _annotations_present != 0; } |
116 bool has_annotation(ID id) { return (nth_bit((int)id) & _annotations_present) != 0; } | 119 bool has_annotation(ID id) { return (nth_bit((int)id) & _annotations_present) != 0; } |
120 | |
121 void set_contended_group(u2 group) { _contended_group = group; } | |
122 u2 contended_group() { return _contended_group; } | |
123 | |
124 void set_contended(bool contended) { set_annotation(_sun_misc_Contended); } | |
125 bool is_contended() { return has_annotation(_sun_misc_Contended); } | |
117 }; | 126 }; |
118 class FieldAnnotationCollector: public AnnotationCollector { | 127 class FieldAnnotationCollector: public AnnotationCollector { |
119 public: | 128 public: |
120 FieldAnnotationCollector() : AnnotationCollector(_in_field) { } | 129 FieldAnnotationCollector() : AnnotationCollector(_in_field) { } |
121 void apply_to(FieldInfo* f); | 130 void apply_to(FieldInfo* f); |
174 constantPoolHandle cp, bool is_interface, | 183 constantPoolHandle cp, bool is_interface, |
175 FieldAllocationCount *fac, | 184 FieldAllocationCount *fac, |
176 Array<AnnotationArray*>** fields_annotations, | 185 Array<AnnotationArray*>** fields_annotations, |
177 Array<AnnotationArray*>** fields_type_annotations, | 186 Array<AnnotationArray*>** fields_type_annotations, |
178 u2* java_fields_count_ptr, TRAPS); | 187 u2* java_fields_count_ptr, TRAPS); |
188 | |
189 void print_field_layout(Symbol* name, | |
190 Array<u2>* fields, | |
191 constantPoolHandle cp, | |
192 int instance_size, | |
193 int instance_fields_start, | |
194 int instance_fields_end, | |
195 int static_fields_end); | |
179 | 196 |
180 // Method parsing | 197 // Method parsing |
181 methodHandle parse_method(ClassLoaderData* loader_data, | 198 methodHandle parse_method(ClassLoaderData* loader_data, |
182 constantPoolHandle cp, | 199 constantPoolHandle cp, |
183 bool is_interface, | 200 bool is_interface, |
245 int runtime_visible_annotations_length, | 262 int runtime_visible_annotations_length, |
246 u1* runtime_invisible_annotations, | 263 u1* runtime_invisible_annotations, |
247 int runtime_invisible_annotations_length, TRAPS); | 264 int runtime_invisible_annotations_length, TRAPS); |
248 int skip_annotation(u1* buffer, int limit, int index); | 265 int skip_annotation(u1* buffer, int limit, int index); |
249 int skip_annotation_value(u1* buffer, int limit, int index); | 266 int skip_annotation_value(u1* buffer, int limit, int index); |
250 void parse_annotations(u1* buffer, int limit, constantPoolHandle cp, | 267 void parse_annotations(ClassLoaderData* loader_data, |
268 u1* buffer, int limit, constantPoolHandle cp, | |
251 /* Results (currently, only one result is supported): */ | 269 /* Results (currently, only one result is supported): */ |
252 AnnotationCollector* result, | 270 AnnotationCollector* result, |
253 TRAPS); | 271 TRAPS); |
254 | 272 |
255 // Final setup | 273 // Final setup |