comparison src/share/vm/classfile/classFileParser.hpp @ 12190:edb5ab0f3fe5

8001107: @Stable annotation for constant folding of lazily evaluated variables Reviewed-by: rbackman, twisti, kvn Contributed-by: john.r.rose@oracle.com, vladimir.x.ivanov@oracle.com
author vlivanov
date Tue, 10 Sep 2013 14:51:48 -0700
parents e22ee8e7ae62
children f0d759a6a230 78bbf4d43a14
comparison
equal deleted inserted replaced
12188:cd16d587b0fa 12190:edb5ab0f3fe5
123 _method_ForceInline, 123 _method_ForceInline,
124 _method_DontInline, 124 _method_DontInline,
125 _method_LambdaForm_Compiled, 125 _method_LambdaForm_Compiled,
126 _method_LambdaForm_Hidden, 126 _method_LambdaForm_Hidden,
127 _sun_misc_Contended, 127 _sun_misc_Contended,
128 _field_Stable,
128 _annotation_LIMIT 129 _annotation_LIMIT
129 }; 130 };
130 const Location _location; 131 const Location _location;
131 int _annotations_present; 132 int _annotations_present;
132 u2 _contended_group; 133 u2 _contended_group;
141 // Set the annotation name: 142 // Set the annotation name:
142 void set_annotation(ID id) { 143 void set_annotation(ID id) {
143 assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob"); 144 assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob");
144 _annotations_present |= nth_bit((int)id); 145 _annotations_present |= nth_bit((int)id);
145 } 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
146 // Report if the annotation is present. 153 // Report if the annotation is present.
147 bool has_any_annotations() { return _annotations_present != 0; } 154 bool has_any_annotations() const { return _annotations_present != 0; }
148 bool has_annotation(ID id) { return (nth_bit((int)id) & _annotations_present) != 0; } 155 bool has_annotation(ID id) const { return (nth_bit((int)id) & _annotations_present) != 0; }
149 156
150 void set_contended_group(u2 group) { _contended_group = group; } 157 void set_contended_group(u2 group) { _contended_group = group; }
151 u2 contended_group() { return _contended_group; } 158 u2 contended_group() const { return _contended_group; }
152 159
153 bool is_contended() { return has_annotation(_sun_misc_Contended); } 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); }
154 }; 164 };
155 165
156 // This class also doubles as a holder for metadata cleanup. 166 // This class also doubles as a holder for metadata cleanup.
157 class FieldAnnotationCollector: public AnnotationCollector { 167 class FieldAnnotationCollector: public AnnotationCollector {
158 ClassLoaderData* _loader_data; 168 ClassLoaderData* _loader_data;