< prev index next >

src/share/vm/ci/ciInstanceKlass.hpp

Print this page




  48   jobject                _protection_domain;
  49 
  50   InstanceKlass::ClassState _init_state;           // state of class
  51   bool                   _is_shared;
  52   bool                   _has_finalizer;
  53   bool                   _has_subklass;
  54   bool                   _has_nonstatic_fields;
  55   bool                   _has_nonstatic_concrete_methods;
  56   bool                   _is_anonymous;
  57 
  58   ciFlags                _flags;
  59   jint                   _nonstatic_field_size;
  60   jint                   _nonstatic_oop_map_size;
  61 
  62   // Lazy fields get filled in only upon request.
  63   ciInstanceKlass*       _super;
  64   ciInstance*            _java_mirror;
  65 
  66   ciConstantPoolCache*   _field_cache;  // cached map index->field
  67   GrowableArray<ciField*>* _nonstatic_fields;
  68   int                    _nof_declared_nonstatic_fields; // Number of nonstatic fields declared in the bytecode
  69                                                          // i.e., without value types flattened into the instance.
  70 
  71   int                    _has_injected_fields; // any non static injected fields? lazily initialized.
  72 
  73   ciInstanceKlass*       _vcc_klass; // points to the value-capable class corresponding to the current derived value type class.
  74 
  75   // The possible values of the _implementor fall into following three cases:
  76   //   NULL: no implementor.
  77   //   A ciInstanceKlass that's not itself: one implementor.
  78   //   Itsef: more than one implementors.
  79   ciInstanceKlass*       _implementor;
  80 
  81   void compute_injected_fields();
  82   bool compute_injected_fields_helper();
  83 
  84 protected:
  85   ciInstanceKlass(Klass* k);
  86   ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain);
  87 
  88   InstanceKlass* get_instanceKlass() const {
  89     return InstanceKlass::cast(get_Klass());
  90   }
  91 
  92   oop loader();
  93   jobject loader_handle();
  94 
  95   oop protection_domain();
  96   jobject protection_domain_handle();
  97 
  98   const char* type_string() { return "ciInstanceKlass"; }
  99 
 100   bool is_in_package_impl(const char* packagename, int len);
 101 
 102   void print_impl(outputStream* st);
 103 
 104   ciConstantPoolCache* field_cache();
 105 
 106   bool is_shared() { return _is_shared; }
 107 
 108   void compute_shared_init_state();
 109   bool compute_shared_has_subklass();
 110   int  compute_nonstatic_fields();
 111   GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields);
 112 
 113   // Update the init_state for shared klasses
 114   void update_if_shared(InstanceKlass::ClassState expected) {
 115     if (_is_shared && _init_state != expected) {
 116       if (is_loaded()) compute_shared_init_state();
 117     }
 118   }
 119 
 120 public:
 121   // Has this klass been initialized?
 122   bool                   is_initialized() {
 123     update_if_shared(InstanceKlass::fully_initialized);
 124     return _init_state == InstanceKlass::fully_initialized;
 125   }
 126   // Is this klass being initialized?
 127   bool                   is_being_initialized() {
 128     update_if_shared(InstanceKlass::being_initialized);
 129     return _init_state == InstanceKlass::being_initialized;
 130   }
 131   // Has this klass been linked?


 178     } else {
 179       return 2;
 180     }
 181   }
 182   bool has_nonstatic_concrete_methods()  {
 183     assert(is_loaded(), "must be loaded");
 184     return _has_nonstatic_concrete_methods;
 185   }
 186 
 187   bool is_anonymous() {
 188     return _is_anonymous;
 189   }
 190 
 191   ciInstanceKlass* get_canonical_holder(int offset);
 192   ciField* get_field_by_offset(int field_offset, bool is_static);
 193   ciType*  get_field_type_by_offset(int field_offset);
 194   ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);
 195 
 196   // total number of nonstatic fields (including inherited):
 197   int nof_nonstatic_fields() {
 198     if (_nonstatic_fields == NULL)
 199       return compute_nonstatic_fields();
 200     else
 201       return _nonstatic_fields->length();
 202   }
 203 
 204   int nof_declared_nonstatic_fields() {
 205     if (_nonstatic_fields == NULL) {
 206       compute_nonstatic_fields();
 207     }
 208     assert(_nof_declared_nonstatic_fields >= 0, "after lazy initialization _nof_declared_nonstatic_fields must be at least 0");
 209     return _nof_declared_nonstatic_fields;
 210   }
 211 
 212   bool has_injected_fields() {
 213     if (_has_injected_fields == -1) {
 214       compute_injected_fields();
 215     }
 216     return _has_injected_fields > 0 ? true : false;
 217   }
 218 
 219   // nth nonstatic field (presented by ascending address)
 220   ciField* nonstatic_field_at(int i) {
 221     assert(_nonstatic_fields != NULL, "");
 222     return _nonstatic_fields->at(i);
 223   }
 224 
 225   ciInstanceKlass* unique_concrete_subklass();
 226   bool has_finalizable_subclass();
 227 
 228   bool contains_field_offset(int offset) {
 229     return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size(), is_valuetype());




  48   jobject                _protection_domain;
  49 
  50   InstanceKlass::ClassState _init_state;           // state of class
  51   bool                   _is_shared;
  52   bool                   _has_finalizer;
  53   bool                   _has_subklass;
  54   bool                   _has_nonstatic_fields;
  55   bool                   _has_nonstatic_concrete_methods;
  56   bool                   _is_anonymous;
  57 
  58   ciFlags                _flags;
  59   jint                   _nonstatic_field_size;
  60   jint                   _nonstatic_oop_map_size;
  61 
  62   // Lazy fields get filled in only upon request.
  63   ciInstanceKlass*       _super;
  64   ciInstance*            _java_mirror;
  65 
  66   ciConstantPoolCache*   _field_cache;  // cached map index->field
  67   GrowableArray<ciField*>* _nonstatic_fields;


  68 
  69   int                    _has_injected_fields; // any non static injected fields? lazily initialized.
  70 
  71   ciInstanceKlass*       _vcc_klass; // points to the value-capable class corresponding to the current derived value type class.
  72 
  73   // The possible values of the _implementor fall into following three cases:
  74   //   NULL: no implementor.
  75   //   A ciInstanceKlass that's not itself: one implementor.
  76   //   Itsef: more than one implementors.
  77   ciInstanceKlass*       _implementor;
  78 
  79   void compute_injected_fields();
  80   bool compute_injected_fields_helper();
  81 
  82 protected:
  83   ciInstanceKlass(Klass* k);
  84   ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain);
  85 
  86   InstanceKlass* get_instanceKlass() const {
  87     return InstanceKlass::cast(get_Klass());
  88   }
  89 
  90   oop loader();
  91   jobject loader_handle();
  92 
  93   oop protection_domain();
  94   jobject protection_domain_handle();
  95 
  96   const char* type_string() { return "ciInstanceKlass"; }
  97 
  98   bool is_in_package_impl(const char* packagename, int len);
  99 
 100   void print_impl(outputStream* st);
 101 
 102   ciConstantPoolCache* field_cache();
 103 
 104   bool is_shared() { return _is_shared; }
 105 
 106   void compute_shared_init_state();
 107   bool compute_shared_has_subklass();
 108   virtual int compute_nonstatic_fields();
 109   GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields, bool flatten = true);
 110 
 111   // Update the init_state for shared klasses
 112   void update_if_shared(InstanceKlass::ClassState expected) {
 113     if (_is_shared && _init_state != expected) {
 114       if (is_loaded()) compute_shared_init_state();
 115     }
 116   }
 117 
 118 public:
 119   // Has this klass been initialized?
 120   bool                   is_initialized() {
 121     update_if_shared(InstanceKlass::fully_initialized);
 122     return _init_state == InstanceKlass::fully_initialized;
 123   }
 124   // Is this klass being initialized?
 125   bool                   is_being_initialized() {
 126     update_if_shared(InstanceKlass::being_initialized);
 127     return _init_state == InstanceKlass::being_initialized;
 128   }
 129   // Has this klass been linked?


 176     } else {
 177       return 2;
 178     }
 179   }
 180   bool has_nonstatic_concrete_methods()  {
 181     assert(is_loaded(), "must be loaded");
 182     return _has_nonstatic_concrete_methods;
 183   }
 184 
 185   bool is_anonymous() {
 186     return _is_anonymous;
 187   }
 188 
 189   ciInstanceKlass* get_canonical_holder(int offset);
 190   ciField* get_field_by_offset(int field_offset, bool is_static);
 191   ciType*  get_field_type_by_offset(int field_offset);
 192   ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);
 193 
 194   // total number of nonstatic fields (including inherited):
 195   int nof_nonstatic_fields() {
 196     if (_nonstatic_fields == NULL) {
 197       return compute_nonstatic_fields();
 198     } else {
 199       return _nonstatic_fields->length();
 200     }







 201   }
 202 
 203   bool has_injected_fields() {
 204     if (_has_injected_fields == -1) {
 205       compute_injected_fields();
 206     }
 207     return _has_injected_fields > 0 ? true : false;
 208   }
 209 
 210   // nth nonstatic field (presented by ascending address)
 211   ciField* nonstatic_field_at(int i) {
 212     assert(_nonstatic_fields != NULL, "");
 213     return _nonstatic_fields->at(i);
 214   }
 215 
 216   ciInstanceKlass* unique_concrete_subklass();
 217   bool has_finalizable_subclass();
 218 
 219   bool contains_field_offset(int offset) {
 220     return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size(), is_valuetype());


< prev index next >