< prev index next >

src/hotspot/share/ci/ciInstanceKlass.hpp

Print this page

 27 
 28 #include "ci/ciConstantPoolCache.hpp"
 29 #include "ci/ciFlags.hpp"
 30 #include "ci/ciKlass.hpp"
 31 #include "ci/ciSymbol.hpp"
 32 #include "oops/instanceKlass.hpp"
 33 
 34 // ciInstanceKlass
 35 //
 36 // This class represents a Klass* in the HotSpot virtual machine
 37 // whose Klass part is an InstanceKlass.  It may or may not
 38 // be loaded.
 39 class ciInstanceKlass : public ciKlass {
 40   CI_PACKAGE_ACCESS
 41   friend class ciBytecodeStream;
 42   friend class ciEnv;
 43   friend class ciExceptionHandler;
 44   friend class ciMethod;
 45   friend class ciField;
 46   friend class ciReplay;

 47 
 48 private:
 49   enum SubklassValue { subklass_unknown, subklass_false, subklass_true };
 50 
 51   jobject                _loader;
 52   jobject                _protection_domain;
 53 
 54   InstanceKlass::ClassState _init_state;           // state of class
 55   bool                   _is_shared;
 56   bool                   _has_finalizer;
 57   SubklassValue          _has_subklass;
 58   bool                   _has_nonstatic_fields;
 59   bool                   _has_nonstatic_concrete_methods;
 60   bool                   _is_hidden;
 61   bool                   _is_record;
 62   bool                   _has_trusted_loader;
 63 
 64   ciFlags                _flags;
 65 
 66   // Lazy fields get filled in only upon request.

102 
103   void print_impl(outputStream* st);
104 
105   ciConstantPoolCache* field_cache();
106 
107   bool is_shared() { return _is_shared; }
108 
109   void compute_shared_init_state();
110   bool compute_shared_has_subklass();
111   int  compute_nonstatic_fields();
112   GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields);
113   bool compute_has_trusted_loader();
114 
115   // Update the init_state for shared klasses
116   void update_if_shared(InstanceKlass::ClassState expected) {
117     if (_is_shared && _init_state != expected) {
118       if (is_loaded()) compute_shared_init_state();
119     }
120   }
121 


122 public:
123   // Has this klass been initialized?
124   bool                   is_initialized() {
125     update_if_shared(InstanceKlass::fully_initialized);
126     return _init_state == InstanceKlass::fully_initialized;
127   }
128   bool                   is_not_initialized() {
129     update_if_shared(InstanceKlass::fully_initialized);
130     return _init_state < InstanceKlass::being_initialized;
131   }
132   // Is this klass being initialized?
133   bool                   is_being_initialized() {
134     update_if_shared(InstanceKlass::being_initialized);
135     return _init_state == InstanceKlass::being_initialized;
136   }
137   // Has this klass been linked?
138   bool                   is_linked() {
139     update_if_shared(InstanceKlass::linked);
140     return _init_state >= InstanceKlass::linked;
141   }

 27 
 28 #include "ci/ciConstantPoolCache.hpp"
 29 #include "ci/ciFlags.hpp"
 30 #include "ci/ciKlass.hpp"
 31 #include "ci/ciSymbol.hpp"
 32 #include "oops/instanceKlass.hpp"
 33 
 34 // ciInstanceKlass
 35 //
 36 // This class represents a Klass* in the HotSpot virtual machine
 37 // whose Klass part is an InstanceKlass.  It may or may not
 38 // be loaded.
 39 class ciInstanceKlass : public ciKlass {
 40   CI_PACKAGE_ACCESS
 41   friend class ciBytecodeStream;
 42   friend class ciEnv;
 43   friend class ciExceptionHandler;
 44   friend class ciMethod;
 45   friend class ciField;
 46   friend class ciReplay;
 47   friend class CompileTrainingData;
 48 
 49 private:
 50   enum SubklassValue { subklass_unknown, subklass_false, subklass_true };
 51 
 52   jobject                _loader;
 53   jobject                _protection_domain;
 54 
 55   InstanceKlass::ClassState _init_state;           // state of class
 56   bool                   _is_shared;
 57   bool                   _has_finalizer;
 58   SubklassValue          _has_subklass;
 59   bool                   _has_nonstatic_fields;
 60   bool                   _has_nonstatic_concrete_methods;
 61   bool                   _is_hidden;
 62   bool                   _is_record;
 63   bool                   _has_trusted_loader;
 64 
 65   ciFlags                _flags;
 66 
 67   // Lazy fields get filled in only upon request.

103 
104   void print_impl(outputStream* st);
105 
106   ciConstantPoolCache* field_cache();
107 
108   bool is_shared() { return _is_shared; }
109 
110   void compute_shared_init_state();
111   bool compute_shared_has_subklass();
112   int  compute_nonstatic_fields();
113   GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields);
114   bool compute_has_trusted_loader();
115 
116   // Update the init_state for shared klasses
117   void update_if_shared(InstanceKlass::ClassState expected) {
118     if (_is_shared && _init_state != expected) {
119       if (is_loaded()) compute_shared_init_state();
120     }
121   }
122 
123   static InstanceKlass::ClassState compute_init_state(InstanceKlass* ik);
124 
125 public:
126   // Has this klass been initialized?
127   bool                   is_initialized() {
128     update_if_shared(InstanceKlass::fully_initialized);
129     return _init_state == InstanceKlass::fully_initialized;
130   }
131   bool                   is_not_initialized() {
132     update_if_shared(InstanceKlass::fully_initialized);
133     return _init_state < InstanceKlass::being_initialized;
134   }
135   // Is this klass being initialized?
136   bool                   is_being_initialized() {
137     update_if_shared(InstanceKlass::being_initialized);
138     return _init_state == InstanceKlass::being_initialized;
139   }
140   // Has this klass been linked?
141   bool                   is_linked() {
142     update_if_shared(InstanceKlass::linked);
143     return _init_state >= InstanceKlass::linked;
144   }
< prev index next >