579 |
579 |
580 /** |
580 /** |
581 * Check whether profiling provides a type for the argument i to the |
581 * Check whether profiling provides a type for the argument i to the |
582 * call at bci bci |
582 * call at bci bci |
583 * |
583 * |
584 * @param bci bci of the call |
584 * @param [in]bci bci of the call |
585 * @param i argument number |
585 * @param [in]i argument number |
586 * @return profiled type |
586 * @param [out]type profiled type of argument, NULL if none |
|
587 * @param [out]maybe_null true if null was seen for argument |
|
588 * @return true if profiling exists |
587 * |
589 * |
588 * If the profile reports that the argument may be null, return false |
|
589 * at least for now. |
|
590 */ |
590 */ |
591 ciKlass* ciMethod::argument_profiled_type(int bci, int i) { |
591 bool ciMethod::argument_profiled_type(int bci, int i, ciKlass*& type, bool& maybe_null) { |
592 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) { |
592 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) { |
593 ciProfileData* data = method_data()->bci_to_data(bci); |
593 ciProfileData* data = method_data()->bci_to_data(bci); |
594 if (data != NULL) { |
594 if (data != NULL) { |
595 if (data->is_VirtualCallTypeData()) { |
595 if (data->is_VirtualCallTypeData()) { |
596 assert_virtual_call_type_ok(bci); |
596 assert_virtual_call_type_ok(bci); |
597 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData(); |
597 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData(); |
598 if (i >= call->number_of_arguments()) { |
598 if (i >= call->number_of_arguments()) { |
599 return NULL; |
599 return false; |
600 } |
600 } |
601 ciKlass* type = call->valid_argument_type(i); |
601 type = call->valid_argument_type(i); |
602 if (type != NULL && !call->argument_maybe_null(i)) { |
602 maybe_null = call->argument_maybe_null(i); |
603 return type; |
603 return true; |
604 } |
|
605 } else if (data->is_CallTypeData()) { |
604 } else if (data->is_CallTypeData()) { |
606 assert_call_type_ok(bci); |
605 assert_call_type_ok(bci); |
607 ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData(); |
606 ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData(); |
608 if (i >= call->number_of_arguments()) { |
607 if (i >= call->number_of_arguments()) { |
609 return NULL; |
608 return false; |
610 } |
609 } |
611 ciKlass* type = call->valid_argument_type(i); |
610 type = call->valid_argument_type(i); |
612 if (type != NULL && !call->argument_maybe_null(i)) { |
611 maybe_null = call->argument_maybe_null(i); |
613 return type; |
612 return true; |
614 } |
|
615 } |
613 } |
616 } |
614 } |
617 } |
615 } |
618 return NULL; |
616 return false; |
619 } |
617 } |
620 |
618 |
621 /** |
619 /** |
622 * Check whether profiling provides a type for the return value from |
620 * Check whether profiling provides a type for the return value from |
623 * the call at bci bci |
621 * the call at bci bci |
624 * |
622 * |
625 * @param bci bci of the call |
623 * @param [in]bci bci of the call |
626 * @return profiled type |
624 * @param [out]type profiled type of argument, NULL if none |
|
625 * @param [out]maybe_null true if null was seen for argument |
|
626 * @return true if profiling exists |
627 * |
627 * |
628 * If the profile reports that the argument may be null, return false |
|
629 * at least for now. |
|
630 */ |
628 */ |
631 ciKlass* ciMethod::return_profiled_type(int bci) { |
629 bool ciMethod::return_profiled_type(int bci, ciKlass*& type, bool& maybe_null) { |
632 if (MethodData::profile_return() && method_data() != NULL && method_data()->is_mature()) { |
630 if (MethodData::profile_return() && method_data() != NULL && method_data()->is_mature()) { |
633 ciProfileData* data = method_data()->bci_to_data(bci); |
631 ciProfileData* data = method_data()->bci_to_data(bci); |
634 if (data != NULL) { |
632 if (data != NULL) { |
635 if (data->is_VirtualCallTypeData()) { |
633 if (data->is_VirtualCallTypeData()) { |
636 assert_virtual_call_type_ok(bci); |
634 assert_virtual_call_type_ok(bci); |
637 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData(); |
635 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData(); |
638 ciKlass* type = call->valid_return_type(); |
636 type = call->valid_return_type(); |
639 if (type != NULL && !call->return_maybe_null()) { |
637 maybe_null = call->return_maybe_null(); |
640 return type; |
638 return true; |
641 } |
|
642 } else if (data->is_CallTypeData()) { |
639 } else if (data->is_CallTypeData()) { |
643 assert_call_type_ok(bci); |
640 assert_call_type_ok(bci); |
644 ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData(); |
641 ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData(); |
645 ciKlass* type = call->valid_return_type(); |
642 type = call->valid_return_type(); |
646 if (type != NULL && !call->return_maybe_null()) { |
643 maybe_null = call->return_maybe_null(); |
647 return type; |
644 return true; |
648 } |
|
649 } |
645 } |
650 } |
646 } |
651 } |
647 } |
652 return NULL; |
648 return false; |
653 } |
649 } |
654 |
650 |
655 /** |
651 /** |
656 * Check whether profiling provides a type for the parameter i |
652 * Check whether profiling provides a type for the parameter i |
657 * |
653 * |
658 * @param i parameter number |
654 * @param [in]i parameter number |
659 * @return profiled type |
655 * @param [out]type profiled type of parameter, NULL if none |
|
656 * @param [out]maybe_null true if null was seen for parameter |
|
657 * @return true if profiling exists |
660 * |
658 * |
661 * If the profile reports that the argument may be null, return false |
|
662 * at least for now. |
|
663 */ |
659 */ |
664 ciKlass* ciMethod::parameter_profiled_type(int i) { |
660 bool ciMethod::parameter_profiled_type(int i, ciKlass*& type, bool& maybe_null) { |
665 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) { |
661 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) { |
666 ciParametersTypeData* parameters = method_data()->parameters_type_data(); |
662 ciParametersTypeData* parameters = method_data()->parameters_type_data(); |
667 if (parameters != NULL && i < parameters->number_of_parameters()) { |
663 if (parameters != NULL && i < parameters->number_of_parameters()) { |
668 ciKlass* type = parameters->valid_parameter_type(i); |
664 type = parameters->valid_parameter_type(i); |
669 if (type != NULL && !parameters->parameter_maybe_null(i)) { |
665 maybe_null = parameters->parameter_maybe_null(i); |
670 return type; |
666 return true; |
671 } |
667 } |
672 } |
668 } |
673 } |
669 return false; |
674 return NULL; |
|
675 } |
670 } |
676 |
671 |
677 |
672 |
678 // ------------------------------------------------------------------ |
673 // ------------------------------------------------------------------ |
679 // ciMethod::find_monomorphic_target |
674 // ciMethod::find_monomorphic_target |