comparison src/share/vm/c1/c1_LIRGenerator.cpp @ 12882:ce0cc25bc5e2

8026054: New type profiling points: type of return values at calls Summary: x86 interpreter and c1 type profiling for return values at calls Reviewed-by: kvn, twisti
author roland
date Sat, 12 Oct 2013 12:12:59 +0200
parents d13d7aba8c12
children 252d541466ea
comparison
equal deleted inserted replaced
12881:ed2c74787eb5 12882:ce0cc25bc5e2
3087 LIR_Opr mdp = LIR_OprFact::illegalOpr; 3087 LIR_Opr mdp = LIR_OprFact::illegalOpr;
3088 ciTypeStackSlotEntries* args = data->is_CallTypeData() ? ((ciCallTypeData*)data)->args() : ((ciVirtualCallTypeData*)data)->args(); 3088 ciTypeStackSlotEntries* args = data->is_CallTypeData() ? ((ciCallTypeData*)data)->args() : ((ciVirtualCallTypeData*)data)->args();
3089 3089
3090 Bytecodes::Code bc = x->method()->java_code_at_bci(bci); 3090 Bytecodes::Code bc = x->method()->java_code_at_bci(bci);
3091 int start = 0; 3091 int start = 0;
3092 int stop = args->number_of_arguments(); 3092 int stop = data->is_CallTypeData() ? ((ciCallTypeData*)data)->number_of_arguments() : ((ciVirtualCallTypeData*)data)->number_of_arguments();
3093 if (x->nb_profiled_args() < stop) { 3093 if (x->nb_profiled_args() < stop) {
3094 // if called through method handle invoke, some arguments may have been popped 3094 // if called through method handle invoke, some arguments may have been popped
3095 stop = x->nb_profiled_args(); 3095 stop = x->nb_profiled_args();
3096 } 3096 }
3097 ciSignature* sig = x->callee()->signature(); 3097 ciSignature* sig = x->callee()->signature();
3098 // method handle call to virtual method 3098 // method handle call to virtual method
3099 bool has_receiver = x->inlined() && !x->callee()->is_static() && !Bytecodes::has_receiver(bc); 3099 bool has_receiver = x->inlined() && !x->callee()->is_static() && !Bytecodes::has_receiver(bc);
3100 ciSignatureStream sig_stream(sig, has_receiver ? x->callee()->holder() : NULL); 3100 ciSignatureStream sig_stream(sig, has_receiver ? x->callee()->holder() : NULL);
3101 for (int i = 0; i < stop; i++) { 3101 for (int i = 0; i < stop; i++) {
3102 int off = in_bytes(TypeStackSlotEntries::type_offset(i)) - in_bytes(TypeStackSlotEntries::args_data_offset()); 3102 int off = in_bytes(TypeEntriesAtCall::argument_type_offset(i)) - in_bytes(TypeEntriesAtCall::args_data_offset());
3103 ciKlass* exact = profile_arg_type(md, base_offset, off, 3103 ciKlass* exact = profile_arg_type(md, base_offset, off,
3104 args->type(i), x->profiled_arg_at(i+start), mdp, 3104 args->type(i), x->profiled_arg_at(i+start), mdp,
3105 !x->arg_needs_null_check(i+start), sig_stream.next_klass()); 3105 !x->arg_needs_null_check(i+start), sig_stream.next_klass());
3106 if (exact != NULL) { 3106 if (exact != NULL) {
3107 md->set_argument_type(bci, i, exact); 3107 md->set_argument_type(bci, i, exact);
3127 value.load_item(); 3127 value.load_item();
3128 recv = new_register(T_OBJECT); 3128 recv = new_register(T_OBJECT);
3129 __ move(value.result(), recv); 3129 __ move(value.result(), recv);
3130 } 3130 }
3131 __ profile_call(x->method(), x->bci_of_invoke(), x->callee(), mdo, recv, tmp, x->known_holder()); 3131 __ profile_call(x->method(), x->bci_of_invoke(), x->callee(), mdo, recv, tmp, x->known_holder());
3132 }
3133
3134 void LIRGenerator::do_ProfileReturnType(ProfileReturnType* x) {
3135 int bci = x->bci_of_invoke();
3136 ciMethodData* md = x->method()->method_data_or_null();
3137 ciProfileData* data = md->bci_to_data(bci);
3138 assert(data->is_CallTypeData() || data->is_VirtualCallTypeData(), "wrong profile data type");
3139 ciReturnTypeEntry* ret = data->is_CallTypeData() ? ((ciCallTypeData*)data)->ret() : ((ciVirtualCallTypeData*)data)->ret();
3140 LIR_Opr mdp = LIR_OprFact::illegalOpr;
3141 ciKlass* exact = profile_arg_type(md, 0, md->byte_offset_of_slot(data, ret->type_offset()),
3142 ret->type(), x->ret(), mdp,
3143 !x->needs_null_check(), x->callee()->signature()->return_type()->as_klass());
3144 if (exact != NULL) {
3145 md->set_return_type(bci, exact);
3146 }
3132 } 3147 }
3133 3148
3134 void LIRGenerator::do_ProfileInvoke(ProfileInvoke* x) { 3149 void LIRGenerator::do_ProfileInvoke(ProfileInvoke* x) {
3135 // We can safely ignore accessors here, since c2 will inline them anyway, 3150 // We can safely ignore accessors here, since c2 will inline them anyway,
3136 // accessors are also always mature. 3151 // accessors are also always mature.