src/share/vm/ci/ciInstanceKlass.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7017732_incremental Sdiff src/share/vm/ci

src/share/vm/ci/ciInstanceKlass.cpp

Print this page




  68     _loader = JNIHandles::make_local(thread, ik->class_loader());
  69     _protection_domain = JNIHandles::make_local(thread,
  70                                                 ik->protection_domain());
  71     _is_shared = false;
  72   } else {
  73     Handle h_loader(thread, ik->class_loader());
  74     Handle h_protection_domain(thread, ik->protection_domain());
  75     _loader = JNIHandles::make_global(h_loader);
  76     _protection_domain = JNIHandles::make_global(h_protection_domain);
  77     _is_shared = true;
  78   }
  79 
  80   // Lazy fields get filled in only upon request.
  81   _super  = NULL;
  82   _java_mirror = NULL;
  83 
  84   if (is_shared()) {
  85     if (h_k() != SystemDictionary::Object_klass()) {
  86       super();
  87     }
  88     java_mirror();
  89     //compute_nonstatic_fields();  // done outside of constructor
  90   }
  91 
  92   _field_cache = NULL;
  93 }
  94 
  95 // Version for unloaded classes:
  96 ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
  97                                  jobject loader, jobject protection_domain)
  98   : ciKlass(name, ciInstanceKlassKlass::make())
  99 {
 100   assert(name->byte_at(0) != '[', "not an instance klass");
 101   _init_state = (instanceKlass::ClassState)0;
 102   _nonstatic_field_size = -1;
 103   _has_nonstatic_fields = false;
 104   _nonstatic_fields = NULL;
 105   _nof_implementors = -1;
 106   _loader = loader;
 107   _protection_domain = protection_domain;
 108   _is_shared = false;


 303 // ciInstanceKlass::super
 304 //
 305 // Get the superklass of this klass.
 306 ciInstanceKlass* ciInstanceKlass::super() {
 307   assert(is_loaded(), "must be loaded");
 308   if (_super == NULL && !is_java_lang_Object()) {
 309     GUARDED_VM_ENTRY(
 310       klassOop super_klass = get_instanceKlass()->super();
 311       _super = CURRENT_ENV->get_object(super_klass)->as_instance_klass();
 312     )
 313   }
 314   return _super;
 315 }
 316 
 317 // ------------------------------------------------------------------
 318 // ciInstanceKlass::java_mirror
 319 //
 320 // Get the instance of java.lang.Class corresponding to this klass.
 321 // Cache it on this->_java_mirror.
 322 ciInstance* ciInstanceKlass::java_mirror() {



 323   if (_java_mirror == NULL) {
 324     _java_mirror = ciKlass::java_mirror();
 325   }
 326   return _java_mirror;
 327 }
 328 
 329 // ------------------------------------------------------------------
 330 // ciInstanceKlass::unique_concrete_subklass
 331 ciInstanceKlass* ciInstanceKlass::unique_concrete_subklass() {
 332   if (!is_loaded())     return NULL; // No change if class is not loaded
 333   if (!is_abstract())   return NULL; // Only applies to abstract classes.
 334   if (!has_subklass())  return NULL; // Must have at least one subklass.
 335   VM_ENTRY_MARK;
 336   instanceKlass* ik = get_instanceKlass();
 337   Klass* up = ik->up_cast_abstract();
 338   assert(up->oop_is_instance(), "must be instanceKlass");
 339   if (ik == up) {
 340     return NULL;
 341   }
 342   return CURRENT_THREAD_ENV->get_object(up->as_klassOop())->as_instance_klass();




  68     _loader = JNIHandles::make_local(thread, ik->class_loader());
  69     _protection_domain = JNIHandles::make_local(thread,
  70                                                 ik->protection_domain());
  71     _is_shared = false;
  72   } else {
  73     Handle h_loader(thread, ik->class_loader());
  74     Handle h_protection_domain(thread, ik->protection_domain());
  75     _loader = JNIHandles::make_global(h_loader);
  76     _protection_domain = JNIHandles::make_global(h_protection_domain);
  77     _is_shared = true;
  78   }
  79 
  80   // Lazy fields get filled in only upon request.
  81   _super  = NULL;
  82   _java_mirror = NULL;
  83 
  84   if (is_shared()) {
  85     if (h_k() != SystemDictionary::Object_klass()) {
  86       super();
  87     }

  88     //compute_nonstatic_fields();  // done outside of constructor
  89   }
  90 
  91   _field_cache = NULL;
  92 }
  93 
  94 // Version for unloaded classes:
  95 ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
  96                                  jobject loader, jobject protection_domain)
  97   : ciKlass(name, ciInstanceKlassKlass::make())
  98 {
  99   assert(name->byte_at(0) != '[', "not an instance klass");
 100   _init_state = (instanceKlass::ClassState)0;
 101   _nonstatic_field_size = -1;
 102   _has_nonstatic_fields = false;
 103   _nonstatic_fields = NULL;
 104   _nof_implementors = -1;
 105   _loader = loader;
 106   _protection_domain = protection_domain;
 107   _is_shared = false;


 302 // ciInstanceKlass::super
 303 //
 304 // Get the superklass of this klass.
 305 ciInstanceKlass* ciInstanceKlass::super() {
 306   assert(is_loaded(), "must be loaded");
 307   if (_super == NULL && !is_java_lang_Object()) {
 308     GUARDED_VM_ENTRY(
 309       klassOop super_klass = get_instanceKlass()->super();
 310       _super = CURRENT_ENV->get_object(super_klass)->as_instance_klass();
 311     )
 312   }
 313   return _super;
 314 }
 315 
 316 // ------------------------------------------------------------------
 317 // ciInstanceKlass::java_mirror
 318 //
 319 // Get the instance of java.lang.Class corresponding to this klass.
 320 // Cache it on this->_java_mirror.
 321 ciInstance* ciInstanceKlass::java_mirror() {
 322   if (is_shared()) {
 323     return ciKlass::java_mirror();
 324   }
 325   if (_java_mirror == NULL) {
 326     _java_mirror = ciKlass::java_mirror();
 327   }
 328   return _java_mirror;
 329 }
 330 
 331 // ------------------------------------------------------------------
 332 // ciInstanceKlass::unique_concrete_subklass
 333 ciInstanceKlass* ciInstanceKlass::unique_concrete_subklass() {
 334   if (!is_loaded())     return NULL; // No change if class is not loaded
 335   if (!is_abstract())   return NULL; // Only applies to abstract classes.
 336   if (!has_subklass())  return NULL; // Must have at least one subklass.
 337   VM_ENTRY_MARK;
 338   instanceKlass* ik = get_instanceKlass();
 339   Klass* up = ik->up_cast_abstract();
 340   assert(up->oop_is_instance(), "must be instanceKlass");
 341   if (ik == up) {
 342     return NULL;
 343   }
 344   return CURRENT_THREAD_ENV->get_object(up->as_klassOop())->as_instance_klass();


src/share/vm/ci/ciInstanceKlass.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File