595
596 #ifdef ASSERT
597 static int fired_fake_oom() {
598 return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
599 }
600 #endif
601
602 public:
603 // Copy the current allocation context statistics for the specified contexts.
604 // For each context in contexts, set the corresponding entries in the totals
605 // and accuracy arrays to the current values held by the statistics. Each
606 // array should be of length len.
607 // Returns true if there are more stats available.
608 virtual bool copy_allocation_context_stats(const jint* contexts,
609 jlong* totals,
610 jbyte* accuracy,
611 jint len) {
612 return false;
613 }
614
615 /////////////// Unit tests ///////////////
616
617 NOT_PRODUCT(static void test_is_in();)
618 };
619
620 // Class to set and reset the GC cause for a CollectedHeap.
621
622 class GCCauseSetter : StackObj {
623 CollectedHeap* _heap;
624 GCCause::Cause _previous_cause;
625 public:
626 GCCauseSetter(CollectedHeap* heap, GCCause::Cause cause) {
627 assert(SafepointSynchronize::is_at_safepoint(),
628 "This method manipulates heap state without locking");
629 _heap = heap;
630 _previous_cause = _heap->gc_cause();
631 _heap->set_gc_cause(cause);
632 }
633
634 ~GCCauseSetter() {
635 assert(SafepointSynchronize::is_at_safepoint(),
636 "This method manipulates heap state without locking");
637 _heap->set_gc_cause(_previous_cause);
|
595
596 #ifdef ASSERT
597 static int fired_fake_oom() {
598 return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
599 }
600 #endif
601
602 public:
603 // Copy the current allocation context statistics for the specified contexts.
604 // For each context in contexts, set the corresponding entries in the totals
605 // and accuracy arrays to the current values held by the statistics. Each
606 // array should be of length len.
607 // Returns true if there are more stats available.
608 virtual bool copy_allocation_context_stats(const jint* contexts,
609 jlong* totals,
610 jbyte* accuracy,
611 jint len) {
612 return false;
613 }
614
615 };
616
617 // Class to set and reset the GC cause for a CollectedHeap.
618
619 class GCCauseSetter : StackObj {
620 CollectedHeap* _heap;
621 GCCause::Cause _previous_cause;
622 public:
623 GCCauseSetter(CollectedHeap* heap, GCCause::Cause cause) {
624 assert(SafepointSynchronize::is_at_safepoint(),
625 "This method manipulates heap state without locking");
626 _heap = heap;
627 _previous_cause = _heap->gc_cause();
628 _heap->set_gc_cause(cause);
629 }
630
631 ~GCCauseSetter() {
632 assert(SafepointSynchronize::is_at_safepoint(),
633 "This method manipulates heap state without locking");
634 _heap->set_gc_cause(_previous_cause);
|