changeset 48421:13f6856e8489

8194742: Writing replay data crashes: task is NULL Summary: Added missing NULL check. Reviewed-by: thartmann
author goetz
date Tue, 09 Jan 2018 16:24:24 +0100
parents f0e55fb9cfa3
children 2e5226ca1329
files src/hotspot/share/ci/ciEnv.cpp
diffstat 1 files changed, 18 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/ci/ciEnv.cpp	Fri Dec 15 16:51:13 2017 +0100
+++ b/src/hotspot/share/ci/ciEnv.cpp	Tue Jan 09 16:24:24 2018 +0100
@@ -1164,28 +1164,30 @@
 
 void ciEnv::dump_compile_data(outputStream* out) {
   CompileTask* task = this->task();
-  Method* method = task->method();
-  int entry_bci = task->osr_bci();
-  int comp_level = task->comp_level();
-  out->print("compile %s %s %s %d %d",
-                method->klass_name()->as_quoted_ascii(),
-                method->name()->as_quoted_ascii(),
-                method->signature()->as_quoted_ascii(),
-                entry_bci, comp_level);
-  if (compiler_data() != NULL) {
-    if (is_c2_compile(comp_level)) {
+  if (task) {
+    Method* method = task->method();
+    int entry_bci = task->osr_bci();
+    int comp_level = task->comp_level();
+    out->print("compile %s %s %s %d %d",
+               method->klass_name()->as_quoted_ascii(),
+               method->name()->as_quoted_ascii(),
+               method->signature()->as_quoted_ascii(),
+               entry_bci, comp_level);
+    if (compiler_data() != NULL) {
+      if (is_c2_compile(comp_level)) {
 #ifdef COMPILER2
-      // Dump C2 inlining data.
-      ((Compile*)compiler_data())->dump_inline_data(out);
+        // Dump C2 inlining data.
+        ((Compile*)compiler_data())->dump_inline_data(out);
 #endif
-    } else if (is_c1_compile(comp_level)) {
+      } else if (is_c1_compile(comp_level)) {
 #ifdef COMPILER1
-      // Dump C1 inlining data.
-      ((Compilation*)compiler_data())->dump_inline_data(out);
+        // Dump C1 inlining data.
+        ((Compilation*)compiler_data())->dump_inline_data(out);
 #endif
+      }
     }
+    out->cr();
   }
-  out->cr();
 }
 
 void ciEnv::dump_replay_data_unsafe(outputStream* out) {