From cbaf7f2f812ceffbb9831e24e458287a192694fc Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Sun, 4 Mar 2018 20:57:46 -0500 Subject: [PATCH] 8198845: Missing resource mark results disassembling generated code failure in hs error report Fixed secondary failure due to missing resource mark while disassembling nmethod Reviewed-by: coleenp, stuefe, dholmes --- src/hotspot/share/utilities/vmError.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 71554873698..7a55aad0b34 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -29,6 +29,7 @@ #include "compiler/disassembler.hpp" #include "gc/shared/collectedHeap.hpp" #include "logging/logConfiguration.hpp" +#include "memory/resourceArea.hpp" #include "prims/whitebox.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.hpp" @@ -773,7 +774,10 @@ void VMError::report(outputStream* st, bool _verbose) { if (desc != NULL) { desc->print_on(st); Disassembler::decode(desc->begin(), desc->end(), st); - } else { + } else if (_thread != NULL) { + // Disassembling nmethod will incur resource memory allocation, + // only do so when thread is valid. + ResourceMark rm(_thread); Disassembler::decode(cb, st); st->cr(); }