< 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 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.
 97   //

113   Symbol* _class_name;
114   mutable ClassLoaderData* _loader_data;
115   const bool _is_hidden;
116   const bool _can_access_vm_annotations;
117   int _orig_cp_size;
118   unsigned int _static_oop_count;
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<u1>* _fieldinfo_search_table;
127   Array<FieldStatus>* _fields_status;
128   Array<Method*>* _methods;
129   Array<u2>* _inner_classes;
130   Array<u2>* _nest_members;
131   u2 _nest_host;
132   Array<u2>* _permitted_subclasses;

133   Array<RecordComponent*>* _record_components;
134   Array<InstanceKlass*>* _local_interfaces;

135   Array<InstanceKlass*>* _transitive_interfaces;
136   Annotations* _combined_annotations;
137   AnnotationArray* _class_annotations;
138   AnnotationArray* _class_type_annotations;
139   Array<AnnotationArray*>* _fields_annotations;
140   Array<AnnotationArray*>* _fields_type_annotations;
141   InstanceKlass* _klass;  // InstanceKlass* once created.
142   InstanceKlass* _klass_to_deallocate; // an InstanceKlass* to be destroyed
143 
144   ClassAnnotationCollector* _parsed_annotations;
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 
190   bool _has_nonstatic_concrete_methods;
191   bool _declares_nonstatic_concrete_methods;
192   bool _has_localvariable_table;
193   bool _has_final_method;
194   bool _has_contended_fields;
195   bool _has_aot_runtime_setup_method;






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);

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                     ConstantPool* cp,
264                     const int cp_size,
265                     u2* const java_fields_count_ptr,
266                     TRAPS);
267 
268   // Method parsing
269   Method* parse_method(const ClassFileStream* const cfs,
270                        bool is_interface,


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


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

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




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

403                                  const char *name,
404                                  TRAPS) const {
405     if (!b) { classfile_parse_error(msg, index, name, THREAD); return; }
406   }
407 
408   void throwIllegalSignature(const char* type,
409                              const Symbol* name,
410                              const Symbol* sig,
411                              TRAPS) const;
412 
413   void verify_constantvalue(const ConstantPool* const cp,
414                             int constantvalue_index,
415                             int signature_index,
416                             TRAPS) const;
417 
418   void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS) const;
419   void verify_legal_class_name(const Symbol* name, TRAPS) const;
420   void verify_legal_field_name(const Symbol* name, TRAPS) const;
421   void verify_legal_method_name(const Symbol* name, TRAPS) const;
422 


423   void verify_legal_field_signature(const Symbol* fieldname,
424                                     const Symbol* signature,
425                                     TRAPS) const;
426   int  verify_legal_method_signature(const Symbol* methodname,
427                                      const Symbol* signature,
428                                      TRAPS) const;
429   void verify_legal_name_with_signature(const Symbol* name,
430                                         const Symbol* signature,
431                                         TRAPS) const;
432 
433   void verify_class_version(u2 major, u2 minor, Symbol* class_name, TRAPS);
434 
435   void verify_legal_class_modifiers(jint flags, TRAPS) const;
436   void verify_legal_field_modifiers(jint flags, bool is_interface, TRAPS) const;


437   void verify_legal_method_modifiers(jint flags,
438                                      bool is_interface,
439                                      const Symbol* name,
440                                      TRAPS) const;
441 
442   void check_super_class_access(const InstanceKlass* this_klass,
443                                 TRAPS);
444 
445   void check_super_interface_access(const InstanceKlass* this_klass,
446                                     TRAPS);
447 
448   const char* skip_over_field_signature(const char* signature,
449                                         bool void_ok,
450                                         unsigned int length,
451                                         TRAPS) const;
452 
453   // Wrapper for constantTag.is_klass_[or_]reference.
454   // In older versions of the VM, Klass*s cannot sneak into early phases of
455   // constant pool construction, but in later versions they can.
456   // %%% Let's phase out the old is_klass_reference.
457   bool valid_klass_reference_at(int index) const {
458     return _cp->is_within_bounds(index) &&

470                                 u2* const localvariable_table_length,
471                                 const unsafe_u2** const localvariable_table_start,
472                                 int lvtt_cnt,
473                                 u2* const localvariable_type_table_length,
474                                 const unsafe_u2** const localvariable_type_table_start,
475                                 TRAPS);
476 
477   void copy_method_annotations(ConstMethod* cm,
478                                const u1* runtime_visible_annotations,
479                                int runtime_visible_annotations_length,
480                                const u1* runtime_visible_parameter_annotations,
481                                int runtime_visible_parameter_annotations_length,
482                                const u1* runtime_visible_type_annotations,
483                                int runtime_visible_type_annotations_length,
484                                const u1* annotation_default,
485                                int annotation_default_length,
486                                TRAPS);
487 
488   void update_class_name(Symbol* new_name);
489 



490  public:
491   ClassFileParser(ClassFileStream* stream,
492                   Symbol* name,
493                   ClassLoaderData* loader_data,
494                   const ClassLoadInfo* cl_info,
495                   Publicity pub_level,
496                   TRAPS);
497 
498   ~ClassFileParser();
499 
500   InstanceKlass* create_instance_klass(bool cf_changed_in_CFLH, const ClassInstanceInfo& cl_inst_info, TRAPS);
501 
502   const ClassFileStream* clone_stream() const;
503 
504   void set_klass_to_deallocate(InstanceKlass* klass);
505 
506   int static_field_size() const;
507   int total_oop_map_count() const;
508   jint layout_size() const;
509 
510   int vtable_size() const { return _vtable_size; }
511   int itable_size() const { return _itable_size; }
512 
513   u2 this_class_index() const { return _this_class_index; }
514 
515   bool is_hidden() const { return _is_hidden; }
516   bool is_interface() const { return _access_flags.is_interface(); }







517   bool is_abstract() const { return _access_flags.is_abstract(); }
518 
519   // Returns true if the Klass to be generated will need to be addressable
520   // with a narrow Klass ID.
521   bool klass_needs_narrow_id() const;
522 
523   ClassLoaderData* loader_data() const { return _loader_data; }
524   const Symbol* class_name() const { return _class_name; }
525   const InstanceKlass* super_klass() const { return _super_klass; }
526 
527   ReferenceType super_reference_type() const;
528   bool is_instance_ref_klass() const;
529   bool is_java_lang_ref_Reference_subclass() const;
530 
531   AccessFlags access_flags() const { return _access_flags; }
532 
533   bool is_internal() const { return INTERNAL == _pub_level; }
534 


535   static bool verify_unqualified_name(const char* name, unsigned int length, int type);
536 
537 #ifdef ASSERT
538   static bool is_internal_format(Symbol* class_name);
539 #endif
540 
541 };
542 
543 #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   int _payload_alignment;
 78   int _payload_offset;
 79   int _payload_size_in_bytes;
 80   int _non_atomic_size_in_bytes;
 81   int _non_atomic_alignment;
 82   int _atomic_layout_size_in_bytes;
 83   int _nullable_layout_size_in_bytes;
 84   int _null_marker_offset;
 85   int _null_reset_value_offset;
 86   bool _has_nonstatic_fields;
 87   bool _is_naturally_atomic;
 88   bool _must_be_atomic;
 89   bool _has_inline_fields;
 90   bool _is_empty_inline_klass;
 91 };
 92 
 93 // Parser for for .class files
 94 //
 95 // The bytes describing the class file structure is read from a Stream object
 96 
 97 class ClassFileParser {
 98   friend class FieldLayoutBuilder;
 99   friend class FieldLayout;
100 
101   class ClassAnnotationCollector;
102   class FieldAnnotationCollector;
103 
104  public:
105   // The ClassFileParser has an associated "publicity" level
106   // It is used to control which subsystems (if any)
107   // will observe the parsing (logging, events, tracing).
108   // Default level is "BROADCAST", which is equivalent to
109   // a "public" parsing attempt.
110   //

126   Symbol* _class_name;
127   mutable ClassLoaderData* _loader_data;
128   const bool _is_hidden;
129   const bool _can_access_vm_annotations;
130   int _orig_cp_size;
131   unsigned int _static_oop_count;
132 
133   // Metadata created before the instance klass is created.  Must be deallocated
134   // if not transferred to the InstanceKlass upon successful class loading
135   // in which case these pointers have been set to null.
136   const InstanceKlass* _super_klass;
137   ConstantPool* _cp;
138   Array<u1>* _fieldinfo_stream;
139   Array<u1>* _fieldinfo_search_table;
140   Array<FieldStatus>* _fields_status;
141   Array<Method*>* _methods;
142   Array<u2>* _inner_classes;
143   Array<u2>* _nest_members;
144   u2 _nest_host;
145   Array<u2>* _permitted_subclasses;
146   Array<u2>* _loadable_descriptors;
147   Array<RecordComponent*>* _record_components;
148   Array<InstanceKlass*>* _local_interfaces;
149   GrowableArray<u2>* _local_interface_indexes;
150   Array<InstanceKlass*>* _transitive_interfaces;
151   Annotations* _combined_annotations;
152   AnnotationArray* _class_annotations;
153   AnnotationArray* _class_type_annotations;
154   Array<AnnotationArray*>* _fields_annotations;
155   Array<AnnotationArray*>* _fields_type_annotations;
156   InstanceKlass* _klass;  // InstanceKlass* once created.
157   InstanceKlass* _klass_to_deallocate; // an InstanceKlass* to be destroyed
158 
159   ClassAnnotationCollector* _parsed_annotations;
160   FieldLayoutInfo* _layout_info;
161   Array<InlineLayoutInfo>* _inline_layout_info_array;
162   GrowableArray<FieldInfo>* _temp_field_info;
163   const intArray* _method_ordering;
164   GrowableArray<Method*>* _all_mirandas;
165 
166   enum { fixed_buffer_size = 128 };
167   u_char _linenumbertable_buffer[fixed_buffer_size];
168 
169   // Size of Java vtable (in words)
170   int _vtable_size;
171   int _itable_size;
172 
173   int _num_miranda_methods;
174 
175 
176   Handle _protection_domain;
177   AccessFlags _access_flags;
178 
179   // for tracing and notifications
180   Publicity _pub_level;
181 
182   // Used to keep track of whether a constant pool item 19 or 20 is found.  These
183   // correspond to CONSTANT_Module and CONSTANT_Package tags and are not allowed
184   // in regular class files.  For class file version >= 53, a CFE cannot be thrown
185   // immediately when these are seen because a NCDFE must be thrown if the class's
186   // access_flags have ACC_MODULE set.  But, the access_flags haven't been looked
187   // at yet.  So, the bad constant pool item is cached here.  A value of zero
188   // means that no constant pool item 19 or 20 was found.
189   short _bad_constant_seen;
190 
191   // class attributes parsed before the instance klass is created:
192   bool _synthetic_flag;
193   int _sde_length;
194   const char* _sde_buffer;
195   u2 _sourcefile_index;
196   u2 _generic_signature_index;
197 
198   u2 _major_version;
199   u2 _minor_version;
200   u2 _this_class_index;
201   u2 _super_class_index;
202   u2 _itfs_len;
203   u2 _java_fields_count;
204 
205   bool _need_verify;
206 
207   bool _has_nonstatic_concrete_methods;
208   bool _declares_nonstatic_concrete_methods;
209   bool _has_localvariable_table;
210   bool _has_final_method;
211   bool _has_contended_fields;
212   bool _has_aot_runtime_setup_method;
213   bool _has_strict_static_fields;
214 
215   bool _has_inline_type_fields;
216   bool _is_naturally_atomic;
217   bool _must_be_atomic;
218   bool _has_loosely_consistent_annotation;
219 
220   // precomputed flags
221   bool _has_finalizer;
222   bool _has_empty_finalizer;
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                     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,

434                                  const char *name,
435                                  TRAPS) const {
436     if (!b) { classfile_parse_error(msg, index, name, THREAD); return; }
437   }
438 
439   void throwIllegalSignature(const char* type,
440                              const Symbol* name,
441                              const Symbol* sig,
442                              TRAPS) const;
443 
444   void verify_constantvalue(const ConstantPool* const cp,
445                             int constantvalue_index,
446                             int signature_index,
447                             TRAPS) const;
448 
449   void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS) const;
450   void verify_legal_class_name(const Symbol* name, TRAPS) const;
451   void verify_legal_field_name(const Symbol* name, TRAPS) const;
452   void verify_legal_method_name(const Symbol* name, TRAPS) const;
453 
454   bool legal_field_signature(const Symbol* signature, TRAPS) const;
455 
456   void verify_legal_field_signature(const Symbol* fieldname,
457                                     const Symbol* signature,
458                                     TRAPS) const;
459   int  verify_legal_method_signature(const Symbol* methodname,
460                                      const Symbol* signature,
461                                      TRAPS) const;
462   void verify_legal_name_with_signature(const Symbol* name,
463                                         const Symbol* signature,
464                                         TRAPS) const;
465 
466   void verify_class_version(u2 major, u2 minor, Symbol* class_name, TRAPS);
467 
468   void verify_legal_class_modifiers(jint flags, TRAPS) const;
469   void verify_legal_field_modifiers(jint flags,
470                                     AccessFlags class_access_flags,
471                                     TRAPS) const;
472   void verify_legal_method_modifiers(jint flags,
473                                      AccessFlags class_access_flags,
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   // Check if the class file supports inline types
526   bool supports_inline_types() const;
527 
528  public:
529   ClassFileParser(ClassFileStream* stream,
530                   Symbol* name,
531                   ClassLoaderData* loader_data,
532                   const ClassLoadInfo* cl_info,
533                   Publicity pub_level,
534                   TRAPS);
535 
536   ~ClassFileParser();
537 
538   InstanceKlass* create_instance_klass(bool cf_changed_in_CFLH, const ClassInstanceInfo& cl_inst_info, TRAPS);
539 
540   const ClassFileStream* clone_stream() const;
541 
542   void set_klass_to_deallocate(InstanceKlass* klass);
543 
544   int static_field_size() const;
545   int total_oop_map_count() const;
546   jint layout_size() const;
547 
548   int vtable_size() const { return _vtable_size; }
549   int itable_size() const { return _itable_size; }
550 
551   u2 this_class_index() const { return _this_class_index; }
552 
553   bool is_hidden() const { return _is_hidden; }
554   bool is_interface() const { return _access_flags.is_interface(); }
555   // Being an inline type means being a concrete value class
556   bool is_inline_type() const { return !_access_flags.is_identity_class() && !_access_flags.is_interface() && !_access_flags.is_abstract(); }
557   bool is_abstract_class() const { return _access_flags.is_abstract(); }
558   bool is_identity_class() const { return _access_flags.is_identity_class(); }
559   bool has_inline_fields() const { return _has_inline_type_fields; }
560 
561   u2 java_fields_count() const { return _java_fields_count; }
562   bool is_abstract() const { return _access_flags.is_abstract(); }
563 
564   // Returns true if the Klass to be generated will need to be addressable
565   // with a narrow Klass ID.
566   bool klass_needs_narrow_id() const;
567 
568   ClassLoaderData* loader_data() const { return _loader_data; }
569   const Symbol* class_name() const { return _class_name; }
570   const InstanceKlass* super_klass() const { return _super_klass; }
571 
572   ReferenceType super_reference_type() const;
573   bool is_instance_ref_klass() const;
574   bool is_java_lang_ref_Reference_subclass() const;
575 
576   AccessFlags access_flags() const { return _access_flags; }
577 
578   bool is_internal() const { return INTERNAL == _pub_level; }
579 
580   bool is_class_in_loadable_descriptors_attribute(Symbol *klass);
581 
582   static bool verify_unqualified_name(const char* name, unsigned int length, int type);
583 
584 #ifdef ASSERT
585   static bool is_internal_format(Symbol* class_name);
586 #endif
587 
588 };
589 
590 #endif // SHARE_CLASSFILE_CLASSFILEPARSER_HPP
< prev index next >