8059331: Print additional information for the assert in Compile::start()
authoranoll
Mon, 06 Oct 2014 06:51:37 -0700
changeset 27016 58e6c6d54017
parent 27015 7a7b66fbc782
child 27017 bae5d661dd4b
8059331: Print additional information for the assert in Compile::start() Summary: Add additional output that shows the failure reason Reviewed-by: kvn
hotspot/src/share/vm/opto/compile.cpp
hotspot/src/share/vm/opto/compile.hpp
--- a/hotspot/src/share/vm/opto/compile.cpp	Mon Oct 06 07:58:50 2014 +0200
+++ b/hotspot/src/share/vm/opto/compile.cpp	Mon Oct 06 06:51:37 2014 -0700
@@ -1153,12 +1153,18 @@
   assert(s == start(), "");
 }
 
+/**
+ * Return the 'StartNode'. We must not have a pending failure, since the ideal graph
+ * can be in an inconsistent state, i.e., we can get segmentation faults when traversing
+ * the ideal graph.
+ */
 StartNode* Compile::start() const {
-  assert(!failing(), "");
+  assert (!failing(), err_msg_res("Must not have pending failure. Reason is: %s", failure_reason()));
   for (DUIterator_Fast imax, i = root()->fast_outs(imax); i < imax; i++) {
     Node* start = root()->fast_out(i);
-    if( start->is_Start() )
+    if (start->is_Start()) {
       return start->as_Start();
+    }
   }
   fatal("Did not find Start node!");
   return NULL;
--- a/hotspot/src/share/vm/opto/compile.hpp	Mon Oct 06 07:58:50 2014 +0200
+++ b/hotspot/src/share/vm/opto/compile.hpp	Mon Oct 06 06:51:37 2014 -0700
@@ -707,12 +707,15 @@
   void sort_expensive_nodes();
 
   // Compilation environment.
-  Arena*            comp_arena()                { return &_comp_arena; }
-  ciEnv*            env() const                 { return _env; }
-  CompileLog*       log() const                 { return _log; }
-  bool              failing() const             { return _env->failing() || _failure_reason != NULL; }
-  const char*       failure_reason() { return _failure_reason; }
-  bool              failure_reason_is(const char* r) { return (r==_failure_reason) || (r!=NULL && _failure_reason!=NULL && strcmp(r, _failure_reason)==0); }
+  Arena*      comp_arena()           { return &_comp_arena; }
+  ciEnv*      env() const            { return _env; }
+  CompileLog* log() const            { return _log; }
+  bool        failing() const        { return _env->failing() || _failure_reason != NULL; }
+  const char* failure_reason() const { return (_env->failing()) ? _env->failure_reason() : _failure_reason; }
+
+  bool failure_reason_is(const char* r) const {
+    return (r == _failure_reason) || (r != NULL && _failure_reason != NULL && strcmp(r, _failure_reason) == 0);
+  }
 
   void record_failure(const char* reason);
   void record_method_not_compilable(const char* reason, bool all_tiers = false) {