57 unsigned int _nonstatic_oop_map_count;
58 unsigned int _max_nonstatic_oop_maps;
59
60 OopMapBlocksBuilder(unsigned int max_blocks);
61 OopMapBlock* last_oop_map() const;
62 void initialize_inherited_blocks(OopMapBlock* blocks, unsigned int nof_blocks);
63 void add(int offset, int count);
64 void copy(OopMapBlock* dst);
65 void compact();
66 void print_on(outputStream* st) const;
67 void print_value_on(outputStream* st) const;
68 };
69
70 // Values needed for oopmap and InstanceKlass creation
71 class FieldLayoutInfo : public ResourceObj {
72 public:
73 OopMapBlocksBuilder* oop_map_blocks;
74 int _instance_size;
75 int _nonstatic_field_size;
76 int _static_field_size;
77 bool _has_nonstatic_fields;
78 };
79
80 // Parser for for .class files
81 //
82 // The bytes describing the class file structure is read from a Stream object
83
84 class ClassFileParser {
85 friend class FieldLayoutBuilder;
86 friend class FieldLayout;
87
88 class ClassAnnotationCollector;
89 class FieldAllocationCount;
90 class FieldAnnotationCollector;
91
92 public:
93 // The ClassFileParser has an associated "publicity" level
94 // It is used to control which subsystems (if any)
95 // will observe the parsing (logging, events, tracing).
96 // Default level is "BROADCAST", which is equivalent to
97 // a "public" parsing attempt.
112
113 const ClassFileStream* _stream; // Actual input stream
114 Symbol* _class_name;
115 mutable ClassLoaderData* _loader_data;
116 const bool _is_hidden;
117 const bool _can_access_vm_annotations;
118 int _orig_cp_size;
119
120 // Metadata created before the instance klass is created. Must be deallocated
121 // if not transferred to the InstanceKlass upon successful class loading
122 // in which case these pointers have been set to null.
123 const InstanceKlass* _super_klass;
124 ConstantPool* _cp;
125 Array<u1>* _fieldinfo_stream;
126 Array<FieldStatus>* _fields_status;
127 Array<Method*>* _methods;
128 Array<u2>* _inner_classes;
129 Array<u2>* _nest_members;
130 u2 _nest_host;
131 Array<u2>* _permitted_subclasses;
132 Array<RecordComponent*>* _record_components;
133 Array<InstanceKlass*>* _local_interfaces;
134 Array<InstanceKlass*>* _transitive_interfaces;
135 Annotations* _combined_annotations;
136 AnnotationArray* _class_annotations;
137 AnnotationArray* _class_type_annotations;
138 Array<AnnotationArray*>* _fields_annotations;
139 Array<AnnotationArray*>* _fields_type_annotations;
140 InstanceKlass* _klass; // InstanceKlass* once created.
141 InstanceKlass* _klass_to_deallocate; // an InstanceKlass* to be destroyed
142
143 ClassAnnotationCollector* _parsed_annotations;
144 FieldAllocationCount* _fac;
145 FieldLayoutInfo* _field_info;
146 GrowableArray<FieldInfo>* _temp_field_info;
147 const intArray* _method_ordering;
148 GrowableArray<Method*>* _all_mirandas;
149
150 enum { fixed_buffer_size = 128 };
151 u_char _linenumbertable_buffer[fixed_buffer_size];
152
153 // Size of Java vtable (in words)
154 int _vtable_size;
155 int _itable_size;
156
157 int _num_miranda_methods;
158
159 Handle _protection_domain;
160 AccessFlags _access_flags;
161
162 // for tracing and notifications
163 Publicity _pub_level;
164
165 // Used to keep track of whether a constant pool item 19 or 20 is found. These
166 // correspond to CONSTANT_Module and CONSTANT_Package tags and are not allowed
167 // in regular class files. For class file version >= 53, a CFE cannot be thrown
168 // immediately when these are seen because a NCDFE must be thrown if the class's
169 // access_flags have ACC_MODULE set. But, the access_flags haven't been looked
170 // at yet. So, the bad constant pool item is cached here. A value of zero
171 // means that no constant pool item 19 or 20 was found.
172 short _bad_constant_seen;
173
174 // class attributes parsed before the instance klass is created:
175 bool _synthetic_flag;
176 int _sde_length;
177 const char* _sde_buffer;
178 u2 _sourcefile_index;
179 u2 _generic_signature_index;
180
181 u2 _major_version;
182 u2 _minor_version;
183 u2 _this_class_index;
184 u2 _super_class_index;
185 u2 _itfs_len;
186 u2 _java_fields_count;
187
188 bool _need_verify;
189 bool _relax_verify;
190
191 bool _has_nonstatic_concrete_methods;
192 bool _declares_nonstatic_concrete_methods;
193 bool _has_localvariable_table;
194 bool _has_final_method;
195 bool _has_contended_fields;
196
197 // precomputed flags
198 bool _has_finalizer;
199 bool _has_empty_finalizer;
200 int _max_bootstrap_specifier_index; // detects BSS values
201
202 void parse_stream(const ClassFileStream* const stream, TRAPS);
203
204 void mangle_hidden_class_name(InstanceKlass* const ik);
205
206 void post_process_parsed_stream(const ClassFileStream* const stream,
207 ConstantPool* cp,
208 TRAPS);
209
210 void fill_instance_klass(InstanceKlass* ik, bool cf_changed_in_CFLH,
211 const ClassInstanceInfo& cl_inst_info, TRAPS);
212
213 void set_klass(InstanceKlass* instance);
214
215 void set_class_bad_constant_seen(short bad_constant);
216 short class_bad_constant_seen() { return _bad_constant_seen; }
242 bool* has_nonstatic_concrete_methods,
243 TRAPS);
244
245 const InstanceKlass* parse_super_class(ConstantPool* const cp,
246 const int super_class_index,
247 const bool need_verify,
248 TRAPS);
249
250 // Field parsing
251 void parse_field_attributes(const ClassFileStream* const cfs,
252 u2 attributes_count,
253 bool is_static,
254 u2 signature_index,
255 u2* const constantvalue_index_addr,
256 bool* const is_synthetic_addr,
257 u2* const generic_signature_index_addr,
258 FieldAnnotationCollector* parsed_annotations,
259 TRAPS);
260
261 void parse_fields(const ClassFileStream* const cfs,
262 bool is_interface,
263 FieldAllocationCount* const fac,
264 ConstantPool* cp,
265 const int cp_size,
266 u2* const java_fields_count_ptr,
267 TRAPS);
268
269 // Method parsing
270 Method* parse_method(const ClassFileStream* const cfs,
271 bool is_interface,
272 const ConstantPool* cp,
273 bool* const has_localvariable_table,
274 TRAPS);
275
276 void parse_methods(const ClassFileStream* const cfs,
277 bool is_interface,
278 bool* const has_localvariable_table,
279 bool* const has_final_method,
280 bool* const declares_nonstatic_concrete_methods,
281 TRAPS);
282
283 const unsafe_u2* parse_exception_table(const ClassFileStream* const stream,
284 u4 code_length,
285 u4 exception_table_length,
286 TRAPS);
287
288 void parse_linenumber_table(u4 code_attribute_length,
289 u4 code_length,
290 CompressedLineNumberWriteStream**const write_stream,
291 TRAPS);
292
293 const unsafe_u2* parse_localvariable_table(const ClassFileStream* const cfs,
294 u4 code_length,
295 u2 max_locals,
296 u4 code_attribute_length,
297 u2* const localvariable_table_length,
312
313 // Check for circularity in InnerClasses attribute.
314 bool check_inner_classes_circularity(const ConstantPool* cp, int length, TRAPS);
315
316 u2 parse_classfile_inner_classes_attribute(const ClassFileStream* const cfs,
317 const ConstantPool* cp,
318 const u1* const inner_classes_attribute_start,
319 bool parsed_enclosingmethod_attribute,
320 u2 enclosing_method_class_index,
321 u2 enclosing_method_method_index,
322 TRAPS);
323
324 u2 parse_classfile_nest_members_attribute(const ClassFileStream* const cfs,
325 const u1* const nest_members_attribute_start,
326 TRAPS);
327
328 u2 parse_classfile_permitted_subclasses_attribute(const ClassFileStream* const cfs,
329 const u1* const permitted_subclasses_attribute_start,
330 TRAPS);
331
332 u4 parse_classfile_record_attribute(const ClassFileStream* const cfs,
333 const ConstantPool* cp,
334 const u1* const record_attribute_start,
335 TRAPS);
336
337 void parse_classfile_attributes(const ClassFileStream* const cfs,
338 ConstantPool* cp,
339 ClassAnnotationCollector* parsed_annotations,
340 TRAPS);
341
342 void parse_classfile_synthetic_attribute();
343 void parse_classfile_signature_attribute(const ClassFileStream* const cfs, TRAPS);
344 void parse_classfile_bootstrap_methods_attribute(const ClassFileStream* const cfs,
345 ConstantPool* cp,
346 u4 attribute_length,
347 TRAPS);
348
349 // Annotations handling
350 AnnotationArray* allocate_annotations(const u1* const anno,
351 int anno_length,
438 const char *name,
439 TRAPS) const {
440 if (!b) { classfile_parse_error(msg, index, name, THREAD); return; }
441 }
442
443 void throwIllegalSignature(const char* type,
444 const Symbol* name,
445 const Symbol* sig,
446 TRAPS) const;
447
448 void verify_constantvalue(const ConstantPool* const cp,
449 int constantvalue_index,
450 int signature_index,
451 TRAPS) const;
452
453 void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS) const;
454 void verify_legal_class_name(const Symbol* name, TRAPS) const;
455 void verify_legal_field_name(const Symbol* name, TRAPS) const;
456 void verify_legal_method_name(const Symbol* name, TRAPS) const;
457
458 void verify_legal_field_signature(const Symbol* fieldname,
459 const Symbol* signature,
460 TRAPS) const;
461 int verify_legal_method_signature(const Symbol* methodname,
462 const Symbol* signature,
463 TRAPS) const;
464 void verify_legal_name_with_signature(const Symbol* name,
465 const Symbol* signature,
466 TRAPS) const;
467
468 void verify_class_version(u2 major, u2 minor, Symbol* class_name, TRAPS);
469
470 void verify_legal_class_modifiers(jint flags, TRAPS) const;
471 void verify_legal_field_modifiers(jint flags, bool is_interface, TRAPS) const;
472 void verify_legal_method_modifiers(jint flags,
473 bool is_interface,
474 const Symbol* name,
475 TRAPS) const;
476
477 void check_super_class_access(const InstanceKlass* this_klass,
478 TRAPS);
479
480 void check_super_interface_access(const InstanceKlass* this_klass,
481 TRAPS);
482
483 const char* skip_over_field_signature(const char* signature,
484 bool void_ok,
485 unsigned int length,
486 TRAPS) const;
487
488 // Wrapper for constantTag.is_klass_[or_]reference.
489 // In older versions of the VM, Klass*s cannot sneak into early phases of
490 // constant pool construction, but in later versions they can.
491 // %%% Let's phase out the old is_klass_reference.
492 bool valid_klass_reference_at(int index) const {
493 return _cp->is_within_bounds(index) &&
505 u2* const localvariable_table_length,
506 const unsafe_u2** const localvariable_table_start,
507 int lvtt_cnt,
508 u2* const localvariable_type_table_length,
509 const unsafe_u2** const localvariable_type_table_start,
510 TRAPS);
511
512 void copy_method_annotations(ConstMethod* cm,
513 const u1* runtime_visible_annotations,
514 int runtime_visible_annotations_length,
515 const u1* runtime_visible_parameter_annotations,
516 int runtime_visible_parameter_annotations_length,
517 const u1* runtime_visible_type_annotations,
518 int runtime_visible_type_annotations_length,
519 const u1* annotation_default,
520 int annotation_default_length,
521 TRAPS);
522
523 void update_class_name(Symbol* new_name);
524
525 public:
526 ClassFileParser(ClassFileStream* stream,
527 Symbol* name,
528 ClassLoaderData* loader_data,
529 const ClassLoadInfo* cl_info,
530 Publicity pub_level,
531 TRAPS);
532
533 ~ClassFileParser();
534
535 InstanceKlass* create_instance_klass(bool cf_changed_in_CFLH, const ClassInstanceInfo& cl_inst_info, TRAPS);
536
537 const ClassFileStream* clone_stream() const;
538
539 void set_klass_to_deallocate(InstanceKlass* klass);
540
541 int static_field_size() const;
542 int total_oop_map_count() const;
543 jint layout_size() const;
544
545 int vtable_size() const { return _vtable_size; }
546 int itable_size() const { return _itable_size; }
547
548 u2 this_class_index() const { return _this_class_index; }
549
550 bool is_hidden() const { return _is_hidden; }
551 bool is_interface() const { return _access_flags.is_interface(); }
552
553 ClassLoaderData* loader_data() const { return _loader_data; }
554 const Symbol* class_name() const { return _class_name; }
555 const InstanceKlass* super_klass() const { return _super_klass; }
556
557 ReferenceType super_reference_type() const;
558 bool is_instance_ref_klass() const;
559 bool is_java_lang_ref_Reference_subclass() const;
560
561 AccessFlags access_flags() const { return _access_flags; }
562
563 bool is_internal() const { return INTERNAL == _pub_level; }
564
565 static bool verify_unqualified_name(const char* name, unsigned int length, int type);
566
567 #ifdef ASSERT
568 static bool is_internal_format(Symbol* class_name);
569 #endif
570
571 };
572
573 #endif // SHARE_CLASSFILE_CLASSFILEPARSER_HPP
|
57 unsigned int _nonstatic_oop_map_count;
58 unsigned int _max_nonstatic_oop_maps;
59
60 OopMapBlocksBuilder(unsigned int max_blocks);
61 OopMapBlock* last_oop_map() const;
62 void initialize_inherited_blocks(OopMapBlock* blocks, unsigned int nof_blocks);
63 void add(int offset, int count);
64 void copy(OopMapBlock* dst);
65 void compact();
66 void print_on(outputStream* st) const;
67 void print_value_on(outputStream* st) const;
68 };
69
70 // Values needed for oopmap and InstanceKlass creation
71 class FieldLayoutInfo : public ResourceObj {
72 public:
73 OopMapBlocksBuilder* oop_map_blocks;
74 int _instance_size;
75 int _nonstatic_field_size;
76 int _static_field_size;
77 bool _has_nonstatic_fields;
78 bool _is_naturally_atomic;
79 bool _has_inline_fields;
80 bool _has_null_marker_offsets;
81 };
82
83 // Parser for for .class files
84 //
85 // The bytes describing the class file structure is read from a Stream object
86
87 class ClassFileParser {
88 friend class FieldLayoutBuilder;
89 friend class FieldLayout;
90
91 class ClassAnnotationCollector;
92 class FieldAllocationCount;
93 class FieldAnnotationCollector;
94
95 public:
96 // The ClassFileParser has an associated "publicity" level
97 // It is used to control which subsystems (if any)
98 // will observe the parsing (logging, events, tracing).
99 // Default level is "BROADCAST", which is equivalent to
100 // a "public" parsing attempt.
115
116 const ClassFileStream* _stream; // Actual input stream
117 Symbol* _class_name;
118 mutable ClassLoaderData* _loader_data;
119 const bool _is_hidden;
120 const bool _can_access_vm_annotations;
121 int _orig_cp_size;
122
123 // Metadata created before the instance klass is created. Must be deallocated
124 // if not transferred to the InstanceKlass upon successful class loading
125 // in which case these pointers have been set to null.
126 const InstanceKlass* _super_klass;
127 ConstantPool* _cp;
128 Array<u1>* _fieldinfo_stream;
129 Array<FieldStatus>* _fields_status;
130 Array<Method*>* _methods;
131 Array<u2>* _inner_classes;
132 Array<u2>* _nest_members;
133 u2 _nest_host;
134 Array<u2>* _permitted_subclasses;
135 Array<u2>* _loadable_descriptors;
136 Array<RecordComponent*>* _record_components;
137 Array<InstanceKlass*>* _local_interfaces;
138 GrowableArray<u2>* _local_interface_indexes;
139 Array<InstanceKlass*>* _transitive_interfaces;
140 Annotations* _combined_annotations;
141 AnnotationArray* _class_annotations;
142 AnnotationArray* _class_type_annotations;
143 Array<AnnotationArray*>* _fields_annotations;
144 Array<AnnotationArray*>* _fields_type_annotations;
145 InstanceKlass* _klass; // InstanceKlass* once created.
146 InstanceKlass* _klass_to_deallocate; // an InstanceKlass* to be destroyed
147
148 ClassAnnotationCollector* _parsed_annotations;
149 FieldAllocationCount* _fac;
150 FieldLayoutInfo* _field_info;
151 Array<InlineKlass*>* _inline_type_field_klasses;
152 Array<int>* _null_marker_offsets;
153 GrowableArray<FieldInfo>* _temp_field_info;
154 const intArray* _method_ordering;
155 GrowableArray<Method*>* _all_mirandas;
156
157 enum { fixed_buffer_size = 128 };
158 u_char _linenumbertable_buffer[fixed_buffer_size];
159
160 // Size of Java vtable (in words)
161 int _vtable_size;
162 int _itable_size;
163
164 int _num_miranda_methods;
165
166 int _alignment;
167 int _first_field_offset;
168 int _payload_size_in_bytes;
169 int _internal_null_marker_offset;
170
171 Handle _protection_domain;
172 AccessFlags _access_flags;
173
174 // for tracing and notifications
175 Publicity _pub_level;
176
177 // Used to keep track of whether a constant pool item 19 or 20 is found. These
178 // correspond to CONSTANT_Module and CONSTANT_Package tags and are not allowed
179 // in regular class files. For class file version >= 53, a CFE cannot be thrown
180 // immediately when these are seen because a NCDFE must be thrown if the class's
181 // access_flags have ACC_MODULE set. But, the access_flags haven't been looked
182 // at yet. So, the bad constant pool item is cached here. A value of zero
183 // means that no constant pool item 19 or 20 was found.
184 short _bad_constant_seen;
185
186 // class attributes parsed before the instance klass is created:
187 bool _synthetic_flag;
188 int _sde_length;
189 const char* _sde_buffer;
190 u2 _sourcefile_index;
191 u2 _generic_signature_index;
192
193 u2 _major_version;
194 u2 _minor_version;
195 u2 _this_class_index;
196 u2 _super_class_index;
197 u2 _itfs_len;
198 u2 _java_fields_count;
199
200 bool _need_verify;
201 bool _relax_verify;
202
203 bool _has_nonstatic_concrete_methods;
204 bool _declares_nonstatic_concrete_methods;
205 bool _has_localvariable_table;
206 bool _has_final_method;
207 bool _has_contended_fields;
208
209 bool _has_inline_type_fields;
210 bool _has_null_marker_offsets;
211 bool _has_nonstatic_fields;
212 bool _is_empty_inline_type;
213 bool _is_naturally_atomic;
214 bool _must_be_atomic;
215 bool _is_implicitly_constructible;
216 bool _has_loosely_consistent_annotation;
217 bool _has_implicitly_constructible_annotation;
218
219 // precomputed flags
220 bool _has_finalizer;
221 bool _has_empty_finalizer;
222 int _max_bootstrap_specifier_index; // detects BSS values
223
224 void parse_stream(const ClassFileStream* const stream, TRAPS);
225
226 void mangle_hidden_class_name(InstanceKlass* const ik);
227
228 void post_process_parsed_stream(const ClassFileStream* const stream,
229 ConstantPool* cp,
230 TRAPS);
231
232 void fill_instance_klass(InstanceKlass* ik, bool cf_changed_in_CFLH,
233 const ClassInstanceInfo& cl_inst_info, TRAPS);
234
235 void set_klass(InstanceKlass* instance);
236
237 void set_class_bad_constant_seen(short bad_constant);
238 short class_bad_constant_seen() { return _bad_constant_seen; }
264 bool* has_nonstatic_concrete_methods,
265 TRAPS);
266
267 const InstanceKlass* parse_super_class(ConstantPool* const cp,
268 const int super_class_index,
269 const bool need_verify,
270 TRAPS);
271
272 // Field parsing
273 void parse_field_attributes(const ClassFileStream* const cfs,
274 u2 attributes_count,
275 bool is_static,
276 u2 signature_index,
277 u2* const constantvalue_index_addr,
278 bool* const is_synthetic_addr,
279 u2* const generic_signature_index_addr,
280 FieldAnnotationCollector* parsed_annotations,
281 TRAPS);
282
283 void parse_fields(const ClassFileStream* const cfs,
284 AccessFlags class_access_flags,
285 FieldAllocationCount* const fac,
286 ConstantPool* cp,
287 const int cp_size,
288 u2* const java_fields_count_ptr,
289 TRAPS);
290
291 // Method parsing
292 Method* parse_method(const ClassFileStream* const cfs,
293 bool is_interface,
294 bool is_value_class,
295 bool is_abstract_class,
296 const ConstantPool* cp,
297 bool* const has_localvariable_table,
298 TRAPS);
299
300 void parse_methods(const ClassFileStream* const cfs,
301 bool is_interface,
302 bool is_value_class,
303 bool is_abstract_class,
304 bool* const has_localvariable_table,
305 bool* const has_final_method,
306 bool* const declares_nonstatic_concrete_methods,
307 TRAPS);
308
309 const unsafe_u2* parse_exception_table(const ClassFileStream* const stream,
310 u4 code_length,
311 u4 exception_table_length,
312 TRAPS);
313
314 void parse_linenumber_table(u4 code_attribute_length,
315 u4 code_length,
316 CompressedLineNumberWriteStream**const write_stream,
317 TRAPS);
318
319 const unsafe_u2* parse_localvariable_table(const ClassFileStream* const cfs,
320 u4 code_length,
321 u2 max_locals,
322 u4 code_attribute_length,
323 u2* const localvariable_table_length,
338
339 // Check for circularity in InnerClasses attribute.
340 bool check_inner_classes_circularity(const ConstantPool* cp, int length, TRAPS);
341
342 u2 parse_classfile_inner_classes_attribute(const ClassFileStream* const cfs,
343 const ConstantPool* cp,
344 const u1* const inner_classes_attribute_start,
345 bool parsed_enclosingmethod_attribute,
346 u2 enclosing_method_class_index,
347 u2 enclosing_method_method_index,
348 TRAPS);
349
350 u2 parse_classfile_nest_members_attribute(const ClassFileStream* const cfs,
351 const u1* const nest_members_attribute_start,
352 TRAPS);
353
354 u2 parse_classfile_permitted_subclasses_attribute(const ClassFileStream* const cfs,
355 const u1* const permitted_subclasses_attribute_start,
356 TRAPS);
357
358 u2 parse_classfile_loadable_descriptors_attribute(const ClassFileStream* const cfs,
359 const u1* const loadable_descriptors_attribute_start,
360 TRAPS);
361
362 u4 parse_classfile_record_attribute(const ClassFileStream* const cfs,
363 const ConstantPool* cp,
364 const u1* const record_attribute_start,
365 TRAPS);
366
367 void parse_classfile_attributes(const ClassFileStream* const cfs,
368 ConstantPool* cp,
369 ClassAnnotationCollector* parsed_annotations,
370 TRAPS);
371
372 void parse_classfile_synthetic_attribute();
373 void parse_classfile_signature_attribute(const ClassFileStream* const cfs, TRAPS);
374 void parse_classfile_bootstrap_methods_attribute(const ClassFileStream* const cfs,
375 ConstantPool* cp,
376 u4 attribute_length,
377 TRAPS);
378
379 // Annotations handling
380 AnnotationArray* allocate_annotations(const u1* const anno,
381 int anno_length,
468 const char *name,
469 TRAPS) const {
470 if (!b) { classfile_parse_error(msg, index, name, THREAD); return; }
471 }
472
473 void throwIllegalSignature(const char* type,
474 const Symbol* name,
475 const Symbol* sig,
476 TRAPS) const;
477
478 void verify_constantvalue(const ConstantPool* const cp,
479 int constantvalue_index,
480 int signature_index,
481 TRAPS) const;
482
483 void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS) const;
484 void verify_legal_class_name(const Symbol* name, TRAPS) const;
485 void verify_legal_field_name(const Symbol* name, TRAPS) const;
486 void verify_legal_method_name(const Symbol* name, TRAPS) const;
487
488 bool legal_field_signature(const Symbol* signature, TRAPS) const;
489
490 void verify_legal_field_signature(const Symbol* fieldname,
491 const Symbol* signature,
492 TRAPS) const;
493 int verify_legal_method_signature(const Symbol* methodname,
494 const Symbol* signature,
495 TRAPS) const;
496 void verify_legal_name_with_signature(const Symbol* name,
497 const Symbol* signature,
498 TRAPS) const;
499
500 void verify_class_version(u2 major, u2 minor, Symbol* class_name, TRAPS);
501
502 void verify_legal_class_modifiers(jint flags, const char* name, bool is_Object, TRAPS) const;
503 void verify_legal_field_modifiers(jint flags,
504 AccessFlags class_access_flags,
505 TRAPS) const;
506 void verify_legal_method_modifiers(jint flags,
507 AccessFlags class_access_flags,
508 const Symbol* name,
509 TRAPS) const;
510
511 void check_super_class_access(const InstanceKlass* this_klass,
512 TRAPS);
513
514 void check_super_interface_access(const InstanceKlass* this_klass,
515 TRAPS);
516
517 const char* skip_over_field_signature(const char* signature,
518 bool void_ok,
519 unsigned int length,
520 TRAPS) const;
521
522 // Wrapper for constantTag.is_klass_[or_]reference.
523 // In older versions of the VM, Klass*s cannot sneak into early phases of
524 // constant pool construction, but in later versions they can.
525 // %%% Let's phase out the old is_klass_reference.
526 bool valid_klass_reference_at(int index) const {
527 return _cp->is_within_bounds(index) &&
539 u2* const localvariable_table_length,
540 const unsafe_u2** const localvariable_table_start,
541 int lvtt_cnt,
542 u2* const localvariable_type_table_length,
543 const unsafe_u2** const localvariable_type_table_start,
544 TRAPS);
545
546 void copy_method_annotations(ConstMethod* cm,
547 const u1* runtime_visible_annotations,
548 int runtime_visible_annotations_length,
549 const u1* runtime_visible_parameter_annotations,
550 int runtime_visible_parameter_annotations_length,
551 const u1* runtime_visible_type_annotations,
552 int runtime_visible_type_annotations_length,
553 const u1* annotation_default,
554 int annotation_default_length,
555 TRAPS);
556
557 void update_class_name(Symbol* new_name);
558
559 // Check if the class file supports inline types
560 bool supports_inline_types() const;
561
562 public:
563 ClassFileParser(ClassFileStream* stream,
564 Symbol* name,
565 ClassLoaderData* loader_data,
566 const ClassLoadInfo* cl_info,
567 Publicity pub_level,
568 TRAPS);
569
570 ~ClassFileParser();
571
572 InstanceKlass* create_instance_klass(bool cf_changed_in_CFLH, const ClassInstanceInfo& cl_inst_info, TRAPS);
573
574 const ClassFileStream* clone_stream() const;
575
576 void set_klass_to_deallocate(InstanceKlass* klass);
577
578 int static_field_size() const;
579 int total_oop_map_count() const;
580 jint layout_size() const;
581
582 int vtable_size() const { return _vtable_size; }
583 int itable_size() const { return _itable_size; }
584
585 u2 this_class_index() const { return _this_class_index; }
586
587 bool is_hidden() const { return _is_hidden; }
588 bool is_interface() const { return _access_flags.is_interface(); }
589 // Being an inline type means being a concrete value class
590 bool is_inline_type() const { return !_access_flags.is_identity_class() && !_access_flags.is_interface() && !_access_flags.is_abstract(); }
591 bool is_abstract_class() const { return _access_flags.is_abstract(); }
592 bool is_identity_class() const { return _access_flags.is_identity_class(); }
593 bool has_inline_fields() const { return _has_inline_type_fields; }
594
595 u2 java_fields_count() const { return _java_fields_count; }
596
597 ClassLoaderData* loader_data() const { return _loader_data; }
598 const Symbol* class_name() const { return _class_name; }
599 const InstanceKlass* super_klass() const { return _super_klass; }
600
601 ReferenceType super_reference_type() const;
602 bool is_instance_ref_klass() const;
603 bool is_java_lang_ref_Reference_subclass() const;
604
605 AccessFlags access_flags() const { return _access_flags; }
606
607 bool is_internal() const { return INTERNAL == _pub_level; }
608
609 bool is_class_in_loadable_descriptors_attribute(Symbol *klass);
610
611 static bool verify_unqualified_name(const char* name, unsigned int length, int type);
612
613 #ifdef ASSERT
614 static bool is_internal_format(Symbol* class_name);
615 #endif
616
617 };
618
619 #endif // SHARE_CLASSFILE_CLASSFILEPARSER_HPP
|