26
27 #include "ci/ciConstantPoolCache.hpp"
28 #include "ci/ciFlags.hpp"
29 #include "ci/ciKlass.hpp"
30 #include "ci/ciSymbol.hpp"
31
32 // ciInstanceKlass
33 //
34 // This class represents a Klass* in the HotSpot virtual machine
35 // whose Klass part is an InstanceKlass. It may or may not
36 // be loaded.
37 class ciInstanceKlass : public ciKlass {
38 CI_PACKAGE_ACCESS
39 friend class ciBytecodeStream;
40 friend class ciEnv;
41 friend class ciExceptionHandler;
42 friend class ciMethod;
43 friend class ciField;
44
45 private:
46 jobject _loader;
47 jobject _protection_domain;
48
49 InstanceKlass::ClassState _init_state; // state of class
50 bool _is_shared;
51 bool _has_finalizer;
52 bool _has_subklass;
53 bool _has_nonstatic_fields;
54 bool _has_nonstatic_concrete_methods;
55 bool _is_unsafe_anonymous;
56
57 ciFlags _flags;
58 jint _nonstatic_field_size;
59 jint _nonstatic_oop_map_size;
60
61 // Lazy fields get filled in only upon request.
62 ciInstanceKlass* _super;
63 ciInstance* _java_mirror;
64
65 ciConstantPoolCache* _field_cache; // cached map index->field
66 GrowableArray<ciField*>* _nonstatic_fields;
67 int _has_injected_fields; // any non static injected fields? lazily initialized.
68
69 // The possible values of the _implementor fall into following three cases:
70 // NULL: no implementor.
71 // A ciInstanceKlass that's not itself: one implementor.
|
26
27 #include "ci/ciConstantPoolCache.hpp"
28 #include "ci/ciFlags.hpp"
29 #include "ci/ciKlass.hpp"
30 #include "ci/ciSymbol.hpp"
31
32 // ciInstanceKlass
33 //
34 // This class represents a Klass* in the HotSpot virtual machine
35 // whose Klass part is an InstanceKlass. It may or may not
36 // be loaded.
37 class ciInstanceKlass : public ciKlass {
38 CI_PACKAGE_ACCESS
39 friend class ciBytecodeStream;
40 friend class ciEnv;
41 friend class ciExceptionHandler;
42 friend class ciMethod;
43 friend class ciField;
44
45 private:
46 enum SubklassValue { subklass_unknown, subklass_false, subklass_true };
47
48 jobject _loader;
49 jobject _protection_domain;
50
51 InstanceKlass::ClassState _init_state; // state of class
52 bool _is_shared;
53 bool _has_finalizer;
54 SubklassValue _has_subklass;
55 bool _has_nonstatic_fields;
56 bool _has_nonstatic_concrete_methods;
57 bool _is_unsafe_anonymous;
58
59 ciFlags _flags;
60 jint _nonstatic_field_size;
61 jint _nonstatic_oop_map_size;
62
63 // Lazy fields get filled in only upon request.
64 ciInstanceKlass* _super;
65 ciInstance* _java_mirror;
66
67 ciConstantPoolCache* _field_cache; // cached map index->field
68 GrowableArray<ciField*>* _nonstatic_fields;
69 int _has_injected_fields; // any non static injected fields? lazily initialized.
70
71 // The possible values of the _implementor fall into following three cases:
72 // NULL: no implementor.
73 // A ciInstanceKlass that's not itself: one implementor.
|
121 bool is_being_initialized() {
122 update_if_shared(InstanceKlass::being_initialized);
123 return _init_state == InstanceKlass::being_initialized;
124 }
125 // Has this klass been linked?
126 bool is_linked() {
127 update_if_shared(InstanceKlass::linked);
128 return _init_state >= InstanceKlass::linked;
129 }
130
131 // General klass information.
132 ciFlags flags() {
133 assert(is_loaded(), "must be loaded");
134 return _flags;
135 }
136 bool has_finalizer() {
137 assert(is_loaded(), "must be loaded");
138 return _has_finalizer; }
139 bool has_subklass() {
140 assert(is_loaded(), "must be loaded");
141 if (_is_shared && !_has_subklass) {
142 if (flags().is_final()) {
143 return false;
144 } else {
145 return compute_shared_has_subklass();
146 }
147 }
148 return _has_subklass;
149 }
150 jint size_helper() {
151 return (Klass::layout_helper_size_in_bytes(layout_helper())
152 >> LogHeapWordSize);
153 }
154 jint nonstatic_field_size() {
155 assert(is_loaded(), "must be loaded");
156 return _nonstatic_field_size; }
157 jint has_nonstatic_fields() {
158 assert(is_loaded(), "must be loaded");
159 return _has_nonstatic_fields; }
160 jint nonstatic_oop_map_size() {
161 assert(is_loaded(), "must be loaded");
162 return _nonstatic_oop_map_size; }
163 ciInstanceKlass* super();
164 jint nof_implementors() {
165 ciInstanceKlass* impl;
166 assert(is_loaded(), "must be loaded");
167 impl = implementor();
|
123 bool is_being_initialized() {
124 update_if_shared(InstanceKlass::being_initialized);
125 return _init_state == InstanceKlass::being_initialized;
126 }
127 // Has this klass been linked?
128 bool is_linked() {
129 update_if_shared(InstanceKlass::linked);
130 return _init_state >= InstanceKlass::linked;
131 }
132
133 // General klass information.
134 ciFlags flags() {
135 assert(is_loaded(), "must be loaded");
136 return _flags;
137 }
138 bool has_finalizer() {
139 assert(is_loaded(), "must be loaded");
140 return _has_finalizer; }
141 bool has_subklass() {
142 assert(is_loaded(), "must be loaded");
143 if (_has_subklass == subklass_unknown ||
144 (_is_shared && _has_subklass == subklass_false)) {
145 if (flags().is_final()) {
146 return false;
147 } else {
148 return compute_shared_has_subklass();
149 }
150 }
151 return _has_subklass == subklass_true;
152 }
153 jint size_helper() {
154 return (Klass::layout_helper_size_in_bytes(layout_helper())
155 >> LogHeapWordSize);
156 }
157 jint nonstatic_field_size() {
158 assert(is_loaded(), "must be loaded");
159 return _nonstatic_field_size; }
160 jint has_nonstatic_fields() {
161 assert(is_loaded(), "must be loaded");
162 return _has_nonstatic_fields; }
163 jint nonstatic_oop_map_size() {
164 assert(is_loaded(), "must be loaded");
165 return _nonstatic_oop_map_size; }
166 ciInstanceKlass* super();
167 jint nof_implementors() {
168 ciInstanceKlass* impl;
169 assert(is_loaded(), "must be loaded");
170 impl = implementor();
|