64 // a "public" parsing attempt.
65 //
66 // "INTERNAL" level should be entirely private to the
67 // caller - this allows for internal reuse of ClassFileParser
68 //
69 enum Publicity {
70 INTERNAL,
71 BROADCAST,
72 NOF_PUBLICITY_LEVELS
73 };
74
75 enum { LegalClass, LegalField, LegalMethod }; // used to verify unqualified names
76
77 private:
78 const ClassFileStream* _stream; // Actual input stream
79 const Symbol* _requested_name;
80 Symbol* _class_name;
81 mutable ClassLoaderData* _loader_data;
82 const InstanceKlass* _host_klass;
83 GrowableArray<Handle>* _cp_patches; // overrides for CP entries
84
85 // Metadata created before the instance klass is created. Must be deallocated
86 // if not transferred to the InstanceKlass upon successful class loading
87 // in which case these pointers have been set to NULL.
88 const InstanceKlass* _super_klass;
89 ConstantPool* _cp;
90 Array<u2>* _fields;
91 Array<Method*>* _methods;
92 Array<u2>* _inner_classes;
93 Array<Klass*>* _local_interfaces;
94 Array<Klass*>* _transitive_interfaces;
95 Annotations* _combined_annotations;
96 AnnotationArray* _annotations;
97 AnnotationArray* _type_annotations;
98 Array<AnnotationArray*>* _fields_annotations;
99 Array<AnnotationArray*>* _fields_type_annotations;
100 InstanceKlass* _klass; // InstanceKlass* once created.
101 InstanceKlass* _klass_to_deallocate; // an InstanceKlass* to be destroyed
102
103 ClassAnnotationCollector* _parsed_annotations;
417
418 bool has_cp_patch_at(int index) const {
419 assert(index >= 0, "oob");
420 return (_cp_patches != NULL
421 && index < _cp_patches->length()
422 && _cp_patches->adr_at(index)->not_null());
423 }
424
425 Handle cp_patch_at(int index) const {
426 assert(has_cp_patch_at(index), "oob");
427 return _cp_patches->at(index);
428 }
429
430 Handle clear_cp_patch_at(int index) {
431 Handle patch = cp_patch_at(index);
432 _cp_patches->at_put(index, Handle());
433 assert(!has_cp_patch_at(index), "");
434 return patch;
435 }
436
437 void patch_constant_pool(ConstantPool* cp,
438 int index,
439 Handle patch,
440 TRAPS);
441
442 // Wrapper for constantTag.is_klass_[or_]reference.
443 // In older versions of the VM, Klass*s cannot sneak into early phases of
444 // constant pool construction, but in later versions they can.
445 // %%% Let's phase out the old is_klass_reference.
446 bool valid_klass_reference_at(int index) const {
447 return _cp->is_within_bounds(index) &&
448 _cp->tag_at(index).is_klass_or_reference();
449 }
450
451 // Checks that the cpool index is in range and is a utf8
452 bool valid_symbol_at(int cpool_index) const {
453 return _cp->is_within_bounds(cpool_index) &&
454 _cp->tag_at(cpool_index).is_utf8();
455 }
456
|
64 // a "public" parsing attempt.
65 //
66 // "INTERNAL" level should be entirely private to the
67 // caller - this allows for internal reuse of ClassFileParser
68 //
69 enum Publicity {
70 INTERNAL,
71 BROADCAST,
72 NOF_PUBLICITY_LEVELS
73 };
74
75 enum { LegalClass, LegalField, LegalMethod }; // used to verify unqualified names
76
77 private:
78 const ClassFileStream* _stream; // Actual input stream
79 const Symbol* _requested_name;
80 Symbol* _class_name;
81 mutable ClassLoaderData* _loader_data;
82 const InstanceKlass* _host_klass;
83 GrowableArray<Handle>* _cp_patches; // overrides for CP entries
84 int _num_patched_klasses;
85 int _max_num_patched_klasses;
86 int _orig_cp_size;
87 int _first_patched_klass_resolved_index;
88
89 // Metadata created before the instance klass is created. Must be deallocated
90 // if not transferred to the InstanceKlass upon successful class loading
91 // in which case these pointers have been set to NULL.
92 const InstanceKlass* _super_klass;
93 ConstantPool* _cp;
94 Array<u2>* _fields;
95 Array<Method*>* _methods;
96 Array<u2>* _inner_classes;
97 Array<Klass*>* _local_interfaces;
98 Array<Klass*>* _transitive_interfaces;
99 Annotations* _combined_annotations;
100 AnnotationArray* _annotations;
101 AnnotationArray* _type_annotations;
102 Array<AnnotationArray*>* _fields_annotations;
103 Array<AnnotationArray*>* _fields_type_annotations;
104 InstanceKlass* _klass; // InstanceKlass* once created.
105 InstanceKlass* _klass_to_deallocate; // an InstanceKlass* to be destroyed
106
107 ClassAnnotationCollector* _parsed_annotations;
421
422 bool has_cp_patch_at(int index) const {
423 assert(index >= 0, "oob");
424 return (_cp_patches != NULL
425 && index < _cp_patches->length()
426 && _cp_patches->adr_at(index)->not_null());
427 }
428
429 Handle cp_patch_at(int index) const {
430 assert(has_cp_patch_at(index), "oob");
431 return _cp_patches->at(index);
432 }
433
434 Handle clear_cp_patch_at(int index) {
435 Handle patch = cp_patch_at(index);
436 _cp_patches->at_put(index, Handle());
437 assert(!has_cp_patch_at(index), "");
438 return patch;
439 }
440
441 void patch_class(ConstantPool* cp, int class_index, Klass* k, Symbol* name);
442 void patch_constant_pool(ConstantPool* cp,
443 int index,
444 Handle patch,
445 TRAPS);
446
447 // Wrapper for constantTag.is_klass_[or_]reference.
448 // In older versions of the VM, Klass*s cannot sneak into early phases of
449 // constant pool construction, but in later versions they can.
450 // %%% Let's phase out the old is_klass_reference.
451 bool valid_klass_reference_at(int index) const {
452 return _cp->is_within_bounds(index) &&
453 _cp->tag_at(index).is_klass_or_reference();
454 }
455
456 // Checks that the cpool index is in range and is a utf8
457 bool valid_symbol_at(int cpool_index) const {
458 return _cp->is_within_bounds(cpool_index) &&
459 _cp->tag_at(cpool_index).is_utf8();
460 }
461
|