< prev index next >

src/hotspot/share/oops/instanceKlass.hpp

Print this page
rev 50604 : imported patch jep181-rev1
rev 50605 : imported patch jep181-rev2
rev 50606 : imported patch jep181-rev3


 148   Annotations*    _annotations;
 149   // Package this class is defined in
 150   PackageEntry*   _package_entry;
 151   // Array classes holding elements of this class.
 152   Klass* volatile _array_klasses;
 153   // Constant pool for this class.
 154   ConstantPool* _constants;
 155   // The InnerClasses attribute and EnclosingMethod attribute. The
 156   // _inner_classes is an array of shorts. If the class has InnerClasses
 157   // attribute, then the _inner_classes array begins with 4-tuples of shorts
 158   // [inner_class_info_index, outer_class_info_index,
 159   // inner_name_index, inner_class_access_flags] for the InnerClasses
 160   // attribute. If the EnclosingMethod attribute exists, it occupies the
 161   // last two shorts [class_index, method_index] of the array. If only
 162   // the InnerClasses attribute exists, the _inner_classes array length is
 163   // number_of_inner_classes * 4. If the class has both InnerClasses
 164   // and EnclosingMethod attributes the _inner_classes array length is
 165   // number_of_inner_classes * 4 + enclosing_method_attribute_size.
 166   Array<jushort>* _inner_classes;
 167 













 168   // the source debug extension for this klass, NULL if not specified.
 169   // Specified as UTF-8 string without terminating zero byte in the classfile,
 170   // it is stored in the instanceklass as a NULL-terminated UTF-8 string
 171   const char*     _source_debug_extension;
 172   // Array name derived from this class which needs unreferencing
 173   // if this class is unloaded.
 174   Symbol*         _array_name;
 175 
 176   // Number of heapOopSize words used by non-static fields in this klass
 177   // (including inherited fields but after header_size()).
 178   int             _nonstatic_field_size;
 179   int             _static_field_size;    // number words used by static fields (oop and non-oop) in this klass
 180   // Constant pool index to the utf8 entry of the Generic signature,
 181   // or 0 if none.
 182   u2              _generic_signature_index;
 183   // Constant pool index to the utf8 entry for the name of source file
 184   // containing this klass, 0 if not specified.
 185   u2              _source_file_name_index;
 186   u2              _static_oop_field_count;// number of static oop fields in this klass
 187   u2              _java_fields_count;    // The number of declared Java fields


 418  public:
 419   int     field_offset      (int index) const { return field(index)->offset(); }
 420   int     field_access_flags(int index) const { return field(index)->access_flags(); }
 421   Symbol* field_name        (int index) const { return field(index)->name(constants()); }
 422   Symbol* field_signature   (int index) const { return field(index)->signature(constants()); }
 423 
 424   // Number of Java declared fields
 425   int java_fields_count() const           { return (int)_java_fields_count; }
 426 
 427   Array<u2>* fields() const            { return _fields; }
 428   void set_fields(Array<u2>* f, u2 java_fields_count) {
 429     guarantee(_fields == NULL || f == NULL, "Just checking");
 430     _fields = f;
 431     _java_fields_count = java_fields_count;
 432   }
 433 
 434   // inner classes
 435   Array<u2>* inner_classes() const       { return _inner_classes; }
 436   void set_inner_classes(Array<u2>* f)   { _inner_classes = f; }
 437 


















 438   enum InnerClassAttributeOffset {
 439     // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814
 440     inner_class_inner_class_info_offset = 0,
 441     inner_class_outer_class_info_offset = 1,
 442     inner_class_inner_name_offset = 2,
 443     inner_class_access_flags_offset = 3,
 444     inner_class_next_offset = 4
 445   };
 446 
 447   enum EnclosingMethodAttributeOffset {
 448     enclosing_method_class_index_offset = 0,
 449     enclosing_method_method_index_offset = 1,
 450     enclosing_method_attribute_size = 2
 451   };
 452 
 453   // method override check
 454   bool is_override(const methodHandle& super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS);
 455 
 456   // package
 457   PackageEntry* package() const     { return _package_entry; }


 537   // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
 538   Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
 539   // find instance or static fields according to JVM spec 5.4.3.2, returns the klass in which the field is defined
 540   Klass* find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const;
 541 
 542   // find a non-static or static field given its offset within the class.
 543   bool contains_field_offset(int offset) {
 544     return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size());
 545   }
 546 
 547   bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
 548   bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
 549 
 550   // find a local method (returns NULL if not found)
 551   Method* find_method(const Symbol* name, const Symbol* signature) const;
 552   static Method* find_method(const Array<Method*>* methods,
 553                              const Symbol* name,
 554                              const Symbol* signature);
 555 
 556   // find a local method, but skip static methods
 557   Method* find_instance_method(const Symbol* name, const Symbol* signature) const;

 558   static Method* find_instance_method(const Array<Method*>* methods,
 559                                       const Symbol* name,
 560                                       const Symbol* signature);

 561 
 562   // find a local method (returns NULL if not found)
 563   Method* find_local_method(const Symbol* name,
 564                             const Symbol* signature,
 565                             OverpassLookupMode overpass_mode,
 566                             StaticLookupMode static_mode,
 567                             PrivateLookupMode private_mode) const;
 568 
 569   // find a local method from given methods array (returns NULL if not found)
 570   static Method* find_local_method(const Array<Method*>* methods,
 571                                    const Symbol* name,
 572                                    const Symbol* signature,
 573                                    OverpassLookupMode overpass_mode,
 574                                    StaticLookupMode static_mode,
 575                                    PrivateLookupMode private_mode);
 576 
 577   // find a local method index in methods or default_methods (returns -1 if not found)
 578   static int find_method_index(const Array<Method*>* methods,
 579                                const Symbol* name,
 580                                const Symbol* signature,
 581                                OverpassLookupMode overpass_mode,
 582                                StaticLookupMode static_mode,
 583                                PrivateLookupMode private_mode);
 584 
 585   // lookup operation (returns NULL if not found)
 586   Method* uncached_lookup_method(const Symbol* name,
 587                                  const Symbol* signature,
 588                                  OverpassLookupMode overpass_mode) const;

 589 
 590   // lookup a method in all the interfaces that this class implements
 591   // (returns NULL if not found)
 592   Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature, DefaultsLookupMode defaults_mode) const;
 593 
 594   // lookup a method in local defaults then in all interfaces
 595   // (returns NULL if not found)
 596   Method* lookup_method_in_ordered_interfaces(Symbol* name, Symbol* signature) const;
 597 
 598   // Find method indices by name.  If a method with the specified name is
 599   // found the index to the first method is returned, and 'end' is filled in
 600   // with the index of first non-name-matching method.  If no method is found
 601   // -1 is returned.
 602   int find_method_by_name(const Symbol* name, int* end) const;
 603   static int find_method_by_name(const Array<Method*>* methods,
 604                                  const Symbol* name, int* end);
 605 
 606   // constant pool
 607   ConstantPool* constants() const        { return _constants; }
 608   void set_constants(ConstantPool* c)    { _constants = c; }




 148   Annotations*    _annotations;
 149   // Package this class is defined in
 150   PackageEntry*   _package_entry;
 151   // Array classes holding elements of this class.
 152   Klass* volatile _array_klasses;
 153   // Constant pool for this class.
 154   ConstantPool* _constants;
 155   // The InnerClasses attribute and EnclosingMethod attribute. The
 156   // _inner_classes is an array of shorts. If the class has InnerClasses
 157   // attribute, then the _inner_classes array begins with 4-tuples of shorts
 158   // [inner_class_info_index, outer_class_info_index,
 159   // inner_name_index, inner_class_access_flags] for the InnerClasses
 160   // attribute. If the EnclosingMethod attribute exists, it occupies the
 161   // last two shorts [class_index, method_index] of the array. If only
 162   // the InnerClasses attribute exists, the _inner_classes array length is
 163   // number_of_inner_classes * 4. If the class has both InnerClasses
 164   // and EnclosingMethod attributes the _inner_classes array length is
 165   // number_of_inner_classes * 4 + enclosing_method_attribute_size.
 166   Array<jushort>* _inner_classes;
 167 
 168   // The NestMembers attribute. An array of shorts, where each is a
 169   // class info index for the class that is a nest member. This data
 170   // has not been validated.
 171   Array<jushort>* _nest_members;
 172 
 173   // The NestHost attribute. The class info index for the class
 174   // that is the nest-host of this class. This data has not been validated.
 175   jushort _nest_host_index;
 176 
 177   // Resolved nest-host klass: either true nest-host or self if we are not nested.
 178   // By always being set it makes nest-member access checks simpler.
 179   InstanceKlass* _nest_host;
 180 
 181   // the source debug extension for this klass, NULL if not specified.
 182   // Specified as UTF-8 string without terminating zero byte in the classfile,
 183   // it is stored in the instanceklass as a NULL-terminated UTF-8 string
 184   const char*     _source_debug_extension;
 185   // Array name derived from this class which needs unreferencing
 186   // if this class is unloaded.
 187   Symbol*         _array_name;
 188 
 189   // Number of heapOopSize words used by non-static fields in this klass
 190   // (including inherited fields but after header_size()).
 191   int             _nonstatic_field_size;
 192   int             _static_field_size;    // number words used by static fields (oop and non-oop) in this klass
 193   // Constant pool index to the utf8 entry of the Generic signature,
 194   // or 0 if none.
 195   u2              _generic_signature_index;
 196   // Constant pool index to the utf8 entry for the name of source file
 197   // containing this klass, 0 if not specified.
 198   u2              _source_file_name_index;
 199   u2              _static_oop_field_count;// number of static oop fields in this klass
 200   u2              _java_fields_count;    // The number of declared Java fields


 431  public:
 432   int     field_offset      (int index) const { return field(index)->offset(); }
 433   int     field_access_flags(int index) const { return field(index)->access_flags(); }
 434   Symbol* field_name        (int index) const { return field(index)->name(constants()); }
 435   Symbol* field_signature   (int index) const { return field(index)->signature(constants()); }
 436 
 437   // Number of Java declared fields
 438   int java_fields_count() const           { return (int)_java_fields_count; }
 439 
 440   Array<u2>* fields() const            { return _fields; }
 441   void set_fields(Array<u2>* f, u2 java_fields_count) {
 442     guarantee(_fields == NULL || f == NULL, "Just checking");
 443     _fields = f;
 444     _java_fields_count = java_fields_count;
 445   }
 446 
 447   // inner classes
 448   Array<u2>* inner_classes() const       { return _inner_classes; }
 449   void set_inner_classes(Array<u2>* f)   { _inner_classes = f; }
 450 
 451   // nest members
 452   Array<u2>* nest_members() const     { return _nest_members; }
 453   void set_nest_members(Array<u2>* m) { _nest_members = m; }
 454 
 455   // nest-host index
 456   jushort nest_host_index() const { return _nest_host_index; }
 457   void set_nest_host_index(u2 i)  { _nest_host_index = i; }
 458 
 459 private:
 460   // Called to verify that k is a member of this nest - does not look at k's nest-host
 461   bool has_nest_member(InstanceKlass* k, TRAPS) const;
 462 public:
 463   // Returns nest-host class, resolving and validating it if needed
 464   // Returns NULL if an exception occurs during loading, or validation fails
 465   InstanceKlass* nest_host(Symbol* validationException, TRAPS);
 466   // Check if this klass is a nestmate of k - resolves this nest-host and k's
 467   bool has_nestmate_access_to(InstanceKlass* k, TRAPS);
 468 
 469   enum InnerClassAttributeOffset {
 470     // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814
 471     inner_class_inner_class_info_offset = 0,
 472     inner_class_outer_class_info_offset = 1,
 473     inner_class_inner_name_offset = 2,
 474     inner_class_access_flags_offset = 3,
 475     inner_class_next_offset = 4
 476   };
 477 
 478   enum EnclosingMethodAttributeOffset {
 479     enclosing_method_class_index_offset = 0,
 480     enclosing_method_method_index_offset = 1,
 481     enclosing_method_attribute_size = 2
 482   };
 483 
 484   // method override check
 485   bool is_override(const methodHandle& super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS);
 486 
 487   // package
 488   PackageEntry* package() const     { return _package_entry; }


 568   // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
 569   Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
 570   // find instance or static fields according to JVM spec 5.4.3.2, returns the klass in which the field is defined
 571   Klass* find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const;
 572 
 573   // find a non-static or static field given its offset within the class.
 574   bool contains_field_offset(int offset) {
 575     return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size());
 576   }
 577 
 578   bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
 579   bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
 580 
 581   // find a local method (returns NULL if not found)
 582   Method* find_method(const Symbol* name, const Symbol* signature) const;
 583   static Method* find_method(const Array<Method*>* methods,
 584                              const Symbol* name,
 585                              const Symbol* signature);
 586 
 587   // find a local method, but skip static methods
 588   Method* find_instance_method(const Symbol* name, const Symbol* signature,
 589                                PrivateLookupMode private_mode = find_private) const;
 590   static Method* find_instance_method(const Array<Method*>* methods,
 591                                       const Symbol* name,
 592                                       const Symbol* signature,
 593                                       PrivateLookupMode private_mode = find_private);
 594 
 595   // find a local method (returns NULL if not found)
 596   Method* find_local_method(const Symbol* name,
 597                             const Symbol* signature,
 598                             OverpassLookupMode overpass_mode,
 599                             StaticLookupMode static_mode,
 600                             PrivateLookupMode private_mode) const;
 601 
 602   // find a local method from given methods array (returns NULL if not found)
 603   static Method* find_local_method(const Array<Method*>* methods,
 604                                    const Symbol* name,
 605                                    const Symbol* signature,
 606                                    OverpassLookupMode overpass_mode,
 607                                    StaticLookupMode static_mode,
 608                                    PrivateLookupMode private_mode);
 609 
 610   // find a local method index in methods or default_methods (returns -1 if not found)
 611   static int find_method_index(const Array<Method*>* methods,
 612                                const Symbol* name,
 613                                const Symbol* signature,
 614                                OverpassLookupMode overpass_mode,
 615                                StaticLookupMode static_mode,
 616                                PrivateLookupMode private_mode);
 617 
 618   // lookup operation (returns NULL if not found)
 619   Method* uncached_lookup_method(const Symbol* name,
 620                                  const Symbol* signature,
 621                                  OverpassLookupMode overpass_mode,
 622                                  PrivateLookupMode private_mode = find_private) const;
 623 
 624   // lookup a method in all the interfaces that this class implements
 625   // (returns NULL if not found)
 626   Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature, DefaultsLookupMode defaults_mode) const;
 627 
 628   // lookup a method in local defaults then in all interfaces
 629   // (returns NULL if not found)
 630   Method* lookup_method_in_ordered_interfaces(Symbol* name, Symbol* signature) const;
 631 
 632   // Find method indices by name.  If a method with the specified name is
 633   // found the index to the first method is returned, and 'end' is filled in
 634   // with the index of first non-name-matching method.  If no method is found
 635   // -1 is returned.
 636   int find_method_by_name(const Symbol* name, int* end) const;
 637   static int find_method_by_name(const Array<Method*>* methods,
 638                                  const Symbol* name, int* end);
 639 
 640   // constant pool
 641   ConstantPool* constants() const        { return _constants; }
 642   void set_constants(ConstantPool* c)    { _constants = c; }


< prev index next >