< prev index next >

src/share/vm/classfile/classFileParser.hpp

Print this page
rev 13049 : imported patch 8181377_unsafe_u2


  58 
  59  public:
  60   // The ClassFileParser has an associated "publicity" level
  61   // It is used to control which subsystems (if any)
  62   // will observe the parsing (logging, events, tracing).
  63   // Default level is "BROADCAST", which is equivalent to
  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;


 225                     FieldAllocationCount* const fac,
 226                     ConstantPool* cp,
 227                     const int cp_size,
 228                     u2* const java_fields_count_ptr,
 229                     TRAPS);
 230 
 231   // Method parsing
 232   Method* parse_method(const ClassFileStream* const cfs,
 233                        bool is_interface,
 234                        const ConstantPool* cp,
 235                        AccessFlags* const promoted_flags,
 236                        TRAPS);
 237 
 238   void parse_methods(const ClassFileStream* const cfs,
 239                      bool is_interface,
 240                      AccessFlags* const promoted_flags,
 241                      bool* const has_final_method,
 242                      bool* const declares_nonstatic_concrete_methods,
 243                      TRAPS);
 244 
 245   const void* parse_exception_table(const ClassFileStream* const stream,
 246                                     u4 code_length,
 247                                     u4 exception_table_length,
 248                                     TRAPS);
 249 
 250   void parse_linenumber_table(u4 code_attribute_length,
 251                               u4 code_length,
 252                               CompressedLineNumberWriteStream**const write_stream,
 253                               TRAPS);
 254 
 255   const void* parse_localvariable_table(const ClassFileStream* const cfs,
 256                                         u4 code_length,
 257                                         u2 max_locals,
 258                                         u4 code_attribute_length,
 259                                         u2* const localvariable_table_length,
 260                                         bool isLVTT,
 261                                         TRAPS);
 262 
 263   const void* parse_checked_exceptions(const ClassFileStream* const cfs,
 264                                        u2* const checked_exceptions_length,
 265                                        u4 method_attribute_length,
 266                                        TRAPS);
 267 
 268   void parse_type_array(u2 array_length,
 269                         u4 code_length,
 270                         u4* const u1_index,
 271                         u4* const u2_index,
 272                         u1* const u1_array,
 273                         u2* const u2_array,
 274                         TRAPS);
 275 
 276   // Classfile attribute parsing
 277   u2 parse_generic_signature_attribute(const ClassFileStream* const cfs, TRAPS);
 278   void parse_classfile_sourcefile_attribute(const ClassFileStream* const cfs, TRAPS);
 279   void parse_classfile_source_debug_extension_attribute(const ClassFileStream* const cfs,
 280                                                         int length,
 281                                                         TRAPS);
 282 
 283   u2   parse_classfile_inner_classes_attribute(const ClassFileStream* const cfs,


 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 
 462   void copy_localvariable_table(const ConstMethod* cm,
 463                                 int lvt_cnt,
 464                                 u2* const localvariable_table_length,
 465                                 const void** const localvariable_table_start,
 466                                 int lvtt_cnt,
 467                                 u2* const localvariable_type_table_length,
 468                                 const void** const localvariable_type_table_start,
 469                                 TRAPS);
 470 
 471   void copy_method_annotations(ConstMethod* cm,
 472                                const u1* runtime_visible_annotations,
 473                                int runtime_visible_annotations_length,
 474                                const u1* runtime_invisible_annotations,
 475                                int runtime_invisible_annotations_length,
 476                                const u1* runtime_visible_parameter_annotations,
 477                                int runtime_visible_parameter_annotations_length,
 478                                const u1* runtime_invisible_parameter_annotations,
 479                                int runtime_invisible_parameter_annotations_length,
 480                                const u1* runtime_visible_type_annotations,
 481                                int runtime_visible_type_annotations_length,
 482                                const u1* runtime_invisible_type_annotations,
 483                                int runtime_invisible_type_annotations_length,
 484                                const u1* annotation_default,
 485                                int annotation_default_length,
 486                                TRAPS);
 487 
 488   // lays out fields in class and returns the total oopmap count




  58 
  59  public:
  60   // The ClassFileParser has an associated "publicity" level
  61   // It is used to control which subsystems (if any)
  62   // will observe the parsing (logging, events, tracing).
  63   // Default level is "BROADCAST", which is equivalent to
  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   // Potentially unaligned pointer to various 16-bit entries in the class file
  79   typedef void unsafe_u2;
  80 
  81   const ClassFileStream* _stream; // Actual input stream
  82   const Symbol* _requested_name;
  83   Symbol* _class_name;
  84   mutable ClassLoaderData* _loader_data;
  85   const InstanceKlass* _host_klass;
  86   GrowableArray<Handle>* _cp_patches; // overrides for CP entries
  87   int _num_patched_klasses;
  88   int _max_num_patched_klasses;
  89   int _orig_cp_size;
  90   int _first_patched_klass_resolved_index;
  91 
  92   // Metadata created before the instance klass is created.  Must be deallocated
  93   // if not transferred to the InstanceKlass upon successful class loading
  94   // in which case these pointers have been set to NULL.
  95   const InstanceKlass* _super_klass;
  96   ConstantPool* _cp;
  97   Array<u2>* _fields;
  98   Array<Method*>* _methods;
  99   Array<u2>* _inner_classes;
 100   Array<Klass*>* _local_interfaces;


 228                     FieldAllocationCount* const fac,
 229                     ConstantPool* cp,
 230                     const int cp_size,
 231                     u2* const java_fields_count_ptr,
 232                     TRAPS);
 233 
 234   // Method parsing
 235   Method* parse_method(const ClassFileStream* const cfs,
 236                        bool is_interface,
 237                        const ConstantPool* cp,
 238                        AccessFlags* const promoted_flags,
 239                        TRAPS);
 240 
 241   void parse_methods(const ClassFileStream* const cfs,
 242                      bool is_interface,
 243                      AccessFlags* const promoted_flags,
 244                      bool* const has_final_method,
 245                      bool* const declares_nonstatic_concrete_methods,
 246                      TRAPS);
 247 
 248   const unsafe_u2* parse_exception_table(const ClassFileStream* const stream,
 249                                          u4 code_length,
 250                                          u4 exception_table_length,
 251                                          TRAPS);
 252 
 253   void parse_linenumber_table(u4 code_attribute_length,
 254                               u4 code_length,
 255                               CompressedLineNumberWriteStream**const write_stream,
 256                               TRAPS);
 257 
 258   const unsafe_u2* parse_localvariable_table(const ClassFileStream* const cfs,
 259                                              u4 code_length,
 260                                              u2 max_locals,
 261                                              u4 code_attribute_length,
 262                                              u2* const localvariable_table_length,
 263                                              bool isLVTT,
 264                                              TRAPS);
 265 
 266   const unsafe_u2* parse_checked_exceptions(const ClassFileStream* const cfs,
 267                                             u2* const checked_exceptions_length,
 268                                             u4 method_attribute_length,
 269                                             TRAPS);
 270 
 271   void parse_type_array(u2 array_length,
 272                         u4 code_length,
 273                         u4* const u1_index,
 274                         u4* const u2_index,
 275                         u1* const u1_array,
 276                         u2* const u2_array,
 277                         TRAPS);
 278 
 279   // Classfile attribute parsing
 280   u2 parse_generic_signature_attribute(const ClassFileStream* const cfs, TRAPS);
 281   void parse_classfile_sourcefile_attribute(const ClassFileStream* const cfs, TRAPS);
 282   void parse_classfile_source_debug_extension_attribute(const ClassFileStream* const cfs,
 283                                                         int length,
 284                                                         TRAPS);
 285 
 286   u2   parse_classfile_inner_classes_attribute(const ClassFileStream* const cfs,


 448                            TRAPS);
 449 
 450   // Wrapper for constantTag.is_klass_[or_]reference.
 451   // In older versions of the VM, Klass*s cannot sneak into early phases of
 452   // constant pool construction, but in later versions they can.
 453   // %%% Let's phase out the old is_klass_reference.
 454   bool valid_klass_reference_at(int index) const {
 455     return _cp->is_within_bounds(index) &&
 456              _cp->tag_at(index).is_klass_or_reference();
 457   }
 458 
 459   // Checks that the cpool index is in range and is a utf8
 460   bool valid_symbol_at(int cpool_index) const {
 461     return _cp->is_within_bounds(cpool_index) &&
 462              _cp->tag_at(cpool_index).is_utf8();
 463   }
 464 
 465   void copy_localvariable_table(const ConstMethod* cm,
 466                                 int lvt_cnt,
 467                                 u2* const localvariable_table_length,
 468                                 const unsafe_u2** const localvariable_table_start,
 469                                 int lvtt_cnt,
 470                                 u2* const localvariable_type_table_length,
 471                                 const unsafe_u2** const localvariable_type_table_start,
 472                                 TRAPS);
 473 
 474   void copy_method_annotations(ConstMethod* cm,
 475                                const u1* runtime_visible_annotations,
 476                                int runtime_visible_annotations_length,
 477                                const u1* runtime_invisible_annotations,
 478                                int runtime_invisible_annotations_length,
 479                                const u1* runtime_visible_parameter_annotations,
 480                                int runtime_visible_parameter_annotations_length,
 481                                const u1* runtime_invisible_parameter_annotations,
 482                                int runtime_invisible_parameter_annotations_length,
 483                                const u1* runtime_visible_type_annotations,
 484                                int runtime_visible_type_annotations_length,
 485                                const u1* runtime_invisible_type_annotations,
 486                                int runtime_invisible_type_annotations_length,
 487                                const u1* annotation_default,
 488                                int annotation_default_length,
 489                                TRAPS);
 490 
 491   // lays out fields in class and returns the total oopmap count


< prev index next >