8145345: LogCompilation output is empty after JEP165: Compiler Control
authorneliasso
Wed, 16 Dec 2015 15:39:11 +0100
changeset 35130 223598d44a8b
parent 35129 8b93709bf4e5
child 35131 d231aa9f57ba
8145345: LogCompilation output is empty after JEP165: Compiler Control Summary: Fix default init and compilecommand update Reviewed-by: kvn
hotspot/src/share/vm/compiler/compilerDirectives.cpp
hotspot/src/share/vm/compiler/compilerDirectives.hpp
hotspot/src/share/vm/compiler/directivesParser.cpp
--- a/hotspot/src/share/vm/compiler/compilerDirectives.cpp	Wed Dec 16 15:38:28 2015 +0100
+++ b/hotspot/src/share/vm/compiler/compilerDirectives.cpp	Wed Dec 16 15:39:11 2015 +0100
@@ -86,16 +86,21 @@
   //---
 }
 
-void CompilerDirectives::finalize() {
+void CompilerDirectives::finalize(outputStream* st) {
   if (_c1_store != NULL) {
-    _c1_store->finalize();
+    _c1_store->finalize(st);
   }
   if (_c2_store != NULL) {
-    _c2_store->finalize();
+    _c2_store->finalize(st);
   }
 }
 
-void DirectiveSet::finalize() {
+void DirectiveSet::finalize(outputStream* st) {
+  // Check LogOption and warn
+  if (LogOption && !LogCompilation) {
+    st->print_cr("Warning:  +LogCompilation must be set to enable compilation logging from directives");
+  }
+
   // if any flag has been modified - set directive as enabled
   // unless it already has been explicitly set.
   if (!_modified[EnableIndex]) {
@@ -252,12 +257,14 @@
         changed = true;
       }
     }
-    if (CompilerOracle::should_log(method)) {
-      if (!_modified[LogIndex]) {
-        set->LogOption = true;
+    if (!_modified[LogIndex]) {
+      bool log = CompilerOracle::should_log(method);
+      if (log != set->LogOption) {
+        set->LogOption = log;
         changed = true;
       }
     }
+
     if (CompilerOracle::should_print(method)) {
       if (!_modified[PrintAssemblyIndex]) {
         set->PrintAssemblyOption = true;
--- a/hotspot/src/share/vm/compiler/compilerDirectives.hpp	Wed Dec 16 15:38:28 2015 +0100
+++ b/hotspot/src/share/vm/compiler/compilerDirectives.hpp	Wed Dec 16 15:39:11 2015 +0100
@@ -39,7 +39,7 @@
     cflags(Exclude,                 bool, false, X) \
     cflags(BreakAtExecute,          bool, false, X) \
     cflags(BreakAtCompile,          bool, false, X) \
-    cflags(Log,                     bool, false, X) \
+    cflags(Log,                     bool, LogCompilation, X) \
     cflags(PrintAssembly,           bool, PrintAssembly, PrintAssembly) \
     cflags(PrintInlining,           bool, PrintInlining, PrintInlining) \
     cflags(PrintNMethods,           bool, PrintNMethods, PrintNMethods) \
@@ -117,7 +117,7 @@
   bool matches_inline(methodHandle method, int inline_action);
   static DirectiveSet* clone(DirectiveSet const* src);
   bool is_intrinsic_disabled(methodHandle method);
-  void finalize();
+  void finalize(outputStream* st);
 
   typedef enum {
 #define enum_of_flags(name, type, dvalue, cc_flag) name##Index,
@@ -177,7 +177,7 @@
   DirectiveSet* get_for(AbstractCompiler *comp);
   void print(outputStream* st);
   bool is_default_directive() { return _next == NULL; }
-  void finalize();
+  void finalize(outputStream* st);
 
   void inc_refcount();
   void dec_refcount();
--- a/hotspot/src/share/vm/compiler/directivesParser.cpp	Wed Dec 16 15:38:28 2015 +0100
+++ b/hotspot/src/share/vm/compiler/directivesParser.cpp	Wed Dec 16 15:39:11 2015 +0100
@@ -542,7 +542,7 @@
           error(INTERNAL_ERROR, "Directive missing required match.");
           return false;
         }
-        current_directive->finalize();
+        current_directive->finalize(_st);
         push_tmp(current_directive);
         current_directive = NULL;
         break;