comparison src/share/vm/oops/instanceKlass.cpp @ 13086:096c224171c4

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 20 Nov 2013 00:10:38 +0100
parents cefad50507d8 6e1826d5c23e
children 02f27ecb4f3a
comparison
equal deleted inserted replaced
12782:92b7ec34ddfa 13086:096c224171c4
236 } else { 236 } else {
237 _method_ordering = Universe::the_empty_int_array(); 237 _method_ordering = Universe::the_empty_int_array();
238 } 238 }
239 } 239 }
240 240
241 // create a new array of vtable_indices for default methods
242 Array<int>* InstanceKlass::create_new_default_vtable_indices(int len, TRAPS) {
243 Array<int>* vtable_indices = MetadataFactory::new_array<int>(class_loader_data(), len, CHECK_NULL);
244 assert(default_vtable_indices() == NULL, "only create once");
245 set_default_vtable_indices(vtable_indices);
246 return vtable_indices;
247 }
241 248
242 InstanceKlass::InstanceKlass(int vtable_len, 249 InstanceKlass::InstanceKlass(int vtable_len,
243 int itable_len, 250 int itable_len,
244 int static_field_size, 251 int static_field_size,
245 int nonstatic_oop_map_size, 252 int nonstatic_oop_map_size,
261 assert(size() == iksize, "wrong size for object"); 268 assert(size() == iksize, "wrong size for object");
262 269
263 set_array_klasses(NULL); 270 set_array_klasses(NULL);
264 set_methods(NULL); 271 set_methods(NULL);
265 set_method_ordering(NULL); 272 set_method_ordering(NULL);
273 set_default_methods(NULL);
274 set_default_vtable_indices(NULL);
266 set_local_interfaces(NULL); 275 set_local_interfaces(NULL);
267 set_transitive_interfaces(NULL); 276 set_transitive_interfaces(NULL);
268 init_implementor(); 277 init_implementor();
269 set_fields(NULL, 0); 278 set_fields(NULL, 0);
270 set_constants(NULL); 279 set_constants(NULL);
309 } 318 }
310 319
311 320
312 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data, 321 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data,
313 Array<Method*>* methods) { 322 Array<Method*>* methods) {
314 if (methods != NULL && methods != Universe::the_empty_method_array()) { 323 if (methods != NULL && methods != Universe::the_empty_method_array() &&
324 !methods->is_shared()) {
315 for (int i = 0; i < methods->length(); i++) { 325 for (int i = 0; i < methods->length(); i++) {
316 Method* method = methods->at(i); 326 Method* method = methods->at(i);
317 if (method == NULL) continue; // maybe null if error processing 327 if (method == NULL) continue; // maybe null if error processing
318 // Only want to delete methods that are not executing for RedefineClasses. 328 // Only want to delete methods that are not executing for RedefineClasses.
319 // The previous version will point to them so they're not totally dangling 329 // The previous version will point to them so they're not totally dangling
333 Array<Klass*>* ti = transitive_interfaces; 343 Array<Klass*>* ti = transitive_interfaces;
334 if (ti != Universe::the_empty_klass_array() && ti != local_interfaces) { 344 if (ti != Universe::the_empty_klass_array() && ti != local_interfaces) {
335 // check that the interfaces don't come from super class 345 // check that the interfaces don't come from super class
336 Array<Klass*>* sti = (super_klass == NULL) ? NULL : 346 Array<Klass*>* sti = (super_klass == NULL) ? NULL :
337 InstanceKlass::cast(super_klass)->transitive_interfaces(); 347 InstanceKlass::cast(super_klass)->transitive_interfaces();
338 if (ti != sti) { 348 if (ti != sti && ti != NULL && !ti->is_shared()) {
339 MetadataFactory::free_array<Klass*>(loader_data, ti); 349 MetadataFactory::free_array<Klass*>(loader_data, ti);
340 } 350 }
341 } 351 }
342 352
343 // local interfaces can be empty 353 // local interfaces can be empty
344 if (local_interfaces != Universe::the_empty_klass_array()) { 354 if (local_interfaces != Universe::the_empty_klass_array() &&
355 local_interfaces != NULL && !local_interfaces->is_shared()) {
345 MetadataFactory::free_array<Klass*>(loader_data, local_interfaces); 356 MetadataFactory::free_array<Klass*>(loader_data, local_interfaces);
346 } 357 }
347 } 358 }
348 359
349 // This function deallocates the metadata and C heap pointers that the 360 // This function deallocates the metadata and C heap pointers that the
369 release_C_heap_structures(); 380 release_C_heap_structures();
370 381
371 deallocate_methods(loader_data, methods()); 382 deallocate_methods(loader_data, methods());
372 set_methods(NULL); 383 set_methods(NULL);
373 384
374 if (method_ordering() != Universe::the_empty_int_array()) { 385 if (method_ordering() != NULL &&
386 method_ordering() != Universe::the_empty_int_array() &&
387 !method_ordering()->is_shared()) {
375 MetadataFactory::free_array<int>(loader_data, method_ordering()); 388 MetadataFactory::free_array<int>(loader_data, method_ordering());
376 } 389 }
377 set_method_ordering(NULL); 390 set_method_ordering(NULL);
391
392 // default methods can be empty
393 if (default_methods() != NULL &&
394 default_methods() != Universe::the_empty_method_array() &&
395 !default_methods()->is_shared()) {
396 MetadataFactory::free_array<Method*>(loader_data, default_methods());
397 }
398 // Do NOT deallocate the default methods, they are owned by superinterfaces.
399 set_default_methods(NULL);
400
401 // default methods vtable indices can be empty
402 if (default_vtable_indices() != NULL &&
403 !default_vtable_indices()->is_shared()) {
404 MetadataFactory::free_array<int>(loader_data, default_vtable_indices());
405 }
406 set_default_vtable_indices(NULL);
407
378 408
379 // This array is in Klass, but remove it with the InstanceKlass since 409 // This array is in Klass, but remove it with the InstanceKlass since
380 // this place would be the only caller and it can share memory with transitive 410 // this place would be the only caller and it can share memory with transitive
381 // interfaces. 411 // interfaces.
382 if (secondary_supers() != Universe::the_empty_klass_array() && 412 if (secondary_supers() != NULL &&
383 secondary_supers() != transitive_interfaces()) { 413 secondary_supers() != Universe::the_empty_klass_array() &&
414 secondary_supers() != transitive_interfaces() &&
415 !secondary_supers()->is_shared()) {
384 MetadataFactory::free_array<Klass*>(loader_data, secondary_supers()); 416 MetadataFactory::free_array<Klass*>(loader_data, secondary_supers());
385 } 417 }
386 set_secondary_supers(NULL); 418 set_secondary_supers(NULL);
387 419
388 deallocate_interfaces(loader_data, super(), local_interfaces(), transitive_interfaces()); 420 deallocate_interfaces(loader_data, super(), local_interfaces(), transitive_interfaces());
389 set_transitive_interfaces(NULL); 421 set_transitive_interfaces(NULL);
390 set_local_interfaces(NULL); 422 set_local_interfaces(NULL);
391 423
392 MetadataFactory::free_array<jushort>(loader_data, fields()); 424 if (fields() != NULL && !fields()->is_shared()) {
425 MetadataFactory::free_array<jushort>(loader_data, fields());
426 }
393 set_fields(NULL, 0); 427 set_fields(NULL, 0);
394 428
395 // If a method from a redefined class is using this constant pool, don't 429 // If a method from a redefined class is using this constant pool, don't
396 // delete it, yet. The new class's previous version will point to this. 430 // delete it, yet. The new class's previous version will point to this.
397 if (constants() != NULL) { 431 if (constants() != NULL) {
398 assert (!constants()->on_stack(), "shouldn't be called if anything is onstack"); 432 assert (!constants()->on_stack(), "shouldn't be called if anything is onstack");
399 MetadataFactory::free_metadata(loader_data, constants()); 433 if (!constants()->is_shared()) {
434 MetadataFactory::free_metadata(loader_data, constants());
435 }
400 set_constants(NULL); 436 set_constants(NULL);
401 } 437 }
402 438
403 if (inner_classes() != Universe::the_empty_short_array()) { 439 if (inner_classes() != NULL &&
440 inner_classes() != Universe::the_empty_short_array() &&
441 !inner_classes()->is_shared()) {
404 MetadataFactory::free_array<jushort>(loader_data, inner_classes()); 442 MetadataFactory::free_array<jushort>(loader_data, inner_classes());
405 } 443 }
406 set_inner_classes(NULL); 444 set_inner_classes(NULL);
407 445
408 // We should deallocate the Annotations instance 446 // We should deallocate the Annotations instance if it's not in shared spaces.
409 MetadataFactory::free_metadata(loader_data, annotations()); 447 if (annotations() != NULL && !annotations()->is_shared()) {
448 MetadataFactory::free_metadata(loader_data, annotations());
449 }
410 set_annotations(NULL); 450 set_annotations(NULL);
411 } 451 }
412 452
413 bool InstanceKlass::should_be_initialized() const { 453 bool InstanceKlass::should_be_initialized() const {
414 return !is_initialized(); 454 return !is_initialized();
454 objArrayOop InstanceKlass::signers() const { 494 objArrayOop InstanceKlass::signers() const {
455 // return the signers from the mirror 495 // return the signers from the mirror
456 return java_lang_Class::signers(java_mirror()); 496 return java_lang_Class::signers(java_mirror());
457 } 497 }
458 498
459 volatile oop InstanceKlass::init_lock() const { 499 oop InstanceKlass::init_lock() const {
460 // return the init lock from the mirror 500 // return the init lock from the mirror
461 return java_lang_Class::init_lock(java_mirror()); 501 oop lock = java_lang_Class::init_lock(java_mirror());
502 assert((oop)lock != NULL || !is_not_initialized(), // initialized or in_error state
503 "only fully initialized state can have a null lock");
504 return lock;
505 }
506
507 // Set the initialization lock to null so the object can be GC'ed. Any racing
508 // threads to get this lock will see a null lock and will not lock.
509 // That's okay because they all check for initialized state after getting
510 // the lock and return.
511 void InstanceKlass::fence_and_clear_init_lock() {
512 // make sure previous stores are all done, notably the init_state.
513 OrderAccess::storestore();
514 java_lang_Class::set_init_lock(java_mirror(), NULL);
515 assert(!is_not_initialized(), "class must be initialized now");
462 } 516 }
463 517
464 void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) { 518 void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) {
465 EXCEPTION_MARK; 519 EXCEPTION_MARK;
466 volatile oop init_lock = this_oop->init_lock(); 520 oop init_lock = this_oop->init_lock();
467 ObjectLocker ol(init_lock, THREAD); 521 ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
468 522
469 // abort if someone beat us to the initialization 523 // abort if someone beat us to the initialization
470 if (!this_oop->is_not_initialized()) return; // note: not equivalent to is_initialized() 524 if (!this_oop->is_not_initialized()) return; // note: not equivalent to is_initialized()
471 525
472 ClassState old_state = this_oop->init_state(); 526 ClassState old_state = this_oop->init_state();
481 if( old_state != this_oop->_init_state ) 535 if( old_state != this_oop->_init_state )
482 this_oop->set_init_state (old_state); 536 this_oop->set_init_state (old_state);
483 } else { 537 } else {
484 // linking successfull, mark class as initialized 538 // linking successfull, mark class as initialized
485 this_oop->set_init_state (fully_initialized); 539 this_oop->set_init_state (fully_initialized);
540 this_oop->fence_and_clear_init_lock();
486 // trace 541 // trace
487 if (TraceClassInitialization) { 542 if (TraceClassInitialization) {
488 ResourceMark rm(THREAD); 543 ResourceMark rm(THREAD);
489 tty->print_cr("[Initialized %s without side effects]", this_oop->external_name()); 544 tty->print_cr("[Initialized %s without side effects]", this_oop->external_name());
490 } 545 }
606 jt->get_thread_stat()->perf_timers_addr(), 661 jt->get_thread_stat()->perf_timers_addr(),
607 PerfClassTraceTime::CLASS_LINK); 662 PerfClassTraceTime::CLASS_LINK);
608 663
609 // verification & rewriting 664 // verification & rewriting
610 { 665 {
611 volatile oop init_lock = this_oop->init_lock(); 666 oop init_lock = this_oop->init_lock();
612 ObjectLocker ol(init_lock, THREAD); 667 ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
613 // rewritten will have been set if loader constraint error found 668 // rewritten will have been set if loader constraint error found
614 // on an earlier link attempt 669 // on an earlier link attempt
615 // don't verify or rewrite if already rewritten 670 // don't verify or rewrite if already rewritten
616 671
617 if (!this_oop->is_linked()) { 672 if (!this_oop->is_linked()) {
729 bool wait = false; 784 bool wait = false;
730 785
731 // refer to the JVM book page 47 for description of steps 786 // refer to the JVM book page 47 for description of steps
732 // Step 1 787 // Step 1
733 { 788 {
734 volatile oop init_lock = this_oop->init_lock(); 789 oop init_lock = this_oop->init_lock();
735 ObjectLocker ol(init_lock, THREAD); 790 ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
736 791
737 Thread *self = THREAD; // it's passed the current thread 792 Thread *self = THREAD; // it's passed the current thread
738 793
739 // Step 2 794 // Step 2
740 // If we were to use wait() instead of waitInterruptibly() then 795 // If we were to use wait() instead of waitInterruptibly() then
877 instanceKlassHandle kh(THREAD, this); 932 instanceKlassHandle kh(THREAD, this);
878 set_initialization_state_and_notify_impl(kh, state, CHECK); 933 set_initialization_state_and_notify_impl(kh, state, CHECK);
879 } 934 }
880 935
881 void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) { 936 void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) {
882 volatile oop init_lock = this_oop->init_lock(); 937 oop init_lock = this_oop->init_lock();
883 ObjectLocker ol(init_lock, THREAD); 938 ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
884 this_oop->set_init_state(state); 939 this_oop->set_init_state(state);
940 this_oop->fence_and_clear_init_lock();
885 ol.notify_all(CHECK); 941 ol.notify_all(CHECK);
886 } 942 }
887 943
888 // The embedded _implementor field can only record one implementor. 944 // The embedded _implementor field can only record one implementor.
889 // When there are more than one implementors, the _implementor field 945 // When there are more than one implementors, the _implementor field
1352 } 1408 }
1353 } 1409 }
1354 return -1; 1410 return -1;
1355 } 1411 }
1356 1412
1413 // find_method looks up the name/signature in the local methods array
1357 Method* InstanceKlass::find_method(Symbol* name, Symbol* signature) const { 1414 Method* InstanceKlass::find_method(Symbol* name, Symbol* signature) const {
1358 return InstanceKlass::find_method(methods(), name, signature); 1415 return InstanceKlass::find_method(methods(), name, signature);
1359 } 1416 }
1360 1417
1418 // find_method looks up the name/signature in the local methods array
1361 Method* InstanceKlass::find_method( 1419 Method* InstanceKlass::find_method(
1420 Array<Method*>* methods, Symbol* name, Symbol* signature) {
1421 int hit = find_method_index(methods, name, signature);
1422 return hit >= 0 ? methods->at(hit): NULL;
1423 }
1424
1425 // Used directly for default_methods to find the index into the
1426 // default_vtable_indices, and indirectly by find_method
1427 // find_method_index looks in the local methods array to return the index
1428 // of the matching name/signature
1429 int InstanceKlass::find_method_index(
1362 Array<Method*>* methods, Symbol* name, Symbol* signature) { 1430 Array<Method*>* methods, Symbol* name, Symbol* signature) {
1363 int hit = binary_search(methods, name); 1431 int hit = binary_search(methods, name);
1364 if (hit != -1) { 1432 if (hit != -1) {
1365 Method* m = methods->at(hit); 1433 Method* m = methods->at(hit);
1366 // Do linear search to find matching signature. First, quick check 1434 // Do linear search to find matching signature. First, quick check
1367 // for common case 1435 // for common case
1368 if (m->signature() == signature) return m; 1436 if (m->signature() == signature) return hit;
1369 // search downwards through overloaded methods 1437 // search downwards through overloaded methods
1370 int i; 1438 int i;
1371 for (i = hit - 1; i >= 0; --i) { 1439 for (i = hit - 1; i >= 0; --i) {
1372 Method* m = methods->at(i); 1440 Method* m = methods->at(i);
1373 assert(m->is_method(), "must be method"); 1441 assert(m->is_method(), "must be method");
1374 if (m->name() != name) break; 1442 if (m->name() != name) break;
1375 if (m->signature() == signature) return m; 1443 if (m->signature() == signature) return i;
1376 } 1444 }
1377 // search upwards 1445 // search upwards
1378 for (i = hit + 1; i < methods->length(); ++i) { 1446 for (i = hit + 1; i < methods->length(); ++i) {
1379 Method* m = methods->at(i); 1447 Method* m = methods->at(i);
1380 assert(m->is_method(), "must be method"); 1448 assert(m->is_method(), "must be method");
1381 if (m->name() != name) break; 1449 if (m->name() != name) break;
1382 if (m->signature() == signature) return m; 1450 if (m->signature() == signature) return i;
1383 } 1451 }
1384 // not found 1452 // not found
1385 #ifdef ASSERT 1453 #ifdef ASSERT
1386 int index = linear_search(methods, name, signature); 1454 int index = linear_search(methods, name, signature);
1387 assert(index == -1, err_msg("binary search should have found entry %d", index)); 1455 assert(index == -1, err_msg("binary search should have found entry %d", index));
1388 #endif 1456 #endif
1389 } 1457 }
1390 return NULL; 1458 return -1;
1391 } 1459 }
1392
1393 int InstanceKlass::find_method_by_name(Symbol* name, int* end) { 1460 int InstanceKlass::find_method_by_name(Symbol* name, int* end) {
1394 return find_method_by_name(methods(), name, end); 1461 return find_method_by_name(methods(), name, end);
1395 } 1462 }
1396 1463
1397 int InstanceKlass::find_method_by_name( 1464 int InstanceKlass::find_method_by_name(
1406 return start; 1473 return start;
1407 } 1474 }
1408 return -1; 1475 return -1;
1409 } 1476 }
1410 1477
1478 // lookup_method searches both the local methods array and all superclasses methods arrays
1411 Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const { 1479 Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const {
1412 Klass* klass = const_cast<InstanceKlass*>(this); 1480 Klass* klass = const_cast<InstanceKlass*>(this);
1413 while (klass != NULL) { 1481 while (klass != NULL) {
1414 Method* method = InstanceKlass::cast(klass)->find_method(name, signature); 1482 Method* method = InstanceKlass::cast(klass)->find_method(name, signature);
1415 if (method != NULL) return method; 1483 if (method != NULL) return method;
1416 klass = InstanceKlass::cast(klass)->super(); 1484 klass = InstanceKlass::cast(klass)->super();
1417 } 1485 }
1418 return NULL; 1486 return NULL;
1487 }
1488
1489 // lookup a method in the default methods list then in all transitive interfaces
1490 // Do NOT return private or static methods
1491 Method* InstanceKlass::lookup_method_in_ordered_interfaces(Symbol* name,
1492 Symbol* signature) const {
1493 Method* m = NULL;
1494 if (default_methods() != NULL) {
1495 m = find_method(default_methods(), name, signature);
1496 }
1497 // Look up interfaces
1498 if (m == NULL) {
1499 m = lookup_method_in_all_interfaces(name, signature);
1500 }
1501 return m;
1419 } 1502 }
1420 1503
1421 // lookup a method in all the interfaces that this class implements 1504 // lookup a method in all the interfaces that this class implements
1422 // Do NOT return private or static methods, new in JDK8 which are not externally visible 1505 // Do NOT return private or static methods, new in JDK8 which are not externally visible
1423 // They should only be found in the initial InterfaceMethodRef 1506 // They should only be found in the initial InterfaceMethodRef
2126 for (ProfileData* data = mdo->first_data(); 2209 for (ProfileData* data = mdo->first_data();
2127 mdo->is_valid(data); 2210 mdo->is_valid(data);
2128 data = mdo->next_data(data)) { 2211 data = mdo->next_data(data)) {
2129 data->clean_weak_klass_links(is_alive); 2212 data->clean_weak_klass_links(is_alive);
2130 } 2213 }
2214 ParametersTypeData* parameters = mdo->parameters_type_data();
2215 if (parameters != NULL) {
2216 parameters->clean_weak_klass_links(is_alive);
2217 }
2131 } 2218 }
2132 } 2219 }
2133 } 2220 }
2134 2221
2135 2222
2308 return (address)(offset + InstanceMirrorKlass::offset_of_static_fields() + cast_from_oop<intptr_t>(java_mirror())); 2395 return (address)(offset + InstanceMirrorKlass::offset_of_static_fields() + cast_from_oop<intptr_t>(java_mirror()));
2309 } 2396 }
2310 2397
2311 2398
2312 const char* InstanceKlass::signature_name() const { 2399 const char* InstanceKlass::signature_name() const {
2400 int hash_len = 0;
2401 char hash_buf[40];
2402
2403 // If this is an anonymous class, append a hash to make the name unique
2404 if (is_anonymous()) {
2405 assert(EnableInvokeDynamic, "EnableInvokeDynamic was not set.");
2406 intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
2407 sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash);
2408 hash_len = (int)strlen(hash_buf);
2409 }
2410
2411 // Get the internal name as a c string
2313 const char* src = (const char*) (name()->as_C_string()); 2412 const char* src = (const char*) (name()->as_C_string());
2314 const int src_length = (int)strlen(src); 2413 const int src_length = (int)strlen(src);
2315 char* dest = NEW_RESOURCE_ARRAY(char, src_length + 3); 2414
2316 int src_index = 0; 2415 char* dest = NEW_RESOURCE_ARRAY(char, src_length + hash_len + 3);
2416
2417 // Add L as type indicator
2317 int dest_index = 0; 2418 int dest_index = 0;
2318 dest[dest_index++] = 'L'; 2419 dest[dest_index++] = 'L';
2319 while (src_index < src_length) { 2420
2421 // Add the actual class name
2422 for (int src_index = 0; src_index < src_length; ) {
2320 dest[dest_index++] = src[src_index++]; 2423 dest[dest_index++] = src[src_index++];
2321 } 2424 }
2425
2426 // If we have a hash, append it
2427 for (int hash_index = 0; hash_index < hash_len; ) {
2428 dest[dest_index++] = hash_buf[hash_index++];
2429 }
2430
2431 // Add the semicolon and the NULL
2322 dest[dest_index++] = ';'; 2432 dest[dest_index++] = ';';
2323 dest[dest_index] = '\0'; 2433 dest[dest_index] = '\0';
2324 return dest; 2434 return dest;
2325 } 2435 }
2326 2436
2546 THROW_NULL(vmSymbols::java_lang_AbstractMethodError()); 2656 THROW_NULL(vmSymbols::java_lang_AbstractMethodError());
2547 } 2657 }
2548 return m; 2658 return m;
2549 } 2659 }
2550 2660
2661
2662 #if INCLUDE_JVMTI
2663 // update default_methods for redefineclasses for methods that are
2664 // not yet in the vtable due to concurrent subclass define and superinterface
2665 // redefinition
2666 // Note: those in the vtable, should have been updated via adjust_method_entries
2667 void InstanceKlass::adjust_default_methods(Method** old_methods, Method** new_methods,
2668 int methods_length, bool* trace_name_printed) {
2669 // search the default_methods for uses of either obsolete or EMCP methods
2670 if (default_methods() != NULL) {
2671 for (int j = 0; j < methods_length; j++) {
2672 Method* old_method = old_methods[j];
2673 Method* new_method = new_methods[j];
2674
2675 for (int index = 0; index < default_methods()->length(); index ++) {
2676 if (default_methods()->at(index) == old_method) {
2677 default_methods()->at_put(index, new_method);
2678 if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
2679 if (!(*trace_name_printed)) {
2680 // RC_TRACE_MESG macro has an embedded ResourceMark
2681 RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
2682 external_name(),
2683 old_method->method_holder()->external_name()));
2684 *trace_name_printed = true;
2685 }
2686 RC_TRACE(0x00100000, ("default method update: %s(%s) ",
2687 new_method->name()->as_C_string(),
2688 new_method->signature()->as_C_string()));
2689 }
2690 }
2691 }
2692 }
2693 }
2694 }
2695 #endif // INCLUDE_JVMTI
2696
2551 // On-stack replacement stuff 2697 // On-stack replacement stuff
2552 void InstanceKlass::add_osr_nmethod(nmethod* n) { 2698 void InstanceKlass::add_osr_nmethod(nmethod* n) {
2553 // only one compilation can be active 2699 // only one compilation can be active
2554 NEEDS_CLEANUP 2700 NEEDS_CLEANUP
2555 // This is a short non-blocking critical region, so the no safepoint check is ok. 2701 // This is a short non-blocking critical region, so the no safepoint check is ok.
2740 2886
2741 st->print(BULLET"arrays: "); array_klasses()->print_value_on_maybe_null(st); st->cr(); 2887 st->print(BULLET"arrays: "); array_klasses()->print_value_on_maybe_null(st); st->cr();
2742 st->print(BULLET"methods: "); methods()->print_value_on(st); st->cr(); 2888 st->print(BULLET"methods: "); methods()->print_value_on(st); st->cr();
2743 if (Verbose || WizardMode) { 2889 if (Verbose || WizardMode) {
2744 Array<Method*>* method_array = methods(); 2890 Array<Method*>* method_array = methods();
2745 for(int i = 0; i < method_array->length(); i++) { 2891 for (int i = 0; i < method_array->length(); i++) {
2746 st->print("%d : ", i); method_array->at(i)->print_value(); st->cr(); 2892 st->print("%d : ", i); method_array->at(i)->print_value(); st->cr();
2747 } 2893 }
2748 } 2894 }
2749 st->print(BULLET"method ordering: "); method_ordering()->print_value_on(st); st->cr(); 2895 st->print(BULLET"method ordering: "); method_ordering()->print_value_on(st); st->cr();
2896 st->print(BULLET"default_methods: "); default_methods()->print_value_on(st); st->cr();
2897 if (Verbose && default_methods() != NULL) {
2898 Array<Method*>* method_array = default_methods();
2899 for (int i = 0; i < method_array->length(); i++) {
2900 st->print("%d : ", i); method_array->at(i)->print_value(); st->cr();
2901 }
2902 }
2903 if (default_vtable_indices() != NULL) {
2904 st->print(BULLET"default vtable indices: "); default_vtable_indices()->print_value_on(st); st->cr();
2905 }
2750 st->print(BULLET"local interfaces: "); local_interfaces()->print_value_on(st); st->cr(); 2906 st->print(BULLET"local interfaces: "); local_interfaces()->print_value_on(st); st->cr();
2751 st->print(BULLET"trans. interfaces: "); transitive_interfaces()->print_value_on(st); st->cr(); 2907 st->print(BULLET"trans. interfaces: "); transitive_interfaces()->print_value_on(st); st->cr();
2752 st->print(BULLET"constants: "); constants()->print_value_on(st); st->cr(); 2908 st->print(BULLET"constants: "); constants()->print_value_on(st); st->cr();
2753 if (class_loader_data() != NULL) { 2909 if (class_loader_data() != NULL) {
2754 st->print(BULLET"class loader data: "); 2910 st->print(BULLET"class loader data: ");
3094 } 3250 }
3095 // Verify sum of indices 0,1,...,length-1 3251 // Verify sum of indices 0,1,...,length-1
3096 guarantee(sum == ((jlong)length*(length-1))/2, "invalid method ordering sum"); 3252 guarantee(sum == ((jlong)length*(length-1))/2, "invalid method ordering sum");
3097 } else { 3253 } else {
3098 guarantee(length == 0, "invalid method ordering length"); 3254 guarantee(length == 0, "invalid method ordering length");
3255 }
3256 }
3257
3258 // Verify default methods
3259 if (default_methods() != NULL) {
3260 Array<Method*>* methods = this->default_methods();
3261 for (int j = 0; j < methods->length(); j++) {
3262 guarantee(methods->at(j)->is_method(), "non-method in methods array");
3263 }
3264 for (int j = 0; j < methods->length() - 1; j++) {
3265 Method* m1 = methods->at(j);
3266 Method* m2 = methods->at(j + 1);
3267 guarantee(m1->name()->fast_compare(m2->name()) <= 0, "methods not sorted correctly");
3099 } 3268 }
3100 } 3269 }
3101 3270
3102 // Verify JNI static field identifiers 3271 // Verify JNI static field identifiers
3103 if (jni_ids() != NULL) { 3272 if (jni_ids() != NULL) {