< prev index next >

src/hotspot/share/classfile/classFileParser.hpp

Print this page

 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   bool _has_vanilla_constructor;
201   int _max_bootstrap_specifier_index;  // detects BSS values
202 
203   void parse_stream(const ClassFileStream* const stream, TRAPS);
204 
205   void mangle_hidden_class_name(InstanceKlass* const ik);
206 
207   void post_process_parsed_stream(const ClassFileStream* const stream,
208                                   ConstantPool* cp,
209                                   TRAPS);
210 
211   void fill_instance_klass(InstanceKlass* ik, bool cf_changed_in_CFLH,
212                            const ClassInstanceInfo& cl_inst_info, TRAPS);
213 
214   void set_klass(InstanceKlass* instance);
215 
216   void set_class_bad_constant_seen(short bad_constant);

243                         bool* has_nonstatic_concrete_methods,
244                         TRAPS);
245 
246   const InstanceKlass* parse_super_class(ConstantPool* const cp,
247                                          const int super_class_index,
248                                          const bool need_verify,
249                                          TRAPS);
250 
251   // Field parsing
252   void parse_field_attributes(const ClassFileStream* const cfs,
253                               u2 attributes_count,
254                               bool is_static,
255                               u2 signature_index,
256                               u2* const constantvalue_index_addr,
257                               bool* const is_synthetic_addr,
258                               u2* const generic_signature_index_addr,
259                               FieldAnnotationCollector* parsed_annotations,
260                               TRAPS);
261 
262   void parse_fields(const ClassFileStream* const cfs,
263                     bool is_interface,
264                     FieldAllocationCount* const fac,
265                     ConstantPool* cp,
266                     const int cp_size,
267                     u2* const java_fields_count_ptr,
268                     TRAPS);
269 
270   // Method parsing
271   Method* parse_method(const ClassFileStream* const cfs,
272                        bool is_interface,


273                        const ConstantPool* cp,
274                        bool* const has_localvariable_table,
275                        TRAPS);
276 
277   void parse_methods(const ClassFileStream* const cfs,
278                      bool is_interface,


279                      bool* const has_localvariable_table,
280                      bool* const has_final_method,
281                      bool* const declares_nonstatic_concrete_methods,
282                      TRAPS);
283 
284   const unsafe_u2* parse_exception_table(const ClassFileStream* const stream,
285                                          u4 code_length,
286                                          u4 exception_table_length,
287                                          TRAPS);
288 
289   void parse_linenumber_table(u4 code_attribute_length,
290                               u4 code_length,
291                               CompressedLineNumberWriteStream**const write_stream,
292                               TRAPS);
293 
294   const unsafe_u2* parse_localvariable_table(const ClassFileStream* const cfs,
295                                              u4 code_length,
296                                              u2 max_locals,
297                                              u4 code_attribute_length,
298                                              u2* const localvariable_table_length,

313 
314   // Check for circularity in InnerClasses attribute.
315   bool check_inner_classes_circularity(const ConstantPool* cp, int length, TRAPS);
316 
317   u2   parse_classfile_inner_classes_attribute(const ClassFileStream* const cfs,
318                                                const ConstantPool* cp,
319                                                const u1* const inner_classes_attribute_start,
320                                                bool parsed_enclosingmethod_attribute,
321                                                u2 enclosing_method_class_index,
322                                                u2 enclosing_method_method_index,
323                                                TRAPS);
324 
325   u2 parse_classfile_nest_members_attribute(const ClassFileStream* const cfs,
326                                             const u1* const nest_members_attribute_start,
327                                             TRAPS);
328 
329   u2 parse_classfile_permitted_subclasses_attribute(const ClassFileStream* const cfs,
330                                                     const u1* const permitted_subclasses_attribute_start,
331                                                     TRAPS);
332 




333   u4 parse_classfile_record_attribute(const ClassFileStream* const cfs,
334                                       const ConstantPool* cp,
335                                       const u1* const record_attribute_start,
336                                       TRAPS);
337 
338   void parse_classfile_attributes(const ClassFileStream* const cfs,
339                                   ConstantPool* cp,
340                                   ClassAnnotationCollector* parsed_annotations,
341                                   TRAPS);
342 
343   void parse_classfile_synthetic_attribute();
344   void parse_classfile_signature_attribute(const ClassFileStream* const cfs, TRAPS);
345   void parse_classfile_bootstrap_methods_attribute(const ClassFileStream* const cfs,
346                                                    ConstantPool* cp,
347                                                    u4 attribute_length,
348                                                    TRAPS);
349 
350   // Annotations handling
351   AnnotationArray* assemble_annotations(const u1* const runtime_visible_annotations,
352                                         int runtime_visible_annotations_length,

441                                  const char *name,
442                                  TRAPS) const {
443     if (!b) { classfile_parse_error(msg, index, name, THREAD); return; }
444   }
445 
446   void throwIllegalSignature(const char* type,
447                              const Symbol* name,
448                              const Symbol* sig,
449                              TRAPS) const;
450 
451   void verify_constantvalue(const ConstantPool* const cp,
452                             int constantvalue_index,
453                             int signature_index,
454                             TRAPS) const;
455 
456   void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS) const;
457   void verify_legal_class_name(const Symbol* name, TRAPS) const;
458   void verify_legal_field_name(const Symbol* name, TRAPS) const;
459   void verify_legal_method_name(const Symbol* name, TRAPS) const;
460 


461   void verify_legal_field_signature(const Symbol* fieldname,
462                                     const Symbol* signature,
463                                     TRAPS) const;
464   int  verify_legal_method_signature(const Symbol* methodname,
465                                      const Symbol* signature,
466                                      TRAPS) const;
467   void verify_legal_name_with_signature(const Symbol* name,
468                                         const Symbol* signature,
469                                         TRAPS) const;
470 
471   void verify_class_version(u2 major, u2 minor, Symbol* class_name, TRAPS);
472 
473   void verify_legal_class_modifiers(jint flags, TRAPS) const;
474   void verify_legal_field_modifiers(jint flags, bool is_interface, TRAPS) const;


475   void verify_legal_method_modifiers(jint flags,
476                                      bool is_interface,
477                                      const Symbol* name,
478                                      TRAPS) const;
479 
480   void check_super_class_access(const InstanceKlass* this_klass,
481                                 TRAPS);
482 
483   void check_super_interface_access(const InstanceKlass* this_klass,
484                                     TRAPS);
485 
486   const char* skip_over_field_signature(const char* signature,
487                                         bool void_ok,
488                                         unsigned int length,
489                                         TRAPS) const;
490 
491   // Wrapper for constantTag.is_klass_[or_]reference.
492   // In older versions of the VM, Klass*s cannot sneak into early phases of
493   // constant pool construction, but in later versions they can.
494   // %%% Let's phase out the old is_klass_reference.
495   bool valid_klass_reference_at(int index) const {
496     return _cp->is_within_bounds(index) &&

514 
515   void copy_method_annotations(ConstMethod* cm,
516                                const u1* runtime_visible_annotations,
517                                int runtime_visible_annotations_length,
518                                const u1* runtime_invisible_annotations,
519                                int runtime_invisible_annotations_length,
520                                const u1* runtime_visible_parameter_annotations,
521                                int runtime_visible_parameter_annotations_length,
522                                const u1* runtime_invisible_parameter_annotations,
523                                int runtime_invisible_parameter_annotations_length,
524                                const u1* runtime_visible_type_annotations,
525                                int runtime_visible_type_annotations_length,
526                                const u1* runtime_invisible_type_annotations,
527                                int runtime_invisible_type_annotations_length,
528                                const u1* annotation_default,
529                                int annotation_default_length,
530                                TRAPS);
531 
532   void update_class_name(Symbol* new_name);
533 



534  public:
535   ClassFileParser(ClassFileStream* stream,
536                   Symbol* name,
537                   ClassLoaderData* loader_data,
538                   const ClassLoadInfo* cl_info,
539                   Publicity pub_level,
540                   TRAPS);
541 
542   ~ClassFileParser();
543 
544   InstanceKlass* create_instance_klass(bool cf_changed_in_CFLH, const ClassInstanceInfo& cl_inst_info, TRAPS);
545 
546   const ClassFileStream* clone_stream() const;
547 
548   void set_klass_to_deallocate(InstanceKlass* klass);
549 
550   int static_field_size() const;
551   int total_oop_map_count() const;
552   jint layout_size() const;
553 
554   int vtable_size() const { return _vtable_size; }
555   int itable_size() const { return _itable_size; }
556 
557   u2 this_class_index() const { return _this_class_index; }
558 
559   bool is_hidden() const { return _is_hidden; }
560   bool is_interface() const { return _access_flags.is_interface(); }







561 
562   ClassLoaderData* loader_data() const { return _loader_data; }
563   const Symbol* class_name() const { return _class_name; }
564   const InstanceKlass* super_klass() const { return _super_klass; }
565 
566   ReferenceType super_reference_type() const;
567   bool is_instance_ref_klass() const;
568   bool is_java_lang_ref_Reference_subclass() const;
569 
570   AccessFlags access_flags() const { return _access_flags; }
571 
572   bool is_internal() const { return INTERNAL == _pub_level; }
573 


574   static bool verify_unqualified_name(const char* name, unsigned int length, int type);
575 
576 #ifdef ASSERT
577   static bool is_internal_format(Symbol* class_name);
578 #endif
579 
580 };
581 
582 #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   bool _has_vanilla_constructor;
223   int _max_bootstrap_specifier_index;  // detects BSS values
224 
225   void parse_stream(const ClassFileStream* const stream, TRAPS);
226 
227   void mangle_hidden_class_name(InstanceKlass* const ik);
228 
229   void post_process_parsed_stream(const ClassFileStream* const stream,
230                                   ConstantPool* cp,
231                                   TRAPS);
232 
233   void fill_instance_klass(InstanceKlass* ik, bool cf_changed_in_CFLH,
234                            const ClassInstanceInfo& cl_inst_info, TRAPS);
235 
236   void set_klass(InstanceKlass* instance);
237 
238   void set_class_bad_constant_seen(short bad_constant);

265                         bool* has_nonstatic_concrete_methods,
266                         TRAPS);
267 
268   const InstanceKlass* parse_super_class(ConstantPool* const cp,
269                                          const int super_class_index,
270                                          const bool need_verify,
271                                          TRAPS);
272 
273   // Field parsing
274   void parse_field_attributes(const ClassFileStream* const cfs,
275                               u2 attributes_count,
276                               bool is_static,
277                               u2 signature_index,
278                               u2* const constantvalue_index_addr,
279                               bool* const is_synthetic_addr,
280                               u2* const generic_signature_index_addr,
281                               FieldAnnotationCollector* parsed_annotations,
282                               TRAPS);
283 
284   void parse_fields(const ClassFileStream* const cfs,
285                     AccessFlags class_access_flags,
286                     FieldAllocationCount* const fac,
287                     ConstantPool* cp,
288                     const int cp_size,
289                     u2* const java_fields_count_ptr,
290                     TRAPS);
291 
292   // Method parsing
293   Method* parse_method(const ClassFileStream* const cfs,
294                        bool is_interface,
295                        bool is_value_class,
296                        bool is_abstract_class,
297                        const ConstantPool* cp,
298                        bool* const has_localvariable_table,
299                        TRAPS);
300 
301   void parse_methods(const ClassFileStream* const cfs,
302                      bool is_interface,
303                      bool is_value_class,
304                      bool is_abstract_class,
305                      bool* const has_localvariable_table,
306                      bool* const has_final_method,
307                      bool* const declares_nonstatic_concrete_methods,
308                      TRAPS);
309 
310   const unsafe_u2* parse_exception_table(const ClassFileStream* const stream,
311                                          u4 code_length,
312                                          u4 exception_table_length,
313                                          TRAPS);
314 
315   void parse_linenumber_table(u4 code_attribute_length,
316                               u4 code_length,
317                               CompressedLineNumberWriteStream**const write_stream,
318                               TRAPS);
319 
320   const unsafe_u2* parse_localvariable_table(const ClassFileStream* const cfs,
321                                              u4 code_length,
322                                              u2 max_locals,
323                                              u4 code_attribute_length,
324                                              u2* const localvariable_table_length,

339 
340   // Check for circularity in InnerClasses attribute.
341   bool check_inner_classes_circularity(const ConstantPool* cp, int length, TRAPS);
342 
343   u2   parse_classfile_inner_classes_attribute(const ClassFileStream* const cfs,
344                                                const ConstantPool* cp,
345                                                const u1* const inner_classes_attribute_start,
346                                                bool parsed_enclosingmethod_attribute,
347                                                u2 enclosing_method_class_index,
348                                                u2 enclosing_method_method_index,
349                                                TRAPS);
350 
351   u2 parse_classfile_nest_members_attribute(const ClassFileStream* const cfs,
352                                             const u1* const nest_members_attribute_start,
353                                             TRAPS);
354 
355   u2 parse_classfile_permitted_subclasses_attribute(const ClassFileStream* const cfs,
356                                                     const u1* const permitted_subclasses_attribute_start,
357                                                     TRAPS);
358 
359   u2 parse_classfile_loadable_descriptors_attribute(const ClassFileStream* const cfs,
360                                                     const u1* const loadable_descriptors_attribute_start,
361                                                     TRAPS);
362 
363   u4 parse_classfile_record_attribute(const ClassFileStream* const cfs,
364                                       const ConstantPool* cp,
365                                       const u1* const record_attribute_start,
366                                       TRAPS);
367 
368   void parse_classfile_attributes(const ClassFileStream* const cfs,
369                                   ConstantPool* cp,
370                                   ClassAnnotationCollector* parsed_annotations,
371                                   TRAPS);
372 
373   void parse_classfile_synthetic_attribute();
374   void parse_classfile_signature_attribute(const ClassFileStream* const cfs, TRAPS);
375   void parse_classfile_bootstrap_methods_attribute(const ClassFileStream* const cfs,
376                                                    ConstantPool* cp,
377                                                    u4 attribute_length,
378                                                    TRAPS);
379 
380   // Annotations handling
381   AnnotationArray* assemble_annotations(const u1* const runtime_visible_annotations,
382                                         int runtime_visible_annotations_length,

471                                  const char *name,
472                                  TRAPS) const {
473     if (!b) { classfile_parse_error(msg, index, name, THREAD); return; }
474   }
475 
476   void throwIllegalSignature(const char* type,
477                              const Symbol* name,
478                              const Symbol* sig,
479                              TRAPS) const;
480 
481   void verify_constantvalue(const ConstantPool* const cp,
482                             int constantvalue_index,
483                             int signature_index,
484                             TRAPS) const;
485 
486   void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS) const;
487   void verify_legal_class_name(const Symbol* name, TRAPS) const;
488   void verify_legal_field_name(const Symbol* name, TRAPS) const;
489   void verify_legal_method_name(const Symbol* name, TRAPS) const;
490 
491   bool legal_field_signature(const Symbol* signature, TRAPS) const;
492 
493   void verify_legal_field_signature(const Symbol* fieldname,
494                                     const Symbol* signature,
495                                     TRAPS) const;
496   int  verify_legal_method_signature(const Symbol* methodname,
497                                      const Symbol* signature,
498                                      TRAPS) const;
499   void verify_legal_name_with_signature(const Symbol* name,
500                                         const Symbol* signature,
501                                         TRAPS) const;
502 
503   void verify_class_version(u2 major, u2 minor, Symbol* class_name, TRAPS);
504 
505   void verify_legal_class_modifiers(jint flags, const char* name, bool is_Object, TRAPS) const;
506   void verify_legal_field_modifiers(jint flags,
507                                     AccessFlags class_access_flags,
508                                     TRAPS) const;
509   void verify_legal_method_modifiers(jint flags,
510                                      AccessFlags class_access_flags,
511                                      const Symbol* name,
512                                      TRAPS) const;
513 
514   void check_super_class_access(const InstanceKlass* this_klass,
515                                 TRAPS);
516 
517   void check_super_interface_access(const InstanceKlass* this_klass,
518                                     TRAPS);
519 
520   const char* skip_over_field_signature(const char* signature,
521                                         bool void_ok,
522                                         unsigned int length,
523                                         TRAPS) const;
524 
525   // Wrapper for constantTag.is_klass_[or_]reference.
526   // In older versions of the VM, Klass*s cannot sneak into early phases of
527   // constant pool construction, but in later versions they can.
528   // %%% Let's phase out the old is_klass_reference.
529   bool valid_klass_reference_at(int index) const {
530     return _cp->is_within_bounds(index) &&

548 
549   void copy_method_annotations(ConstMethod* cm,
550                                const u1* runtime_visible_annotations,
551                                int runtime_visible_annotations_length,
552                                const u1* runtime_invisible_annotations,
553                                int runtime_invisible_annotations_length,
554                                const u1* runtime_visible_parameter_annotations,
555                                int runtime_visible_parameter_annotations_length,
556                                const u1* runtime_invisible_parameter_annotations,
557                                int runtime_invisible_parameter_annotations_length,
558                                const u1* runtime_visible_type_annotations,
559                                int runtime_visible_type_annotations_length,
560                                const u1* runtime_invisible_type_annotations,
561                                int runtime_invisible_type_annotations_length,
562                                const u1* annotation_default,
563                                int annotation_default_length,
564                                TRAPS);
565 
566   void update_class_name(Symbol* new_name);
567 
568   // Check if the class file supports inline types
569   bool supports_inline_types() const;
570 
571  public:
572   ClassFileParser(ClassFileStream* stream,
573                   Symbol* name,
574                   ClassLoaderData* loader_data,
575                   const ClassLoadInfo* cl_info,
576                   Publicity pub_level,
577                   TRAPS);
578 
579   ~ClassFileParser();
580 
581   InstanceKlass* create_instance_klass(bool cf_changed_in_CFLH, const ClassInstanceInfo& cl_inst_info, TRAPS);
582 
583   const ClassFileStream* clone_stream() const;
584 
585   void set_klass_to_deallocate(InstanceKlass* klass);
586 
587   int static_field_size() const;
588   int total_oop_map_count() const;
589   jint layout_size() const;
590 
591   int vtable_size() const { return _vtable_size; }
592   int itable_size() const { return _itable_size; }
593 
594   u2 this_class_index() const { return _this_class_index; }
595 
596   bool is_hidden() const { return _is_hidden; }
597   bool is_interface() const { return _access_flags.is_interface(); }
598   // Being an inline type means being a concrete value class
599   bool is_inline_type() const { return !_access_flags.is_identity_class() && !_access_flags.is_interface() && !_access_flags.is_abstract(); }
600   bool is_abstract_class() const { return _access_flags.is_abstract(); }
601   bool is_identity_class() const { return _access_flags.is_identity_class(); }
602   bool has_inline_fields() const { return _has_inline_type_fields; }
603 
604   u2 java_fields_count() const { return _java_fields_count; }
605 
606   ClassLoaderData* loader_data() const { return _loader_data; }
607   const Symbol* class_name() const { return _class_name; }
608   const InstanceKlass* super_klass() const { return _super_klass; }
609 
610   ReferenceType super_reference_type() const;
611   bool is_instance_ref_klass() const;
612   bool is_java_lang_ref_Reference_subclass() const;
613 
614   AccessFlags access_flags() const { return _access_flags; }
615 
616   bool is_internal() const { return INTERNAL == _pub_level; }
617 
618   bool is_class_in_loadable_descriptors_attribute(Symbol *klass);
619 
620   static bool verify_unqualified_name(const char* name, unsigned int length, int type);
621 
622 #ifdef ASSERT
623   static bool is_internal_format(Symbol* class_name);
624 #endif
625 
626 };
627 
628 #endif // SHARE_CLASSFILE_CLASSFILEPARSER_HPP
< prev index next >