--- old/src/share/vm/gc_interface/collectedHeap.hpp 2013-09-06 14:11:10.444463280 +0200 +++ new/src/share/vm/gc_interface/collectedHeap.hpp 2013-09-06 14:11:10.348461540 +0200 @@ -474,6 +474,8 @@ // the context of the vm thread. virtual void collect_as_vm_thread(GCCause::Cause cause); + virtual void inform_non_gc_safepoint() {} + // Callback from VM_CollectForMetadataAllocation operation. MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, size_t size, @@ -663,4 +665,21 @@ } }; +class NonGCSafepointMark : StackObj { + CollectedHeap* _heap; + unsigned int _total_collections; + unsigned int _total_full_collections; +public: + NonGCSafepointMark(CollectedHeap* heap) : _heap(heap), + _total_collections(heap->total_collections()), + _total_full_collections(heap->total_full_collections()) { } + + ~NonGCSafepointMark() { + if (_heap->total_collections() == _total_collections && + _heap->total_full_collections() == _total_full_collections) { + _heap->inform_non_gc_safepoint(); + } + } +}; + #endif // SHARE_VM_GC_INTERFACE_COLLECTEDHEAP_HPP