diff -r 01d31583f25c -r a645b2f7bece src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp --- a/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp Wed Sep 04 09:47:51 2019 +0200 +++ b/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp Wed Sep 04 09:47:55 2019 +0200 @@ -27,6 +27,7 @@ #include "gc/g1/heapRegion.hpp" #include "g1HeapRegionEventSender.hpp" #include "jfr/jfrEvents.hpp" +#include "runtime/vmThread.hpp" class DumpEventInfoClosure : public HeapRegionClosure { public: @@ -41,9 +42,17 @@ } }; +class VM_G1SendHeapRegionInfoEvents : public VM_Operation { + virtual void doit() { + DumpEventInfoClosure c; + G1CollectedHeap::heap()->heap_region_iterate(&c); + } + virtual VMOp_Type type() const { return VMOp_HeapIterateOperation; } +}; void G1HeapRegionEventSender::send_events() { - DumpEventInfoClosure c; - - G1CollectedHeap::heap()->heap_region_iterate(&c); + if (UseG1GC) { + VM_G1SendHeapRegionInfoEvents op; + VMThread::execute(&op); + } }