src/share/vm/opto/bytecodeInfo.cpp

changeset 9931
fd44df5e3bc3
parent 9640
017b3a2aca37
parent 9858
b985cbb00e68
     1.1 --- a/src/share/vm/opto/bytecodeInfo.cpp	Wed Oct 14 16:43:13 2020 +0800
     1.2 +++ b/src/share/vm/opto/bytecodeInfo.cpp	Wed Oct 14 17:44:48 2020 +0800
     1.3 @@ -29,6 +29,7 @@
     1.4  #include "compiler/compileBroker.hpp"
     1.5  #include "compiler/compileLog.hpp"
     1.6  #include "interpreter/linkResolver.hpp"
     1.7 +#include "jfr/jfrEvents.hpp"
     1.8  #include "oops/objArrayKlass.hpp"
     1.9  #include "opto/callGenerator.hpp"
    1.10  #include "opto/parse.hpp"
    1.11 @@ -490,9 +491,28 @@
    1.12    return NULL;
    1.13  }
    1.14  
    1.15 +static void post_inlining_event(int compile_id,const char* msg, bool success, int bci, ciMethod* caller, ciMethod* callee) {
    1.16 +  assert(caller != NULL, "invariant");
    1.17 +  assert(callee != NULL, "invariant");
    1.18 +  EventCompilerInlining event;
    1.19 +  if (event.should_commit()) {
    1.20 +    JfrStructCalleeMethod callee_struct;
    1.21 +    callee_struct.set_type(callee->holder()->name()->as_utf8());
    1.22 +    callee_struct.set_name(callee->name()->as_utf8());
    1.23 +    callee_struct.set_descriptor(callee->signature()->as_symbol()->as_utf8());
    1.24 +    event.set_compileId(compile_id);
    1.25 +    event.set_message(msg);
    1.26 +    event.set_succeeded(success);
    1.27 +    event.set_bci(bci);
    1.28 +    event.set_caller(caller->get_Method());
    1.29 +    event.set_callee(callee_struct);
    1.30 +    event.commit();
    1.31 +  }
    1.32 +}
    1.33 +
    1.34  //------------------------------print_inlining---------------------------------
    1.35  void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci,
    1.36 -                                bool success) const {
    1.37 +                                ciMethod* caller_method, bool success) const {
    1.38    const char* inline_msg = msg();
    1.39    assert(inline_msg != NULL, "just checking");
    1.40    if (C->log() != NULL) {
    1.41 @@ -511,6 +531,7 @@
    1.42        //tty->print("  bcs: %d+%d  invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count());
    1.43      }
    1.44    }
    1.45 +  post_inlining_event(C->compile_id(), inline_msg, success, caller_bci, caller_method, callee_method);
    1.46  }
    1.47  
    1.48  //------------------------------ok_to_inline-----------------------------------
    1.49 @@ -533,14 +554,14 @@
    1.50    // Do some initial checks.
    1.51    if (!pass_initial_checks(caller_method, caller_bci, callee_method)) {
    1.52      set_msg("failed initial checks");
    1.53 -    print_inlining(callee_method, caller_bci, false /* !success */);
    1.54 +    print_inlining(callee_method, caller_bci, caller_method, false /* !success */);
    1.55      return NULL;
    1.56    }
    1.57  
    1.58    // Do some parse checks.
    1.59    set_msg(check_can_parse(callee_method));
    1.60    if (msg() != NULL) {
    1.61 -    print_inlining(callee_method, caller_bci, false /* !success */);
    1.62 +    print_inlining(callee_method, caller_bci, caller_method, false /* !success */);
    1.63      return NULL;
    1.64    }
    1.65  
    1.66 @@ -582,7 +603,7 @@
    1.67      if (msg() == NULL) {
    1.68        set_msg("inline (hot)");
    1.69      }
    1.70 -    print_inlining(callee_method, caller_bci, true /* success */);
    1.71 +    print_inlining(callee_method, caller_bci, caller_method, true /* success */);
    1.72      build_inline_tree_for_callee(callee_method, jvms, caller_bci);
    1.73      if (InlineWarmCalls && !wci.is_hot())
    1.74        return new (C) WarmCallInfo(wci);  // copy to heap
    1.75 @@ -593,7 +614,7 @@
    1.76    if (msg() == NULL) {
    1.77      set_msg("too cold to inline");
    1.78    }
    1.79 -  print_inlining(callee_method, caller_bci, false /* !success */ );
    1.80 +  print_inlining(callee_method, caller_bci, caller_method, false /* !success */ );
    1.81    return NULL;
    1.82  }
    1.83  

mercurial