8005439: no message about inline method if it specifed by CompileCommand
authorvlivanov
Fri, 01 Feb 2013 03:02:01 -0800
changeset 15472 ae13b6ad6c25
parent 15471 41f75023e6a6
child 15473 2bf0d154311a
8005439: no message about inline method if it specifed by CompileCommand Reviewed-by: kvn, vlivanov Contributed-by: Igor Ignatyev <igor.ignatyev@oracle.com>
hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
hotspot/src/share/vm/opto/bytecodeInfo.cpp
hotspot/src/share/vm/opto/parse.hpp
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Feb 01 02:50:23 2013 -0800
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Feb 01 03:02:01 2013 -0800
@@ -3667,11 +3667,12 @@
   }
 
   // now perform tests that are based on flag settings
-  if (callee->force_inline() || callee->should_inline()) {
-    // ignore heuristic controls on inlining
-    if (callee->force_inline())
-      print_inlining(callee, "force inline by annotation");
+  if (callee->force_inline()) {
+    print_inlining(callee, "force inline by annotation");
+  } else if (callee->should_inline()) {
+    print_inlining(callee, "force inline by CompileOracle");
   } else {
+    // use heuristic controls on inlining
     if (inline_level() > MaxInlineLevel                         ) INLINE_BAILOUT("inlining too deep");
     if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("recursive inlining too deep");
     if (callee->code_size_for_inlining() > max_inline_size()    ) INLINE_BAILOUT("callee is too large");
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Fri Feb 01 02:50:23 2013 -0800
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Fri Feb 01 03:02:01 2013 -0800
@@ -420,14 +420,24 @@
 }
 
 //------------------------------print_inlining---------------------------------
-// Really, the failure_msg can be a success message also.
-void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const {
-  C->print_inlining(callee_method, inline_level(), caller_bci, failure_msg ? failure_msg : "inline");
-  if (callee_method == NULL)  tty->print(" callee not monotonic or profiled");
-  if (Verbose && callee_method) {
-    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());
+void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci,
+                                const char* msg, bool success) const {
+  assert(msg != NULL, "just checking");
+  if (C->log() != NULL) {
+    if (success) {
+      C->log()->inline_success(msg);
+    } else {
+      C->log()->inline_fail(msg);
+    }
+  }
+  if (PrintInlining) {
+    C->print_inlining(callee_method, inline_level(), caller_bci, msg);
+    if (callee_method == NULL) tty->print(" callee not monotonic or profiled");
+    if (Verbose && callee_method) {
+      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());
+    }
   }
 }
 
@@ -451,23 +461,23 @@
 
   // Do some initial checks.
   if (!pass_initial_checks(caller_method, caller_bci, callee_method)) {
-    if (PrintInlining)  print_inlining(callee_method, caller_bci, "failed initial checks");
+    print_inlining(callee_method, caller_bci, "failed initial checks",
+                   false /* !success */);
     return NULL;
   }
 
   // Do some parse checks.
   failure_msg = check_can_parse(callee_method);
   if (failure_msg != NULL) {
-    if (PrintInlining)  print_inlining(callee_method, caller_bci, failure_msg);
+    print_inlining(callee_method, caller_bci, failure_msg,
+                   false /* !success */);
     return NULL;
   }
 
   // Check if inlining policy says no.
   WarmCallInfo wci = *(initial_wci);
-  failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci, should_delay);
-  if (failure_msg != NULL && C->log() != NULL) {
-    C->log()->inline_fail(failure_msg);
-  }
+  failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile,
+                              &wci, should_delay);
 
 #ifndef PRODUCT
   if (UseOldInlining && InlineWarmCalls
@@ -487,7 +497,7 @@
       wci = *(WarmCallInfo::always_hot());
     else
       wci = *(WarmCallInfo::always_cold());
-  }
+    }
   if (!InlineWarmCalls) {
     if (!wci.is_cold() && !wci.is_hot()) {
       // Do not inline the warm calls.
@@ -496,11 +506,10 @@
   }
 
   if (!wci.is_cold()) {
-    // In -UseOldInlining, the failure_msg may also be a success message.
-    if (failure_msg == NULL)  failure_msg = "inline (hot)";
-
     // Inline!
-    if (PrintInlining)  print_inlining(callee_method, caller_bci, failure_msg);
+    print_inlining(callee_method, caller_bci,
+                   failure_msg ? failure_msg : "inline (hot)",
+                   true /* success */);
     if (UseOldInlining)
       build_inline_tree_for_callee(callee_method, jvms, caller_bci);
     if (InlineWarmCalls && !wci.is_hot())
@@ -509,8 +518,9 @@
   }
 
   // Do not inline
-  if (failure_msg == NULL)  failure_msg = "too cold to inline";
-  if (PrintInlining)  print_inlining(callee_method, caller_bci, failure_msg);
+  print_inlining(callee_method, caller_bci,
+                 failure_msg ? failure_msg : "too cold to inline",
+                 false /* !success */ );
   return NULL;
 }
 
--- a/hotspot/src/share/vm/opto/parse.hpp	Fri Feb 01 02:50:23 2013 -0800
+++ b/hotspot/src/share/vm/opto/parse.hpp	Fri Feb 01 03:02:01 2013 -0800
@@ -73,7 +73,8 @@
   const char* try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result, bool& should_delay);
   const char* should_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) const;
   const char* should_not_inline(ciMethod* callee_method, ciMethod* caller_method, WarmCallInfo* wci_result) const;
-  void        print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const;
+  void        print_inlining(ciMethod* callee_method, int caller_bci,
+                             const char* msg, bool success) const;
 
   InlineTree *caller_tree()       const { return _caller_tree;  }
   InlineTree* callee_at(int bci, ciMethod* m) const;