434 result.add_receiver(receiver, rcount); |
434 result.add_receiver(receiver, rcount); |
435 // If we extend profiling to record methods, |
435 // If we extend profiling to record methods, |
436 // we will set result._method also. |
436 // we will set result._method also. |
437 } |
437 } |
438 // Determine call site's morphism. |
438 // Determine call site's morphism. |
439 // The call site count could be == (receivers_count_total + 1) |
439 // The call site count is 0 with known morphism (onlt 1 or 2 receivers) |
440 // not only in the case of a polymorphic call but also in the case |
440 // or < 0 in the case of a type check failured for checkcast, aastore, instanceof. |
441 // when a method data snapshot is taken after the site count was updated |
441 // The call site count is > 0 in the case of a polymorphic virtual call. |
442 // but before receivers counters were updated. |
442 if (morphism > 0 && morphism == result._limit) { |
443 if (morphism == result._limit) { |
443 // The morphism <= MorphismLimit. |
444 // There were no array klasses and morphism <= MorphismLimit. |
444 if ((morphism < ciCallProfile::MorphismLimit) || |
445 if (morphism < ciCallProfile::MorphismLimit || |
445 (morphism == ciCallProfile::MorphismLimit && count == 0)) { |
446 morphism == ciCallProfile::MorphismLimit && |
446 #ifdef ASSERT |
447 (receivers_count_total+1) >= count) { |
447 if (count > 0) { |
|
448 tty->print_cr("bci: %d", bci); |
|
449 this->print_codes(); |
|
450 assert(false, "this call site should not be polymorphic"); |
|
451 } |
|
452 #endif |
448 result._morphism = morphism; |
453 result._morphism = morphism; |
449 } |
454 } |
450 } |
455 } |
451 // Make the count consistent if this is a call profile. If count is |
456 // Make the count consistent if this is a call profile. If count is |
452 // zero or less, presume that this is a typecheck profile and |
457 // zero or less, presume that this is a typecheck profile and |
453 // do nothing. Otherwise, increase count to be the sum of all |
458 // do nothing. Otherwise, increase count to be the sum of all |
454 // receiver's counts. |
459 // receiver's counts. |
455 if (count > 0) { |
460 if (count >= 0) { |
456 if (count < receivers_count_total) { |
461 count += receivers_count_total; |
457 count = receivers_count_total; |
|
458 } |
|
459 } |
462 } |
460 } |
463 } |
461 result._count = count; |
464 result._count = count; |
462 } |
465 } |
463 } |
466 } |