< prev index next >

src/share/vm/ci/ciInstanceKlass.cpp

Print this page
rev 12906 : [mq]: gc_interface


  49 {
  50   assert(get_Klass()->is_instance_klass(), "wrong type");
  51   assert(get_instanceKlass()->is_loaded(), "must be at least loaded");
  52   InstanceKlass* ik = get_instanceKlass();
  53 
  54   AccessFlags access_flags = ik->access_flags();
  55   _flags = ciFlags(access_flags);
  56   _has_finalizer = access_flags.has_finalizer();
  57   _has_subklass = ik->subklass() != NULL;
  58   _init_state = ik->init_state();
  59   _nonstatic_field_size = ik->nonstatic_field_size();
  60   _has_nonstatic_fields = ik->has_nonstatic_fields();
  61   _has_nonstatic_concrete_methods = ik->has_nonstatic_concrete_methods();
  62   _is_anonymous = ik->is_anonymous();
  63   _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
  64   _has_injected_fields = -1;
  65   _implementor = NULL; // we will fill these lazily
  66 
  67   Thread *thread = Thread::current();
  68   if (ciObjectFactory::is_initialized()) {

  69     _loader = JNIHandles::make_local(thread, ik->class_loader());
  70     _protection_domain = JNIHandles::make_local(thread,
  71                                                 ik->protection_domain());
  72     _is_shared = false;
  73   } else {

  74     Handle h_loader(thread, ik->class_loader());
  75     Handle h_protection_domain(thread, ik->protection_domain());

  76     _loader = JNIHandles::make_global(h_loader);
  77     _protection_domain = JNIHandles::make_global(h_protection_domain);
  78     _is_shared = true;
  79   }
  80 
  81   // Lazy fields get filled in only upon request.
  82   _super  = NULL;
  83   _java_mirror = NULL;
  84 
  85   if (is_shared()) {
  86     if (k != SystemDictionary::Object_klass()) {
  87       super();
  88     }
  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, T_OBJECT)
  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   _has_injected_fields = -1;
 106   _is_anonymous = false;
 107   _loader = loader;
 108   _protection_domain = protection_domain;
 109   _is_shared = false;
 110   _super = NULL;
 111   _java_mirror = NULL;
 112   _field_cache = NULL;
 113 }
 114 
 115 
 116 
 117 // ------------------------------------------------------------------
 118 // ciInstanceKlass::compute_shared_is_initialized
 119 void ciInstanceKlass::compute_shared_init_state() {
 120   GUARDED_VM_ENTRY(
 121     InstanceKlass* ik = get_instanceKlass();
 122     _init_state = ik->init_state();
 123   )
 124 }
 125 
 126 // ------------------------------------------------------------------
 127 // ciInstanceKlass::compute_shared_has_subklass
 128 bool ciInstanceKlass::compute_shared_has_subklass() {
 129   GUARDED_VM_ENTRY(
 130     InstanceKlass* ik = get_instanceKlass();
 131     _has_subklass = ik->subklass() != NULL;
 132     return _has_subklass;
 133   )













 134 }
 135 
 136 // ------------------------------------------------------------------
 137 // ciInstanceKlass::loader
 138 oop ciInstanceKlass::loader() {
 139   ASSERT_IN_VM;
 140   return JNIHandles::resolve(_loader);
 141 }
 142 
 143 // ------------------------------------------------------------------
 144 // ciInstanceKlass::loader_handle
 145 jobject ciInstanceKlass::loader_handle() {
 146   return _loader;
 147 }
 148 
 149 // ------------------------------------------------------------------
 150 // ciInstanceKlass::protection_domain
 151 oop ciInstanceKlass::protection_domain() {
 152   ASSERT_IN_VM;
 153   return JNIHandles::resolve(_protection_domain);




  49 {
  50   assert(get_Klass()->is_instance_klass(), "wrong type");
  51   assert(get_instanceKlass()->is_loaded(), "must be at least loaded");
  52   InstanceKlass* ik = get_instanceKlass();
  53 
  54   AccessFlags access_flags = ik->access_flags();
  55   _flags = ciFlags(access_flags);
  56   _has_finalizer = access_flags.has_finalizer();
  57   _has_subklass = ik->subklass() != NULL;
  58   _init_state = ik->init_state();
  59   _nonstatic_field_size = ik->nonstatic_field_size();
  60   _has_nonstatic_fields = ik->has_nonstatic_fields();
  61   _has_nonstatic_concrete_methods = ik->has_nonstatic_concrete_methods();
  62   _is_anonymous = ik->is_anonymous();
  63   _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
  64   _has_injected_fields = -1;
  65   _implementor = NULL; // we will fill these lazily
  66 
  67   Thread *thread = Thread::current();
  68   if (ciObjectFactory::is_initialized()) {
  69     _holder = JNIHandles::make_local(thread, ik->klass_holder());
  70     _loader = JNIHandles::make_local(thread, ik->class_loader());
  71     _protection_domain = JNIHandles::make_local(thread,
  72                                                 ik->protection_domain());
  73     _is_shared = false;
  74   } else {
  75     Handle h_holder(thread, ik->klass_holder());
  76     Handle h_loader(thread, ik->class_loader());
  77     Handle h_protection_domain(thread, ik->protection_domain());
  78     _holder = JNIHandles::make_global(h_holder);
  79     _loader = JNIHandles::make_global(h_loader);
  80     _protection_domain = JNIHandles::make_global(h_protection_domain);
  81     _is_shared = true;
  82   }
  83 
  84   // Lazy fields get filled in only upon request.
  85   _super  = NULL;
  86   _java_mirror = NULL;
  87 
  88   if (is_shared()) {
  89     if (k != SystemDictionary::Object_klass()) {
  90       super();
  91     }
  92     //compute_nonstatic_fields();  // done outside of constructor
  93   }
  94 
  95   _field_cache = NULL;
  96 }
  97 
  98 // Version for unloaded classes:
  99 ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
 100                                  jobject holder, jobject loader, jobject protection_domain)
 101   : ciKlass(name, T_OBJECT)
 102 {
 103   assert(name->byte_at(0) != '[', "not an instance klass");
 104   _init_state = (InstanceKlass::ClassState)0;
 105   _nonstatic_field_size = -1;
 106   _has_nonstatic_fields = false;
 107   _nonstatic_fields = NULL;
 108   _has_injected_fields = -1;
 109   _is_anonymous = false;
 110   _loader = loader;
 111   _protection_domain = protection_domain;
 112   _is_shared = false;
 113   _super = NULL;
 114   _java_mirror = NULL;
 115   _field_cache = NULL;
 116 }
 117 
 118 
 119 
 120 // ------------------------------------------------------------------
 121 // ciInstanceKlass::compute_shared_is_initialized
 122 void ciInstanceKlass::compute_shared_init_state() {
 123   GUARDED_VM_ENTRY(
 124     InstanceKlass* ik = get_instanceKlass();
 125     _init_state = ik->init_state();
 126   )
 127 }
 128 
 129 // ------------------------------------------------------------------
 130 // ciInstanceKlass::compute_shared_has_subklass
 131 bool ciInstanceKlass::compute_shared_has_subklass() {
 132   GUARDED_VM_ENTRY(
 133     InstanceKlass* ik = get_instanceKlass();
 134     _has_subklass = ik->subklass() != NULL;
 135     return _has_subklass;
 136   )
 137 }
 138 
 139 // ------------------------------------------------------------------
 140 // ciInstanceKlass::holder
 141 oop ciInstanceKlass::holder() {
 142   ASSERT_IN_VM;
 143   return JNIHandles::resolve(_holder);
 144 }
 145 
 146 // ------------------------------------------------------------------
 147 // ciInstanceKlass::holder_handle
 148 jobject ciInstanceKlass::holder_handle() {
 149   return _holder;
 150 }
 151 
 152 // ------------------------------------------------------------------
 153 // ciInstanceKlass::loader
 154 oop ciInstanceKlass::loader() {
 155   ASSERT_IN_VM;
 156   return JNIHandles::resolve(_loader);
 157 }
 158 
 159 // ------------------------------------------------------------------
 160 // ciInstanceKlass::loader_handle
 161 jobject ciInstanceKlass::loader_handle() {
 162   return _loader;
 163 }
 164 
 165 // ------------------------------------------------------------------
 166 // ciInstanceKlass::protection_domain
 167 oop ciInstanceKlass::protection_domain() {
 168   ASSERT_IN_VM;
 169   return JNIHandles::resolve(_protection_domain);


< prev index next >