< prev index next >

src/share/vm/opto/bytecodeInfo.cpp

Print this page

        

@@ -27,10 +27,11 @@
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "compiler/compileBroker.hpp"
 #include "compiler/compileLog.hpp"
 #include "interpreter/linkResolver.hpp"
+#include "jfr/jfrEvents.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "opto/callGenerator.hpp"
 #include "opto/parse.hpp"
 #include "runtime/handles.inline.hpp"
 

@@ -477,13 +478,32 @@
   if (!callee->has_balanced_monitors())         return "not compilable (unbalanced monitors)";
   if ( callee->get_flow_analysis()->failing())  return "not compilable (flow analysis failed)";
   return NULL;
 }
 
+static void post_inlining_event(int compile_id,const char* msg, bool success, int bci, ciMethod* caller, ciMethod* callee) {
+  assert(caller != NULL, "invariant");
+  assert(callee != NULL, "invariant");
+  EventCompilerInlining event;
+  if (event.should_commit()) {
+    JfrStructCalleeMethod callee_struct;
+    callee_struct.set_type(callee->holder()->name()->as_utf8());
+    callee_struct.set_name(callee->name()->as_utf8());
+    callee_struct.set_descriptor(callee->signature()->as_symbol()->as_utf8());
+    event.set_compileId(compile_id);
+    event.set_message(msg);
+    event.set_succeeded(success);
+    event.set_bci(bci);
+    event.set_caller(caller->get_Method());
+    event.set_callee(callee_struct);
+    event.commit();
+  }
+}
+
 //------------------------------print_inlining---------------------------------
 void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci,
-                                bool success) const {
+                                ciMethod* caller_method, bool success) const {
   const char* inline_msg = msg();
   assert(inline_msg != NULL, "just checking");
   if (C->log() != NULL) {
     if (success) {
       C->log()->inline_success(inline_msg);

@@ -498,10 +518,11 @@
       const InlineTree *top = this;
       while( top->caller_tree() != NULL ) { top = top->caller_tree(); }
       //tty->print("  bcs: %d+%d  invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count());
     }
   }
+  post_inlining_event(C->compile_id(), inline_msg, success, caller_bci, caller_method, callee_method);
 }
 
 //------------------------------ok_to_inline-----------------------------------
 WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci, bool& should_delay) {
   assert(callee_method != NULL, "caller checks for optimized virtual!");

@@ -520,18 +541,18 @@
   ciMethod*   caller_method = jvms->method();
 
   // Do some initial checks.
   if (!pass_initial_checks(caller_method, caller_bci, callee_method)) {
     set_msg("failed initial checks");
-    print_inlining(callee_method, caller_bci, false /* !success */);
+    print_inlining(callee_method, caller_bci, caller_method, false /* !success */);
     return NULL;
   }
 
   // Do some parse checks.
   set_msg(check_can_parse(callee_method));
   if (msg() != NULL) {
-    print_inlining(callee_method, caller_bci, false /* !success */);
+    print_inlining(callee_method, caller_bci, caller_method, false /* !success */);
     return NULL;
   }
 
   // Check if inlining policy says no.
   WarmCallInfo wci = *(initial_wci);

@@ -569,22 +590,22 @@
   if (!wci.is_cold()) {
     // Inline!
     if (msg() == NULL) {
       set_msg("inline (hot)");
     }
-    print_inlining(callee_method, caller_bci, true /* success */);
+    print_inlining(callee_method, caller_bci, caller_method, true /* success */);
     build_inline_tree_for_callee(callee_method, jvms, caller_bci);
     if (InlineWarmCalls && !wci.is_hot())
       return new (C) WarmCallInfo(wci);  // copy to heap
     return WarmCallInfo::always_hot();
   }
 
   // Do not inline
   if (msg() == NULL) {
     set_msg("too cold to inline");
   }
-  print_inlining(callee_method, caller_bci, false /* !success */ );
+  print_inlining(callee_method, caller_bci, caller_method, false /* !success */ );
   return NULL;
 }
 
 //------------------------------compute_callee_frequency-----------------------
 float InlineTree::compute_callee_frequency( int caller_bci ) const {
< prev index next >