hotspot/src/share/vm/opto/doCall.cpp
changeset 8872 36680c58660e
parent 7397 5b173b4ca846
child 9118 a4c6e4429693
equal deleted inserted replaced
8871:5c3b26c4119e 8872:36680c58660e
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "ci/ciCPCache.hpp"
    26 #include "ci/ciCPCache.hpp"
    27 #include "ci/ciCallSite.hpp"
    27 #include "ci/ciCallSite.hpp"
    28 #include "ci/ciMethodHandle.hpp"
    28 #include "ci/ciMethodHandle.hpp"
    29 #include "classfile/vmSymbols.hpp"
    29 #include "classfile/vmSymbols.hpp"
       
    30 #include "compiler/compileBroker.hpp"
    30 #include "compiler/compileLog.hpp"
    31 #include "compiler/compileLog.hpp"
    31 #include "interpreter/linkResolver.hpp"
    32 #include "interpreter/linkResolver.hpp"
    32 #include "opto/addnode.hpp"
    33 #include "opto/addnode.hpp"
    33 #include "opto/callGenerator.hpp"
    34 #include "opto/callGenerator.hpp"
    34 #include "opto/cfgnode.hpp"
    35 #include "opto/cfgnode.hpp"
    41 #include "runtime/sharedRuntime.hpp"
    42 #include "runtime/sharedRuntime.hpp"
    42 
    43 
    43 #ifndef PRODUCT
    44 #ifndef PRODUCT
    44 void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) {
    45 void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) {
    45   if (TraceTypeProfile || PrintInlining || PrintOptoInlining) {
    46   if (TraceTypeProfile || PrintInlining || PrintOptoInlining) {
    46     tty->print("   ");
    47     if (!PrintInlining) {
    47     for( int i = 0; i < depth; i++ ) tty->print("  ");
    48       if (!PrintOpto && !PrintCompilation) {
    48     if (!PrintOpto) {
    49         method->print_short_name();
    49       method->print_short_name();
    50         tty->cr();
    50       tty->print(" ->");
    51       }
    51     }
    52       CompileTask::print_inlining(prof_method, depth, bci);
    52     tty->print(" @ %d  ", bci);
    53     }
    53     prof_method->print_short_name();
    54     CompileTask::print_inline_indent(depth);
    54     tty->print("  >>TypeProfile (%d/%d counts) = ", receiver_count, site_count);
    55     tty->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
    55     prof_klass->name()->print_symbol();
    56     prof_klass->name()->print_symbol();
    56     tty->print_cr(" (%d bytes)", prof_method->code_size());
    57     tty->cr();
    57   }
    58   }
    58 }
    59 }
    59 #endif
    60 #endif
    60 
    61 
    61 CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual,
    62 CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual,
   267             // in case of polymorphic virtual call site.
   268             // in case of polymorphic virtual call site.
   268             miss_cg = CallGenerator::for_virtual_call(call_method, vtable_index);
   269             miss_cg = CallGenerator::for_virtual_call(call_method, vtable_index);
   269           }
   270           }
   270           if (miss_cg != NULL) {
   271           if (miss_cg != NULL) {
   271             if (next_hit_cg != NULL) {
   272             if (next_hit_cg != NULL) {
   272               NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)));
   273               NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)));
   273               // We don't need to record dependency on a receiver here and below.
   274               // We don't need to record dependency on a receiver here and below.
   274               // Whenever we inline, the dependency is added by Parse::Parse().
   275               // Whenever we inline, the dependency is added by Parse::Parse().
   275               miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
   276               miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
   276             }
   277             }
   277             if (miss_cg != NULL) {
   278             if (miss_cg != NULL) {
   278               NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count));
   279               NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count));
   279               cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0));
   280               cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0));
   280               if (cg != NULL)  return cg;
   281               if (cg != NULL)  return cg;
   281             }
   282             }
   282           }
   283           }
   283         }
   284         }