< prev index next >

src/share/vm/ci/ciInstanceKlass.cpp

Print this page




  41 
  42 // ------------------------------------------------------------------
  43 // ciInstanceKlass::ciInstanceKlass
  44 //
  45 // Loaded instance klass.
  46 ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) :
  47   ciKlass(h_k)
  48 {
  49   assert(get_Klass()->oop_is_instance(), "wrong type");
  50   assert(get_instanceKlass()->is_loaded(), "must be at least loaded");
  51   InstanceKlass* ik = get_instanceKlass();
  52 
  53   AccessFlags access_flags = ik->access_flags();
  54   _flags = ciFlags(access_flags);
  55   _has_finalizer = access_flags.has_finalizer();
  56   _has_subklass = ik->subklass() != NULL;
  57   _init_state = ik->init_state();
  58   _nonstatic_field_size = ik->nonstatic_field_size();
  59   _has_nonstatic_fields = ik->has_nonstatic_fields();
  60   _has_default_methods = ik->has_default_methods();

  61   _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
  62   _has_injected_fields = -1;
  63   _implementor = NULL; // we will fill these lazily
  64 
  65   Thread *thread = Thread::current();
  66   if (ciObjectFactory::is_initialized()) {
  67     _loader = JNIHandles::make_local(thread, ik->class_loader());
  68     _protection_domain = JNIHandles::make_local(thread,
  69                                                 ik->protection_domain());
  70     _is_shared = false;
  71   } else {
  72     Handle h_loader(thread, ik->class_loader());
  73     Handle h_protection_domain(thread, ik->protection_domain());
  74     _loader = JNIHandles::make_global(h_loader);
  75     _protection_domain = JNIHandles::make_global(h_protection_domain);
  76     _is_shared = true;
  77   }
  78 
  79   // Lazy fields get filled in only upon request.
  80   _super  = NULL;


  84     if (h_k() != SystemDictionary::Object_klass()) {
  85       super();
  86     }
  87     //compute_nonstatic_fields();  // done outside of constructor
  88   }
  89 
  90   _field_cache = NULL;
  91 }
  92 
  93 // Version for unloaded classes:
  94 ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
  95                                  jobject loader, jobject protection_domain)
  96   : ciKlass(name, T_OBJECT)
  97 {
  98   assert(name->byte_at(0) != '[', "not an instance klass");
  99   _init_state = (InstanceKlass::ClassState)0;
 100   _nonstatic_field_size = -1;
 101   _has_nonstatic_fields = false;
 102   _nonstatic_fields = NULL;
 103   _has_injected_fields = -1;

 104   _loader = loader;
 105   _protection_domain = protection_domain;
 106   _is_shared = false;
 107   _super = NULL;
 108   _java_mirror = NULL;
 109   _field_cache = NULL;
 110 }
 111 
 112 
 113 
 114 // ------------------------------------------------------------------
 115 // ciInstanceKlass::compute_shared_is_initialized
 116 void ciInstanceKlass::compute_shared_init_state() {
 117   GUARDED_VM_ENTRY(
 118     InstanceKlass* ik = get_instanceKlass();
 119     _init_state = ik->init_state();
 120   )
 121 }
 122 
 123 // ------------------------------------------------------------------




  41 
  42 // ------------------------------------------------------------------
  43 // ciInstanceKlass::ciInstanceKlass
  44 //
  45 // Loaded instance klass.
  46 ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) :
  47   ciKlass(h_k)
  48 {
  49   assert(get_Klass()->oop_is_instance(), "wrong type");
  50   assert(get_instanceKlass()->is_loaded(), "must be at least loaded");
  51   InstanceKlass* ik = get_instanceKlass();
  52 
  53   AccessFlags access_flags = ik->access_flags();
  54   _flags = ciFlags(access_flags);
  55   _has_finalizer = access_flags.has_finalizer();
  56   _has_subklass = ik->subklass() != NULL;
  57   _init_state = ik->init_state();
  58   _nonstatic_field_size = ik->nonstatic_field_size();
  59   _has_nonstatic_fields = ik->has_nonstatic_fields();
  60   _has_default_methods = ik->has_default_methods();
  61   _is_anonymous = ik->is_anonymous();
  62   _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
  63   _has_injected_fields = -1;
  64   _implementor = NULL; // we will fill these lazily
  65 
  66   Thread *thread = Thread::current();
  67   if (ciObjectFactory::is_initialized()) {
  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;


  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, T_OBJECT)
  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   _has_injected_fields = -1;
 105   _is_anonymous = false;
 106   _loader = loader;
 107   _protection_domain = protection_domain;
 108   _is_shared = false;
 109   _super = NULL;
 110   _java_mirror = NULL;
 111   _field_cache = NULL;
 112 }
 113 
 114 
 115 
 116 // ------------------------------------------------------------------
 117 // ciInstanceKlass::compute_shared_is_initialized
 118 void ciInstanceKlass::compute_shared_init_state() {
 119   GUARDED_VM_ENTRY(
 120     InstanceKlass* ik = get_instanceKlass();
 121     _init_state = ik->init_state();
 122   )
 123 }
 124 
 125 // ------------------------------------------------------------------


< prev index next >