19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_SHARED_ISGCACTIVEMARK_HPP
26 #define SHARE_VM_GC_SHARED_ISGCACTIVEMARK_HPP
27
28 #include "gc/shared/collectedHeap.hpp"
29 #include "memory/allocation.hpp"
30 #include "memory/universe.hpp"
31 #include "utilities/debug.hpp"
32
33 // This class provides a method for block structured setting of the
34 // _is_gc_active state without requiring accessors in CollectedHeap
35
36 class IsGCActiveMark : public StackObj {
37 public:
38 IsGCActiveMark() {
39 CollectedHeap* heap = Universe::heap();
40 assert(!heap->is_gc_active(), "Not reentrant");
41 heap->_is_gc_active = true;
42 }
43
44 ~IsGCActiveMark() {
45 CollectedHeap* heap = Universe::heap();
46 assert(heap->is_gc_active(), "Sanity");
47 heap->_is_gc_active = false;
48 }
49 };
50
51 #endif // SHARE_VM_GC_SHARED_ISGCACTIVEMARK_HPP
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_SHARED_ISGCACTIVEMARK_HPP
26 #define SHARE_VM_GC_SHARED_ISGCACTIVEMARK_HPP
27
28 #include "gc/shared/collectedHeap.hpp"
29 #include "memory/allocation.hpp"
30 #include "memory/universe.hpp"
31 #include "utilities/debug.hpp"
32
33 // This class provides a method for block structured setting of the
34 // _is_gc_active state without requiring accessors in CollectedHeap
35
36 class IsGCActiveMark : public StackObj {
37 public:
38 IsGCActiveMark() {
39 CollectedHeap* heap = GC::gc()->heap();
40 assert(!heap->is_gc_active(), "Not reentrant");
41 heap->_is_gc_active = true;
42 }
43
44 ~IsGCActiveMark() {
45 CollectedHeap* heap = GC::gc()->heap();
46 assert(heap->is_gc_active(), "Sanity");
47 heap->_is_gc_active = false;
48 }
49 };
50
51 #endif // SHARE_VM_GC_SHARED_ISGCACTIVEMARK_HPP
|