559 // ------------------------------------------------------------------
560 // Add new receiver and sort data by receiver's profile count.
561 void ciCallProfile::add_receiver(ciKlass* receiver, int receiver_count) {
562 // Add new receiver and sort data by receiver's counts when we have space
563 // for it otherwise replace the less called receiver (less called receiver
564 // is placed to the last array element which is not used).
565 // First array's element contains most called receiver.
566 int i = _limit;
567 for (; i > 0 && receiver_count > _receiver_count[i-1]; i--) {
568 _receiver[i] = _receiver[i-1];
569 _receiver_count[i] = _receiver_count[i-1];
570 }
571 _receiver[i] = receiver;
572 _receiver_count[i] = receiver_count;
573 if (_limit < MorphismLimit) _limit++;
574 }
575
576
577 void ciMethod::assert_virtual_call_type_ok(int bci) {
578 assert(java_code_at_bci(bci) == Bytecodes::_invokevirtual ||
579 java_code_at_bci(bci) == Bytecodes::_invokeinterface, err_msg("unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci))));
580 }
581
582 void ciMethod::assert_call_type_ok(int bci) {
583 assert(java_code_at_bci(bci) == Bytecodes::_invokestatic ||
584 java_code_at_bci(bci) == Bytecodes::_invokespecial ||
585 java_code_at_bci(bci) == Bytecodes::_invokedynamic, err_msg("unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci))));
586 }
587
588 /**
589 * Check whether profiling provides a type for the argument i to the
590 * call at bci bci
591 *
592 * @param [in]bci bci of the call
593 * @param [in]i argument number
594 * @param [out]type profiled type of argument, NULL if none
595 * @param [out]maybe_null true if null was seen for argument
596 * @return true if profiling exists
597 *
598 */
599 bool ciMethod::argument_profiled_type(int bci, int i, ciKlass*& type, bool& maybe_null) {
600 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) {
601 ciProfileData* data = method_data()->bci_to_data(bci);
602 if (data != NULL) {
603 if (data->is_VirtualCallTypeData()) {
604 assert_virtual_call_type_ok(bci);
605 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData();
|
559 // ------------------------------------------------------------------
560 // Add new receiver and sort data by receiver's profile count.
561 void ciCallProfile::add_receiver(ciKlass* receiver, int receiver_count) {
562 // Add new receiver and sort data by receiver's counts when we have space
563 // for it otherwise replace the less called receiver (less called receiver
564 // is placed to the last array element which is not used).
565 // First array's element contains most called receiver.
566 int i = _limit;
567 for (; i > 0 && receiver_count > _receiver_count[i-1]; i--) {
568 _receiver[i] = _receiver[i-1];
569 _receiver_count[i] = _receiver_count[i-1];
570 }
571 _receiver[i] = receiver;
572 _receiver_count[i] = receiver_count;
573 if (_limit < MorphismLimit) _limit++;
574 }
575
576
577 void ciMethod::assert_virtual_call_type_ok(int bci) {
578 assert(java_code_at_bci(bci) == Bytecodes::_invokevirtual ||
579 java_code_at_bci(bci) == Bytecodes::_invokeinterface, "unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci)));
580 }
581
582 void ciMethod::assert_call_type_ok(int bci) {
583 assert(java_code_at_bci(bci) == Bytecodes::_invokestatic ||
584 java_code_at_bci(bci) == Bytecodes::_invokespecial ||
585 java_code_at_bci(bci) == Bytecodes::_invokedynamic, "unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci)));
586 }
587
588 /**
589 * Check whether profiling provides a type for the argument i to the
590 * call at bci bci
591 *
592 * @param [in]bci bci of the call
593 * @param [in]i argument number
594 * @param [out]type profiled type of argument, NULL if none
595 * @param [out]maybe_null true if null was seen for argument
596 * @return true if profiling exists
597 *
598 */
599 bool ciMethod::argument_profiled_type(int bci, int i, ciKlass*& type, bool& maybe_null) {
600 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) {
601 ciProfileData* data = method_data()->bci_to_data(bci);
602 if (data != NULL) {
603 if (data->is_VirtualCallTypeData()) {
604 assert_virtual_call_type_ok(bci);
605 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData();
|