8198845: Missing resource mark results disassembling generated code failure in hs error report
Summary: Fixed secondary failure due to missing resource mark while disassembling nmethod
Reviewed-by: coleenp, stuefe, dholmes
--- a/src/hotspot/share/utilities/vmError.cpp Sat Mar 03 23:56:08 2018 -0500
+++ b/src/hotspot/share/utilities/vmError.cpp Sun Mar 04 20:57:46 2018 -0500
@@ -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 @@
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();
}