38 #include "opto/runtime.hpp" |
38 #include "opto/runtime.hpp" |
39 #include "opto/subnode.hpp" |
39 #include "opto/subnode.hpp" |
40 #include "prims/nativeLookup.hpp" |
40 #include "prims/nativeLookup.hpp" |
41 #include "runtime/sharedRuntime.hpp" |
41 #include "runtime/sharedRuntime.hpp" |
42 |
42 |
43 void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) { |
43 void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) { |
44 if (TraceTypeProfile || PrintInlining NOT_PRODUCT(|| PrintOptoInlining)) { |
44 if (TraceTypeProfile || PrintInlining NOT_PRODUCT(|| PrintOptoInlining)) { |
|
45 outputStream* out = tty; |
45 if (!PrintInlining) { |
46 if (!PrintInlining) { |
46 if (NOT_PRODUCT(!PrintOpto &&) !PrintCompilation) { |
47 if (NOT_PRODUCT(!PrintOpto &&) !PrintCompilation) { |
47 method->print_short_name(); |
48 method->print_short_name(); |
48 tty->cr(); |
49 tty->cr(); |
49 } |
50 } |
50 CompileTask::print_inlining(prof_method, depth, bci); |
51 CompileTask::print_inlining(prof_method, depth, bci); |
51 } |
52 } else { |
52 CompileTask::print_inline_indent(depth); |
53 out = C->print_inlining_stream(); |
53 tty->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); |
54 } |
54 prof_klass->name()->print_symbol(); |
55 CompileTask::print_inline_indent(depth, out); |
55 tty->cr(); |
56 out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); |
|
57 stringStream ss; |
|
58 prof_klass->name()->print_symbol_on(&ss); |
|
59 out->print(ss.as_string()); |
|
60 out->cr(); |
56 } |
61 } |
57 } |
62 } |
58 |
63 |
59 CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_is_virtual, |
64 CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_is_virtual, |
60 JVMState* jvms, bool allow_inline, |
65 JVMState* jvms, bool allow_inline, |
231 // in case of polymorphic virtual call site. |
236 // in case of polymorphic virtual call site. |
232 miss_cg = CallGenerator::for_virtual_call(callee, vtable_index); |
237 miss_cg = CallGenerator::for_virtual_call(callee, vtable_index); |
233 } |
238 } |
234 if (miss_cg != NULL) { |
239 if (miss_cg != NULL) { |
235 if (next_hit_cg != NULL) { |
240 if (next_hit_cg != NULL) { |
236 trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)); |
241 trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)); |
237 // We don't need to record dependency on a receiver here and below. |
242 // We don't need to record dependency on a receiver here and below. |
238 // Whenever we inline, the dependency is added by Parse::Parse(). |
243 // Whenever we inline, the dependency is added by Parse::Parse(). |
239 miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); |
244 miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); |
240 } |
245 } |
241 if (miss_cg != NULL) { |
246 if (miss_cg != NULL) { |
242 trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count); |
247 trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count); |
243 CallGenerator* cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0)); |
248 CallGenerator* cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0)); |
244 if (cg != NULL) return cg; |
249 if (cg != NULL) return cg; |
245 } |
250 } |
246 } |
251 } |
247 } |
252 } |