comparison src/share/vm/ci/ciInstanceKlass.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 49036505ab5f
children e522a00b91aa bd7a7ce2e264
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
25 #ifndef SHARE_VM_CI_CIINSTANCEKLASS_HPP 25 #ifndef SHARE_VM_CI_CIINSTANCEKLASS_HPP
26 #define SHARE_VM_CI_CIINSTANCEKLASS_HPP 26 #define SHARE_VM_CI_CIINSTANCEKLASS_HPP
27 27
28 #include "ci/ciConstantPoolCache.hpp" 28 #include "ci/ciConstantPoolCache.hpp"
29 #include "ci/ciFlags.hpp" 29 #include "ci/ciFlags.hpp"
30 #include "ci/ciInstanceKlassKlass.hpp"
31 #include "ci/ciKlass.hpp" 30 #include "ci/ciKlass.hpp"
32 #include "ci/ciSymbol.hpp" 31 #include "ci/ciSymbol.hpp"
33 32
34 // ciInstanceKlass 33 // ciInstanceKlass
35 // 34 //
36 // This class represents a klassOop in the HotSpot virtual machine 35 // This class represents a Klass* in the HotSpot virtual machine
37 // whose Klass part is an instanceKlass. It may or may not 36 // whose Klass part is an InstanceKlass. It may or may not
38 // be loaded. 37 // be loaded.
39 class ciInstanceKlass : public ciKlass { 38 class ciInstanceKlass : public ciKlass {
40 CI_PACKAGE_ACCESS 39 CI_PACKAGE_ACCESS
41 friend class ciBytecodeStream; 40 friend class ciBytecodeStream;
42 friend class ciEnv; 41 friend class ciEnv;
46 45
47 private: 46 private:
48 jobject _loader; 47 jobject _loader;
49 jobject _protection_domain; 48 jobject _protection_domain;
50 49
51 instanceKlass::ClassState _init_state; // state of class 50 InstanceKlass::ClassState _init_state; // state of class
52 bool _is_shared; 51 bool _is_shared;
53 bool _has_finalizer; 52 bool _has_finalizer;
54 bool _has_subklass; 53 bool _has_subklass;
55 bool _has_nonstatic_fields; 54 bool _has_nonstatic_fields;
56 55
75 74
76 protected: 75 protected:
77 ciInstanceKlass(KlassHandle h_k); 76 ciInstanceKlass(KlassHandle h_k);
78 ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain); 77 ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain);
79 78
80 instanceKlass* get_instanceKlass() const { 79 InstanceKlass* get_instanceKlass() const {
81 return (instanceKlass*)get_Klass(); 80 return (InstanceKlass*)get_Klass();
82 } 81 }
83 82
84 oop loader(); 83 oop loader();
85 jobject loader_handle(); 84 jobject loader_handle();
86 85
101 bool compute_shared_has_subklass(); 100 bool compute_shared_has_subklass();
102 int compute_nonstatic_fields(); 101 int compute_nonstatic_fields();
103 GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields); 102 GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields);
104 103
105 // Update the init_state for shared klasses 104 // Update the init_state for shared klasses
106 void update_if_shared(instanceKlass::ClassState expected) { 105 void update_if_shared(InstanceKlass::ClassState expected) {
107 if (_is_shared && _init_state != expected) { 106 if (_is_shared && _init_state != expected) {
108 if (is_loaded()) compute_shared_init_state(); 107 if (is_loaded()) compute_shared_init_state();
109 } 108 }
110 } 109 }
111 110
112 public: 111 public:
113 // Has this klass been initialized? 112 // Has this klass been initialized?
114 bool is_initialized() { 113 bool is_initialized() {
115 update_if_shared(instanceKlass::fully_initialized); 114 update_if_shared(InstanceKlass::fully_initialized);
116 return _init_state == instanceKlass::fully_initialized; 115 return _init_state == InstanceKlass::fully_initialized;
117 } 116 }
118 // Is this klass being initialized? 117 // Is this klass being initialized?
119 bool is_being_initialized() { 118 bool is_being_initialized() {
120 update_if_shared(instanceKlass::being_initialized); 119 update_if_shared(InstanceKlass::being_initialized);
121 return _init_state == instanceKlass::being_initialized; 120 return _init_state == InstanceKlass::being_initialized;
122 } 121 }
123 // Has this klass been linked? 122 // Has this klass been linked?
124 bool is_linked() { 123 bool is_linked() {
125 update_if_shared(instanceKlass::linked); 124 update_if_shared(InstanceKlass::linked);
126 return _init_state >= instanceKlass::linked; 125 return _init_state >= InstanceKlass::linked;
127 } 126 }
128 127
129 // General klass information. 128 // General klass information.
130 ciFlags flags() { 129 ciFlags flags() {
131 assert(is_loaded(), "must be loaded"); 130 assert(is_loaded(), "must be loaded");
218 ciInstanceKlass* implementor(); 217 ciInstanceKlass* implementor();
219 218
220 // Is the defining class loader of this class the default loader? 219 // Is the defining class loader of this class the default loader?
221 bool uses_default_loader(); 220 bool uses_default_loader();
222 221
223 bool is_java_lang_Object(); 222 bool is_java_lang_Object() const;
224 223
225 // Is this klass in the given package? 224 // Is this klass in the given package?
226 bool is_in_package(const char* packagename) { 225 bool is_in_package(const char* packagename) {
227 return is_in_package(packagename, (int) strlen(packagename)); 226 return is_in_package(packagename, (int) strlen(packagename));
228 } 227 }
229 bool is_in_package(const char* packagename, int len); 228 bool is_in_package(const char* packagename, int len);
230 229
231 // What kind of ciObject is this? 230 // What kind of ciObject is this?
232 bool is_instance_klass() { return true; } 231 bool is_instance_klass() const { return true; }
233 bool is_java_klass() { return true; } 232 bool is_java_klass() const { return true; }
234 }; 233 };
235 234
236 #endif // SHARE_VM_CI_CIINSTANCEKLASS_HPP 235 #endif // SHARE_VM_CI_CIINSTANCEKLASS_HPP