461 // create a new array of vtable_indices for default methods 462 Array<int>* InstanceKlass::create_new_default_vtable_indices(int len, TRAPS) { 463 Array<int>* vtable_indices = MetadataFactory::new_array<int>(class_loader_data(), len, CHECK_NULL); 464 assert(default_vtable_indices() == NULL, "only create once"); 465 set_default_vtable_indices(vtable_indices); 466 return vtable_indices; 467 } 468 469 InstanceKlass::InstanceKlass(const ClassFileParser& parser, unsigned kind, KlassID id) : 470 Klass(id), 471 _nest_members(NULL), 472 _nest_host_index(0), 473 _nest_host(NULL), 474 _static_field_size(parser.static_field_size()), 475 _nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())), 476 _itable_len(parser.itable_size()), 477 _extra_flags(0), 478 _init_thread(NULL), 479 _init_state(allocated), 480 _reference_type(parser.reference_type()), 481 _adr_valueklass_fixed_block(NULL) 482 { 483 set_vtable_length(parser.vtable_size()); 484 set_kind(kind); 485 set_access_flags(parser.access_flags()); 486 set_is_unsafe_anonymous(parser.is_unsafe_anonymous()); 487 set_layout_helper(Klass::instance_layout_helper(parser.layout_size(), 488 false)); 489 if (parser.has_flattenable_fields()) { 490 set_has_value_fields(); 491 } 492 _java_fields_count = parser.java_fields_count(); 493 494 assert(NULL == _methods, "underlying memory not zeroed?"); 495 assert(is_instance_klass(), "is layout incorrect?"); 496 assert(size_helper() == parser.layout_size(), "incorrect size_helper?"); 497 498 if (Arguments::is_dumping_archive()) { 499 SystemDictionaryShared::init_dumptime_info(this); 500 } 501 502 // Set biased locking bit for all instances of this class; it will be 503 // cleared if revocation occurs too often for this type 504 if (UseBiasedLocking && BiasedLocking::enabled()) { 505 set_prototype_header(markWord::biased_locking_prototype()); 506 } 507 } 508 509 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data, 510 Array<Method*>* methods) { 511 if (methods != NULL && methods != Universe::the_empty_method_array() && 512 !methods->is_shared()) { 513 for (int i = 0; i < methods->length(); i++) { 514 Method* method = methods->at(i); 515 if (method == NULL) continue; // maybe null if error processing 516 // Only want to delete methods that are not executing for RedefineClasses. 517 // The previous version will point to them so they're not totally dangling 518 assert (!method->on_stack(), "shouldn't be called with methods on stack"); 519 MetadataFactory::free_metadata(loader_data, method); 520 } 521 MetadataFactory::free_array<Method*>(loader_data, methods); 522 } 523 } 524 525 void InstanceKlass::deallocate_interfaces(ClassLoaderData* loader_data, | 461 // create a new array of vtable_indices for default methods 462 Array<int>* InstanceKlass::create_new_default_vtable_indices(int len, TRAPS) { 463 Array<int>* vtable_indices = MetadataFactory::new_array<int>(class_loader_data(), len, CHECK_NULL); 464 assert(default_vtable_indices() == NULL, "only create once"); 465 set_default_vtable_indices(vtable_indices); 466 return vtable_indices; 467 } 468 469 InstanceKlass::InstanceKlass(const ClassFileParser& parser, unsigned kind, KlassID id) : 470 Klass(id), 471 _nest_members(NULL), 472 _nest_host_index(0), 473 _nest_host(NULL), 474 _static_field_size(parser.static_field_size()), 475 _nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())), 476 _itable_len(parser.itable_size()), 477 _extra_flags(0), 478 _init_thread(NULL), 479 _init_state(allocated), 480 _reference_type(parser.reference_type()), 481 _value_field_klasses(NULL), 482 _adr_valueklass_fixed_block(NULL) 483 { 484 set_vtable_length(parser.vtable_size()); 485 set_kind(kind); 486 set_access_flags(parser.access_flags()); 487 set_is_unsafe_anonymous(parser.is_unsafe_anonymous()); 488 set_layout_helper(Klass::instance_layout_helper(parser.layout_size(), 489 false)); 490 if (parser.has_flattenable_fields()) { 491 set_has_value_fields(); 492 } 493 _java_fields_count = parser.java_fields_count(); 494 495 assert(NULL == _methods, "underlying memory not zeroed?"); 496 assert(is_instance_klass(), "is layout incorrect?"); 497 assert(size_helper() == parser.layout_size(), "incorrect size_helper?"); 498 499 if (Arguments::is_dumping_archive()) { 500 SystemDictionaryShared::init_dumptime_info(this); 501 } 502 503 // Set biased locking bit for all instances of this class; it will be 504 // cleared if revocation occurs too often for this type 505 if (UseBiasedLocking && BiasedLocking::enabled()) { 506 set_prototype_header(markWord::biased_locking_prototype()); 507 } 508 if (has_value_fields()) { 509 _value_field_klasses = (const Klass**) adr_value_fields_klasses(); 510 } 511 } 512 513 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data, 514 Array<Method*>* methods) { 515 if (methods != NULL && methods != Universe::the_empty_method_array() && 516 !methods->is_shared()) { 517 for (int i = 0; i < methods->length(); i++) { 518 Method* method = methods->at(i); 519 if (method == NULL) continue; // maybe null if error processing 520 // Only want to delete methods that are not executing for RedefineClasses. 521 // The previous version will point to them so they're not totally dangling 522 assert (!method->on_stack(), "shouldn't be called with methods on stack"); 523 MetadataFactory::free_metadata(loader_data, method); 524 } 525 MetadataFactory::free_array<Method*>(loader_data, methods); 526 } 527 } 528 529 void InstanceKlass::deallocate_interfaces(ClassLoaderData* loader_data, |