diff --git a/src/hotspot/share/runtime/vmThread.cpp b/src/hotspot/share/runtime/vmThread.cpp index 45ebae1f61e..a517d4023da 100644 --- a/src/hotspot/share/runtime/vmThread.cpp +++ b/src/hotspot/share/runtime/vmThread.cpp @@ -401,17 +401,17 @@ void VMThread::inner_execute(VM_Operation* op) { HandleMark hm(VMThread::vm_thread()); const char* const cause = op->cause(); - EventMarkVMOperation em("Executing %sVM operation: %s%s%s%s", - prev_vm_operation != nullptr ? "nested " : "", - op->name(), - cause != nullptr ? " (" : "", - cause != nullptr ? cause : "", - cause != nullptr ? ")" : ""); + stringStream ss; + ss.print("Executing%s%s VM operation: %s", + prev_vm_operation != nullptr ? " nested" : "", + op->evaluate_at_safepoint() ? " safepoint" : " non-safepoint", + op->name()); + if (cause != nullptr) { + ss.print(" (%s)", cause); + } - log_debug(vmthread)("Evaluating %s %s VM operation: %s", - prev_vm_operation != nullptr ? "nested" : "", - _cur_vm_operation->evaluate_at_safepoint() ? "safepoint" : "non-safepoint", - _cur_vm_operation->name()); + EventMarkVMOperation em("%s", ss.freeze()); + log_debug(vmthread)("%s", ss.freeze()); bool end_safepoint = false; bool has_timeout_task = (_timeout_task != nullptr);