< prev index next >

src/hotspot/share/oops/instanceKlass.cpp

Print this page
rev 48545 : Value-based classes (vbc) / Oop value test via metadata ptr


 142       }
 143     }
 144   }
 145   return false;
 146 }
 147 
 148 InstanceKlass* InstanceKlass::allocate_instance_klass(const ClassFileParser& parser, TRAPS) {
 149   const int size = InstanceKlass::size(parser.vtable_size(),
 150                                        parser.itable_size(),
 151                                        nonstatic_oop_map_size(parser.total_oop_map_count()),
 152                                        parser.is_interface(),
 153                                        parser.is_anonymous(),
 154                                        should_store_fingerprint(parser.is_anonymous()));
 155 
 156   const Symbol* const class_name = parser.class_name();
 157   assert(class_name != NULL, "invariant");
 158   ClassLoaderData* loader_data = parser.loader_data();
 159   assert(loader_data != NULL, "invariant");
 160 
 161   InstanceKlass* ik;
 162 
 163   // Allocation
 164   if (REF_NONE == parser.reference_type()) {
 165     if (class_name == vmSymbols::java_lang_Class()) {
 166       // mirror
 167       ik = new (loader_data, size, THREAD) InstanceMirrorKlass(parser);
 168     }
 169     else if (is_class_loader(class_name, parser)) {
 170       // class loader
 171       ik = new (loader_data, size, THREAD) InstanceClassLoaderKlass(parser);
 172     }
 173     else {
 174       // normal




 175       ik = new (loader_data, size, THREAD) InstanceKlass(parser, InstanceKlass::_misc_kind_other);

 176     }
 177   }
 178   else {
 179     // reference
 180     ik = new (loader_data, size, THREAD) InstanceRefKlass(parser);
 181   }
 182 
 183   // Check for pending exception before adding to the loader data and incrementing
 184   // class count.  Can get OOM here.
 185   if (HAS_PENDING_EXCEPTION) {
 186     return NULL;
 187   }
 188 
 189   assert(ik != NULL, "invariant");
 190 
 191   const bool publicize = !parser.is_internal();
 192 
 193   // Add all classes to our internal class loader list here,
 194   // including classes in the bootstrap (NULL) class loader.
 195   loader_data->add_class(ik, publicize);




 142       }
 143     }
 144   }
 145   return false;
 146 }
 147 
 148 InstanceKlass* InstanceKlass::allocate_instance_klass(const ClassFileParser& parser, TRAPS) {
 149   const int size = InstanceKlass::size(parser.vtable_size(),
 150                                        parser.itable_size(),
 151                                        nonstatic_oop_map_size(parser.total_oop_map_count()),
 152                                        parser.is_interface(),
 153                                        parser.is_anonymous(),
 154                                        should_store_fingerprint(parser.is_anonymous()));
 155 
 156   const Symbol* const class_name = parser.class_name();
 157   assert(class_name != NULL, "invariant");
 158   ClassLoaderData* loader_data = parser.loader_data();
 159   assert(loader_data != NULL, "invariant");
 160 
 161   InstanceKlass* ik;

 162   // Allocation
 163   if (REF_NONE == parser.reference_type()) {
 164     if (class_name == vmSymbols::java_lang_Class()) {
 165       // mirror
 166       ik = new (loader_data, size, THREAD) InstanceMirrorKlass(parser);
 167     }
 168     else if (is_class_loader(class_name, parser)) {
 169       // class loader
 170       ik = new (loader_data, size, THREAD) InstanceClassLoaderKlass(parser);
 171     }
 172     else {
 173       // normal
 174 #if INCLUDE_VBC
 175       bool is_value = parser.access_flags().is_value_based_class();
 176       ik = new (loader_data, size, is_value, THREAD) InstanceKlass(parser, InstanceKlass::_misc_kind_other);
 177 #else
 178       ik = new (loader_data, size, THREAD) InstanceKlass(parser, InstanceKlass::_misc_kind_other);
 179 #endif
 180     }
 181   }
 182   else {
 183     // reference
 184     ik = new (loader_data, size, THREAD) InstanceRefKlass(parser);
 185   }
 186 
 187   // Check for pending exception before adding to the loader data and incrementing
 188   // class count.  Can get OOM here.
 189   if (HAS_PENDING_EXCEPTION) {
 190     return NULL;
 191   }
 192 
 193   assert(ik != NULL, "invariant");
 194 
 195   const bool publicize = !parser.is_internal();
 196 
 197   // Add all classes to our internal class loader list here,
 198   // including classes in the bootstrap (NULL) class loader.
 199   loader_data->add_class(ik, publicize);


< prev index next >