src/share/vm/c1/c1_GraphBuilder.cpp

Print this page
rev 13113 : 8182651: Add TRACE_ONLY conditional macro to support more fine-grained INCLUDE_TRACE programming
Reviewed-by:

@@ -38,10 +38,14 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/vm_version.hpp"
 #include "utilities/bitMap.inline.hpp"
+#if INCLUDE_TRACE
+#include "trace/tracing.hpp"
+#include "tracefiles/traceEventClasses.hpp"
+#endif
 
 class BlockListBuilder VALUE_OBJ_CLASS_SPEC {
  private:
   Compilation* _compilation;
   IRScope*     _scope;

@@ -4275,10 +4279,37 @@
     load->set_flag(Instruction::NeedsRangeCheckFlag, false);
     push(load->type(), load);
   }
 }
 
+#if INCLUDE_TRACE
+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()) {
+    TraceStructCalleeMethod 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();
+  }
+}
+#endif // INCLUDE_TRACE
+
 void GraphBuilder::print_inlining(ciMethod* callee, const char* msg, bool success) {
   CompileLog* log = compilation()->log();
   if (log != NULL) {
     if (success) {
       if (msg != NULL)

@@ -4290,22 +4321,17 @@
         log->inline_fail(msg);
       else
         log->inline_fail("reason unknown");
     }
   }
-#if INCLUDE_TRACE
-  EventCompilerInlining event;
-  if (event.should_commit()) {
-    event.set_compileId(compilation()->env()->task()->compile_id());
-    event.set_message(msg);
-    event.set_succeeded(success);
-    event.set_bci(bci());
-    event.set_caller(method()->get_Method());
-    event.set_callee(callee->to_trace_struct());
-    event.commit();
-  }
-#endif // INCLUDE_TRACE
+
+  TRACE_ONLY(post_inlining_event(compilation()->env()->task()->compile_id(),
+                                 msg,
+                                 success,
+                                 bci(),
+                                 method(),
+                                 callee);)
 
   CompileTask::print_inlining_ul(callee, scope()->level(), bci(), msg);
 
   if (!compilation()->directive()->PrintInliningOption) {
     return;