src/share/vm/gc_interface/collectedHeap.hpp
Print this page
rev 4973 : imported patch checkpointing.diff
@@ -472,10 +472,12 @@
// vm thread. It collects the heap assuming that the
// heap lock is already held and that we are executing in
// 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,
Metaspace::MetadataType mdtype);
@@ -661,6 +663,23 @@
"This method manipulates heap state without locking");
_heap->set_gc_cause(_previous_cause);
}
};
+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