56 unsigned int _max_nonstatic_oop_maps;
57
58 OopMapBlocksBuilder(unsigned int max_blocks);
59 OopMapBlock* last_oop_map() const;
60 void initialize_inherited_blocks(OopMapBlock* blocks, unsigned int nof_blocks);
61 void add(int offset, int count);
62 void copy(OopMapBlock* dst);
63 void compact();
64 void print_on(outputStream* st) const;
65 void print_value_on(outputStream* st) const;
66 };
67
68 // Values needed for oopmap and InstanceKlass creation
69 class FieldLayoutInfo : public ResourceObj {
70 public:
71 OopMapBlocksBuilder* oop_map_blocks;
72 int _instance_size;
73 int _nonstatic_field_size;
74 int _static_field_size;
75 bool _has_nonstatic_fields;
76 };
77
78 // Parser for for .class files
79 //
80 // The bytes describing the class file structure is read from a Stream object
81
82 class ClassFileParser {
83 friend class FieldLayoutBuilder;
84 friend class FieldLayout;
85
86 class ClassAnnotationCollector;
87 class FieldAllocationCount;
88 class FieldAnnotationCollector;
89
90 public:
91 // The ClassFileParser has an associated "publicity" level
92 // It is used to control which subsystems (if any)
93 // will observe the parsing (logging, events, tracing).
94 // Default level is "BROADCAST", which is equivalent to
95 // a "public" parsing attempt.
182 u2 _sourcefile_index;
183 u2 _generic_signature_index;
184
185 u2 _major_version;
186 u2 _minor_version;
187 u2 _this_class_index;
188 u2 _super_class_index;
189 u2 _itfs_len;
190 u2 _java_fields_count;
191
192 bool _need_verify;
193 bool _relax_verify;
194
195 bool _has_nonstatic_concrete_methods;
196 bool _declares_nonstatic_concrete_methods;
197 bool _has_final_method;
198 bool _has_contended_fields;
199
200 bool _has_flattenable_fields;
201 bool _is_empty_value;
202
203 // precomputed flags
204 bool _has_finalizer;
205 bool _has_empty_finalizer;
206 bool _has_vanilla_constructor;
207 int _max_bootstrap_specifier_index; // detects BSS values
208
209 void parse_stream(const ClassFileStream* const stream, TRAPS);
210
211 void post_process_parsed_stream(const ClassFileStream* const stream,
212 ConstantPool* cp,
213 TRAPS);
214
215 void prepend_host_package_name(const InstanceKlass* unsafe_anonymous_host, TRAPS);
216 void fix_unsafe_anonymous_class_name(TRAPS);
217
218 void fill_instance_klass(InstanceKlass* ik, bool cf_changed_in_CFLH, TRAPS);
219 void set_klass(InstanceKlass* instance);
220
221 void set_class_bad_constant_seen(short bad_constant);
229 void apply_parsed_class_attributes(InstanceKlass* k); // update k
230 void apply_parsed_class_metadata(InstanceKlass* k, int fields_count, TRAPS);
231 void clear_class_metadata();
232
233 // Constant pool parsing
234 void parse_constant_pool_entries(const ClassFileStream* const stream,
235 ConstantPool* cp,
236 const int length,
237 TRAPS);
238
239 void parse_constant_pool(const ClassFileStream* const cfs,
240 ConstantPool* const cp,
241 const int length,
242 TRAPS);
243
244 // Interface parsing
245 void parse_interfaces(const ClassFileStream* const stream,
246 const int itfs_len,
247 ConstantPool* const cp,
248 bool* has_nonstatic_concrete_methods,
249 TRAPS);
250
251 const InstanceKlass* parse_super_class(ConstantPool* const cp,
252 const int super_class_index,
253 const bool need_verify,
254 TRAPS);
255
256 // Field parsing
257 void parse_field_attributes(const ClassFileStream* const cfs,
258 u2 attributes_count,
259 bool is_static,
260 u2 signature_index,
261 u2* const constantvalue_index_addr,
262 bool* const is_synthetic_addr,
263 u2* const generic_signature_index_addr,
264 FieldAnnotationCollector* parsed_annotations,
265 TRAPS);
266
267 void parse_fields(const ClassFileStream* const cfs,
268 bool is_interface,
|
56 unsigned int _max_nonstatic_oop_maps;
57
58 OopMapBlocksBuilder(unsigned int max_blocks);
59 OopMapBlock* last_oop_map() const;
60 void initialize_inherited_blocks(OopMapBlock* blocks, unsigned int nof_blocks);
61 void add(int offset, int count);
62 void copy(OopMapBlock* dst);
63 void compact();
64 void print_on(outputStream* st) const;
65 void print_value_on(outputStream* st) const;
66 };
67
68 // Values needed for oopmap and InstanceKlass creation
69 class FieldLayoutInfo : public ResourceObj {
70 public:
71 OopMapBlocksBuilder* oop_map_blocks;
72 int _instance_size;
73 int _nonstatic_field_size;
74 int _static_field_size;
75 bool _has_nonstatic_fields;
76 bool _is_naturally_atomic;
77 };
78
79 // Parser for for .class files
80 //
81 // The bytes describing the class file structure is read from a Stream object
82
83 class ClassFileParser {
84 friend class FieldLayoutBuilder;
85 friend class FieldLayout;
86
87 class ClassAnnotationCollector;
88 class FieldAllocationCount;
89 class FieldAnnotationCollector;
90
91 public:
92 // The ClassFileParser has an associated "publicity" level
93 // It is used to control which subsystems (if any)
94 // will observe the parsing (logging, events, tracing).
95 // Default level is "BROADCAST", which is equivalent to
96 // a "public" parsing attempt.
183 u2 _sourcefile_index;
184 u2 _generic_signature_index;
185
186 u2 _major_version;
187 u2 _minor_version;
188 u2 _this_class_index;
189 u2 _super_class_index;
190 u2 _itfs_len;
191 u2 _java_fields_count;
192
193 bool _need_verify;
194 bool _relax_verify;
195
196 bool _has_nonstatic_concrete_methods;
197 bool _declares_nonstatic_concrete_methods;
198 bool _has_final_method;
199 bool _has_contended_fields;
200
201 bool _has_flattenable_fields;
202 bool _is_empty_value;
203 bool _is_naturally_atomic;
204 bool _is_declared_atomic;
205
206 // precomputed flags
207 bool _has_finalizer;
208 bool _has_empty_finalizer;
209 bool _has_vanilla_constructor;
210 int _max_bootstrap_specifier_index; // detects BSS values
211
212 void parse_stream(const ClassFileStream* const stream, TRAPS);
213
214 void post_process_parsed_stream(const ClassFileStream* const stream,
215 ConstantPool* cp,
216 TRAPS);
217
218 void prepend_host_package_name(const InstanceKlass* unsafe_anonymous_host, TRAPS);
219 void fix_unsafe_anonymous_class_name(TRAPS);
220
221 void fill_instance_klass(InstanceKlass* ik, bool cf_changed_in_CFLH, TRAPS);
222 void set_klass(InstanceKlass* instance);
223
224 void set_class_bad_constant_seen(short bad_constant);
232 void apply_parsed_class_attributes(InstanceKlass* k); // update k
233 void apply_parsed_class_metadata(InstanceKlass* k, int fields_count, TRAPS);
234 void clear_class_metadata();
235
236 // Constant pool parsing
237 void parse_constant_pool_entries(const ClassFileStream* const stream,
238 ConstantPool* cp,
239 const int length,
240 TRAPS);
241
242 void parse_constant_pool(const ClassFileStream* const cfs,
243 ConstantPool* const cp,
244 const int length,
245 TRAPS);
246
247 // Interface parsing
248 void parse_interfaces(const ClassFileStream* const stream,
249 const int itfs_len,
250 ConstantPool* const cp,
251 bool* has_nonstatic_concrete_methods,
252 bool* is_declared_atomic,
253 TRAPS);
254
255 const InstanceKlass* parse_super_class(ConstantPool* const cp,
256 const int super_class_index,
257 const bool need_verify,
258 TRAPS);
259
260 // Field parsing
261 void parse_field_attributes(const ClassFileStream* const cfs,
262 u2 attributes_count,
263 bool is_static,
264 u2 signature_index,
265 u2* const constantvalue_index_addr,
266 bool* const is_synthetic_addr,
267 u2* const generic_signature_index_addr,
268 FieldAnnotationCollector* parsed_annotations,
269 TRAPS);
270
271 void parse_fields(const ClassFileStream* const cfs,
272 bool is_interface,
|