2700 ciMethod* method = op->profiled_method();
2701 int bci = op->profiled_bci();
2702 ciMethod* callee = op->profiled_callee();
2703
2704 // Update counter for all call types.
2705 ciMethodData* md = method->method_data_or_null();
2706 assert(md != NULL, "Sanity");
2707 ciProfileData* data = md->bci_to_data(bci);
2708 assert(data->is_CounterData(), "need CounterData for calls");
2709 assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
2710 Register mdo = op->mdo()->as_register();
2711 assert(op->tmp1()->is_double_cpu(), "tmp1 must be allocated");
2712 Register tmp1 = op->tmp1()->as_register_lo();
2713 metadata2reg(md->constant_encoding(), mdo);
2714
2715 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
2716 Bytecodes::Code bc = method->java_code_at_bci(bci);
2717 const bool callee_is_static = callee->is_loaded() && callee->is_static();
2718 // Perform additional virtual call profiling for invokevirtual and
2719 // invokeinterface bytecodes.
2720 if ((bc == Bytecodes::_invokevirtual || bc == Bytecodes::_invokeinterface) &&
2721 !callee_is_static && // Required for optimized MH invokes.
2722 C1ProfileVirtualCalls) {
2723 assert(op->recv()->is_single_cpu(), "recv must be allocated");
2724 Register recv = op->recv()->as_register();
2725 assert_different_registers(mdo, tmp1, recv);
2726 assert(data->is_VirtualCallData(), "need VirtualCallData for virtual calls");
2727 ciKlass* known_klass = op->known_holder();
2728 if (C1OptimizeVirtualCallProfiling && known_klass != NULL) {
2729 // We know the type that will be seen at this call site; we can
2730 // statically update the MethodData* rather than needing to do
2731 // dynamic tests on the receiver type.
2732
2733 // NOTE: we should probably put a lock around this search to
2734 // avoid collisions by concurrent compilations.
2735 ciVirtualCallData* vc_data = (ciVirtualCallData*) data;
2736 uint i;
2737 for (i = 0; i < VirtualCallData::row_limit(); i++) {
2738 ciKlass* receiver = vc_data->receiver(i);
2739 if (known_klass->equals(receiver)) {
2740 Address data_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i)));
|
2700 ciMethod* method = op->profiled_method();
2701 int bci = op->profiled_bci();
2702 ciMethod* callee = op->profiled_callee();
2703
2704 // Update counter for all call types.
2705 ciMethodData* md = method->method_data_or_null();
2706 assert(md != NULL, "Sanity");
2707 ciProfileData* data = md->bci_to_data(bci);
2708 assert(data->is_CounterData(), "need CounterData for calls");
2709 assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
2710 Register mdo = op->mdo()->as_register();
2711 assert(op->tmp1()->is_double_cpu(), "tmp1 must be allocated");
2712 Register tmp1 = op->tmp1()->as_register_lo();
2713 metadata2reg(md->constant_encoding(), mdo);
2714
2715 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
2716 Bytecodes::Code bc = method->java_code_at_bci(bci);
2717 const bool callee_is_static = callee->is_loaded() && callee->is_static();
2718 // Perform additional virtual call profiling for invokevirtual and
2719 // invokeinterface bytecodes.
2720 if (((bc == Bytecodes::_invokevirtual && !callee->can_be_statically_bound()) ||
2721 bc == Bytecodes::_invokeinterface) &&
2722 !callee_is_static && // Required for optimized MH invokes.
2723 C1ProfileVirtualCalls) {
2724 assert(op->recv()->is_single_cpu(), "recv must be allocated");
2725 Register recv = op->recv()->as_register();
2726 assert_different_registers(mdo, tmp1, recv);
2727 assert(data->is_VirtualCallData(), "need VirtualCallData for virtual calls");
2728 ciKlass* known_klass = op->known_holder();
2729 if (C1OptimizeVirtualCallProfiling && known_klass != NULL) {
2730 // We know the type that will be seen at this call site; we can
2731 // statically update the MethodData* rather than needing to do
2732 // dynamic tests on the receiver type.
2733
2734 // NOTE: we should probably put a lock around this search to
2735 // avoid collisions by concurrent compilations.
2736 ciVirtualCallData* vc_data = (ciVirtualCallData*) data;
2737 uint i;
2738 for (i = 0; i < VirtualCallData::row_limit(); i++) {
2739 ciKlass* receiver = vc_data->receiver(i);
2740 if (known_klass->equals(receiver)) {
2741 Address data_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i)));
|