< prev index next >

src/hotspot/share/oops/fieldStreams.hpp

Print this page

 22  *
 23  */
 24 
 25 #ifndef SHARE_OOPS_FIELDSTREAMS_HPP
 26 #define SHARE_OOPS_FIELDSTREAMS_HPP
 27 
 28 #include "oops/instanceKlass.hpp"
 29 #include "oops/fieldInfo.hpp"
 30 #include "runtime/fieldDescriptor.hpp"
 31 
 32 // The is the base class for iteration over the fields array
 33 // describing the declared fields in the class.  Several subclasses
 34 // are provided depending on the kind of iteration required.  The
 35 // JavaFieldStream is for iterating over regular Java fields and it
 36 // generally the preferred iterator.  InternalFieldStream only
 37 // iterates over fields that have been injected by the JVM.
 38 // AllFieldStream exposes all fields and should only be used in rare
 39 // cases.
 40 // HierarchicalFieldStream allows to also iterate over fields of supertypes.
 41 class FieldStreamBase : public StackObj {

 42  protected:
 43   const Array<u1>*    _fieldinfo_stream;
 44   FieldInfoReader     _reader;
 45   constantPoolHandle  _constants;
 46   int                 _index;
 47   int                 _limit;
 48 
 49   FieldInfo           _fi_buf;
 50   fieldDescriptor     _fd_buf;
 51 
 52   FieldInfo const * field() const {
 53     assert(!done(), "no more fields");
 54     return &_fi_buf;
 55   }
 56 
 57   inline FieldStreamBase(const Array<u1>* fieldinfo_stream, ConstantPool* constants, int start, int limit);
 58 
 59   inline FieldStreamBase(Array<u1>* fieldinfo_stream, ConstantPool* constants);
 60 
 61   private:

 93   Symbol* name() const {
 94     return field()->name(_constants());
 95   }
 96 
 97   Symbol* signature() const {
 98     return field()->signature(_constants());
 99   }
100 
101   Symbol* generic_signature() const {
102     if (field()->field_flags().is_generic()) {
103       return _constants->symbol_at(field()->generic_signature_index());
104     } else {
105       return nullptr;
106     }
107   }
108 
109   int offset() const {
110     return field()->offset();
111   }
112 








113   bool is_contended() const {
114     return field()->is_contended();
115   }
116 
117   int contended_group() const {
118     return field()->contended_group();
119   }
120 
121   // Convenient methods
122 
123   FieldInfo to_FieldInfo() {
124     return _fi_buf;
125   }
126 
127   int num_total_fields() const {
128     return FieldInfoStream::num_total_fields(_fieldinfo_stream);
129   }
130 
131   // bridge to a heavier API:
132   fieldDescriptor& field_descriptor() const {

 22  *
 23  */
 24 
 25 #ifndef SHARE_OOPS_FIELDSTREAMS_HPP
 26 #define SHARE_OOPS_FIELDSTREAMS_HPP
 27 
 28 #include "oops/instanceKlass.hpp"
 29 #include "oops/fieldInfo.hpp"
 30 #include "runtime/fieldDescriptor.hpp"
 31 
 32 // The is the base class for iteration over the fields array
 33 // describing the declared fields in the class.  Several subclasses
 34 // are provided depending on the kind of iteration required.  The
 35 // JavaFieldStream is for iterating over regular Java fields and it
 36 // generally the preferred iterator.  InternalFieldStream only
 37 // iterates over fields that have been injected by the JVM.
 38 // AllFieldStream exposes all fields and should only be used in rare
 39 // cases.
 40 // HierarchicalFieldStream allows to also iterate over fields of supertypes.
 41 class FieldStreamBase : public StackObj {
 42 
 43  protected:
 44   const Array<u1>*    _fieldinfo_stream;
 45   FieldInfoReader     _reader;
 46   constantPoolHandle  _constants;
 47   int                 _index;
 48   int                 _limit;
 49 
 50   FieldInfo           _fi_buf;
 51   fieldDescriptor     _fd_buf;
 52 
 53   FieldInfo const * field() const {
 54     assert(!done(), "no more fields");
 55     return &_fi_buf;
 56   }
 57 
 58   inline FieldStreamBase(const Array<u1>* fieldinfo_stream, ConstantPool* constants, int start, int limit);
 59 
 60   inline FieldStreamBase(Array<u1>* fieldinfo_stream, ConstantPool* constants);
 61 
 62   private:

 94   Symbol* name() const {
 95     return field()->name(_constants());
 96   }
 97 
 98   Symbol* signature() const {
 99     return field()->signature(_constants());
100   }
101 
102   Symbol* generic_signature() const {
103     if (field()->field_flags().is_generic()) {
104       return _constants->symbol_at(field()->generic_signature_index());
105     } else {
106       return nullptr;
107     }
108   }
109 
110   int offset() const {
111     return field()->offset();
112   }
113 
114   bool is_null_free_inline_type() {
115     return field()->field_flags().is_null_free_inline_type();
116   }
117 
118   bool is_flat() {
119     return field()->field_flags().is_flat();
120   }
121 
122   bool is_contended() const {
123     return field()->is_contended();
124   }
125 
126   int contended_group() const {
127     return field()->contended_group();
128   }
129 
130   // Convenient methods
131 
132   FieldInfo to_FieldInfo() {
133     return _fi_buf;
134   }
135 
136   int num_total_fields() const {
137     return FieldInfoStream::num_total_fields(_fieldinfo_stream);
138   }
139 
140   // bridge to a heavier API:
141   fieldDescriptor& field_descriptor() const {
< prev index next >