From b9c83b5d698e659d3de1f8e3a5dee56b9bbba510 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Mon, 18 Nov 2024 14:04:01 +0000 Subject: [PATCH] 8342823: Ubsan: ciEnv.cpp:1614:65: runtime error: member call on null pointer of type 'struct CompileTask' Backport-of: beff8bfe2a5334823b67cb748bc8652dc6a3f3d4 --- src/hotspot/share/ci/ciEnv.cpp | 6 +++--- src/hotspot/share/utilities/vmError.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index c3eaec2ea97..6112b46ac62 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -1655,6 +1655,8 @@ void ciEnv::dump_replay_data_helper(outputStream* out) { NoSafepointVerifier no_safepoint; ResourceMark rm; + assert(this->task() != nullptr, "task must not be null"); + dump_replay_data_version(out); #if INCLUDE_JVMTI out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables); @@ -1675,9 +1677,7 @@ void ciEnv::dump_replay_data_helper(outputStream* out) { objects->at(i)->dump_replay_data(out); } - if (this->task() != nullptr) { - dump_compile_data(out); - } + dump_compile_data(out); out->flush(); } diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 741ede5d41e..851ce3df516 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -1838,7 +1838,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) {