src/share/vm/ci/ciMethod.cpp

changeset 5991
b2ee5dc63353
parent 5907
c775af091fe9
child 6217
849eb7bfceac
child 6366
e46f2ee62e78
equal deleted inserted replaced
5990:8b4bbba322d3 5991:b2ee5dc63353
563 _receiver[i] = receiver; 563 _receiver[i] = receiver;
564 _receiver_count[i] = receiver_count; 564 _receiver_count[i] = receiver_count;
565 if (_limit < MorphismLimit) _limit++; 565 if (_limit < MorphismLimit) _limit++;
566 } 566 }
567 567
568
569 void ciMethod::assert_virtual_call_type_ok(int bci) {
570 assert(java_code_at_bci(bci) == Bytecodes::_invokevirtual ||
571 java_code_at_bci(bci) == Bytecodes::_invokeinterface, err_msg("unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci))));
572 }
573
574 void ciMethod::assert_call_type_ok(int bci) {
575 assert(java_code_at_bci(bci) == Bytecodes::_invokestatic ||
576 java_code_at_bci(bci) == Bytecodes::_invokespecial ||
577 java_code_at_bci(bci) == Bytecodes::_invokedynamic, err_msg("unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci))));
578 }
579
580 /**
581 * Check whether profiling provides a type for the argument i to the
582 * call at bci bci
583 *
584 * @param bci bci of the call
585 * @param i argument number
586 * @return profiled type
587 *
588 * If the profile reports that the argument may be null, return false
589 * at least for now.
590 */
591 ciKlass* ciMethod::argument_profiled_type(int bci, int i) {
592 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) {
593 ciProfileData* data = method_data()->bci_to_data(bci);
594 if (data != NULL) {
595 if (data->is_VirtualCallTypeData()) {
596 assert_virtual_call_type_ok(bci);
597 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData();
598 if (i >= call->number_of_arguments()) {
599 return NULL;
600 }
601 ciKlass* type = call->valid_argument_type(i);
602 if (type != NULL && !call->argument_maybe_null(i)) {
603 return type;
604 }
605 } else if (data->is_CallTypeData()) {
606 assert_call_type_ok(bci);
607 ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData();
608 if (i >= call->number_of_arguments()) {
609 return NULL;
610 }
611 ciKlass* type = call->valid_argument_type(i);
612 if (type != NULL && !call->argument_maybe_null(i)) {
613 return type;
614 }
615 }
616 }
617 }
618 return NULL;
619 }
620
621 /**
622 * Check whether profiling provides a type for the return value from
623 * the call at bci bci
624 *
625 * @param bci bci of the call
626 * @return profiled type
627 *
628 * If the profile reports that the argument may be null, return false
629 * at least for now.
630 */
631 ciKlass* ciMethod::return_profiled_type(int bci) {
632 if (MethodData::profile_return() && method_data() != NULL && method_data()->is_mature()) {
633 ciProfileData* data = method_data()->bci_to_data(bci);
634 if (data != NULL) {
635 if (data->is_VirtualCallTypeData()) {
636 assert_virtual_call_type_ok(bci);
637 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData();
638 ciKlass* type = call->valid_return_type();
639 if (type != NULL && !call->return_maybe_null()) {
640 return type;
641 }
642 } else if (data->is_CallTypeData()) {
643 assert_call_type_ok(bci);
644 ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData();
645 ciKlass* type = call->valid_return_type();
646 if (type != NULL && !call->return_maybe_null()) {
647 return type;
648 }
649 }
650 }
651 }
652 return NULL;
653 }
654
655 /**
656 * Check whether profiling provides a type for the parameter i
657 *
658 * @param i parameter number
659 * @return profiled type
660 *
661 * If the profile reports that the argument may be null, return false
662 * at least for now.
663 */
664 ciKlass* ciMethod::parameter_profiled_type(int i) {
665 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) {
666 ciParametersTypeData* parameters = method_data()->parameters_type_data();
667 if (parameters != NULL && i < parameters->number_of_parameters()) {
668 ciKlass* type = parameters->valid_parameter_type(i);
669 if (type != NULL && !parameters->parameter_maybe_null(i)) {
670 return type;
671 }
672 }
673 }
674 return NULL;
675 }
676
677
568 // ------------------------------------------------------------------ 678 // ------------------------------------------------------------------
569 // ciMethod::find_monomorphic_target 679 // ciMethod::find_monomorphic_target
570 // 680 //
571 // Given a certain calling environment, find the monomorphic target 681 // Given a certain calling environment, find the monomorphic target
572 // for the call. Return NULL if the call is not monomorphic in 682 // for the call. Return NULL if the call is not monomorphic in

mercurial