From 1d240ea16fd68257b4062f7a120346aff37c4a69 Mon Sep 17 00:00:00 2001 From: MBaesken Date: Mon, 28 Oct 2024 15:59:00 +0100 Subject: [PATCH] move check, add assert --- src/hotspot/share/ci/ciEnv.cpp | 4 +--- src/hotspot/share/utilities/vmError.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index 3c6316cd6fecf..6bf8f44553d6e 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -1597,9 +1597,7 @@ void ciEnv::dump_replay_data_helper(outputStream* out) { NoSafepointVerifier no_safepoint; ResourceMark rm; - if (this->task() == nullptr) { - return; - } + assert(this->task() != nullptr, "task must not be null"); dump_replay_data_version(out); #if INCLUDE_JVMTI diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 7bbb978b8064f..23db59f766ae6 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -1862,7 +1862,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) { skip_replay = true; ciEnv* env = ciEnv::current(); - if (env != nullptr) { + if (env != nullptr && env->task() != nullptr) { const bool overwrite = false; // We do not overwrite an existing replay file. int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", overwrite, buffer, sizeof(buffer)); if (fd != -1) {