99
100 // Lazy fields get filled in only upon request.
101 _super = NULL;
102 _java_mirror = NULL;
103
104 if (is_shared()) {
105 if (k != SystemDictionary::Object_klass()) {
106 super();
107 }
108 //compute_nonstatic_fields(); // done outside of constructor
109 }
110
111 _field_cache = NULL;
112 }
113
114 // Version for unloaded classes:
115 ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
116 jobject loader, jobject protection_domain)
117 : ciKlass(name, T_OBJECT)
118 {
119 assert(name->byte_at(0) != '[', "not an instance klass");
120 _init_state = (InstanceKlass::ClassState)0;
121 _nonstatic_field_size = -1;
122 _has_nonstatic_fields = false;
123 _nonstatic_fields = NULL;
124 _has_injected_fields = -1;
125 _is_unsafe_anonymous = false;
126 _loader = loader;
127 _protection_domain = protection_domain;
128 _is_shared = false;
129 _super = NULL;
130 _java_mirror = NULL;
131 _field_cache = NULL;
132 }
133
134
135
136 // ------------------------------------------------------------------
137 // ciInstanceKlass::compute_shared_is_initialized
138 void ciInstanceKlass::compute_shared_init_state() {
139 GUARDED_VM_ENTRY(
282 return is_in_package_impl(packagename, len);
283 )
284 }
285
286 bool ciInstanceKlass::is_in_package_impl(const char* packagename, int len) {
287 ASSERT_IN_VM;
288
289 // If packagename contains trailing '/' exclude it from the
290 // prefix-test since we test for it explicitly.
291 if (packagename[len - 1] == '/')
292 len--;
293
294 if (!name()->starts_with(packagename, len))
295 return false;
296
297 // Test if the class name is something like "java/lang".
298 if ((len + 1) > name()->utf8_length())
299 return false;
300
301 // Test for trailing '/'
302 if ((char) name()->byte_at(len) != '/')
303 return false;
304
305 // Make sure it's not actually in a subpackage:
306 if (name()->index_of_at(len+1, "/", 1) >= 0)
307 return false;
308
309 return true;
310 }
311
312 // ------------------------------------------------------------------
313 // ciInstanceKlass::print_impl
314 //
315 // Implementation of the print method.
316 void ciInstanceKlass::print_impl(outputStream* st) {
317 ciKlass::print_impl(st);
318 GUARDED_VM_ENTRY(st->print(" loader=" INTPTR_FORMAT, p2i((address)loader()));)
319 if (is_loaded()) {
320 st->print(" loaded=true initialized=%s finalized=%s subklass=%s size=%d flags=",
321 bool_to_str(is_initialized()),
322 bool_to_str(has_finalizer()),
|
99
100 // Lazy fields get filled in only upon request.
101 _super = NULL;
102 _java_mirror = NULL;
103
104 if (is_shared()) {
105 if (k != SystemDictionary::Object_klass()) {
106 super();
107 }
108 //compute_nonstatic_fields(); // done outside of constructor
109 }
110
111 _field_cache = NULL;
112 }
113
114 // Version for unloaded classes:
115 ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
116 jobject loader, jobject protection_domain)
117 : ciKlass(name, T_OBJECT)
118 {
119 assert(name->char_at(0) != '[', "not an instance klass");
120 _init_state = (InstanceKlass::ClassState)0;
121 _nonstatic_field_size = -1;
122 _has_nonstatic_fields = false;
123 _nonstatic_fields = NULL;
124 _has_injected_fields = -1;
125 _is_unsafe_anonymous = false;
126 _loader = loader;
127 _protection_domain = protection_domain;
128 _is_shared = false;
129 _super = NULL;
130 _java_mirror = NULL;
131 _field_cache = NULL;
132 }
133
134
135
136 // ------------------------------------------------------------------
137 // ciInstanceKlass::compute_shared_is_initialized
138 void ciInstanceKlass::compute_shared_init_state() {
139 GUARDED_VM_ENTRY(
282 return is_in_package_impl(packagename, len);
283 )
284 }
285
286 bool ciInstanceKlass::is_in_package_impl(const char* packagename, int len) {
287 ASSERT_IN_VM;
288
289 // If packagename contains trailing '/' exclude it from the
290 // prefix-test since we test for it explicitly.
291 if (packagename[len - 1] == '/')
292 len--;
293
294 if (!name()->starts_with(packagename, len))
295 return false;
296
297 // Test if the class name is something like "java/lang".
298 if ((len + 1) > name()->utf8_length())
299 return false;
300
301 // Test for trailing '/'
302 if (name()->char_at(len) != '/')
303 return false;
304
305 // Make sure it's not actually in a subpackage:
306 if (name()->index_of_at(len+1, "/", 1) >= 0)
307 return false;
308
309 return true;
310 }
311
312 // ------------------------------------------------------------------
313 // ciInstanceKlass::print_impl
314 //
315 // Implementation of the print method.
316 void ciInstanceKlass::print_impl(outputStream* st) {
317 ciKlass::print_impl(st);
318 GUARDED_VM_ENTRY(st->print(" loader=" INTPTR_FORMAT, p2i((address)loader()));)
319 if (is_loaded()) {
320 st->print(" loaded=true initialized=%s finalized=%s subklass=%s size=%d flags=",
321 bool_to_str(is_initialized()),
322 bool_to_str(has_finalizer()),
|