comparison src/share/vm/gc_interface/collectedHeap.hpp @ 1833:8b10f48633dc

6984287: Regularize how GC parallel workers are specified. Summary: Associate number of GC workers with the workgang as opposed to the task. Reviewed-by: johnc, ysr
author jmasa
date Mon, 20 Sep 2010 14:38:38 -0700
parents c18cbe5936b8
children f95d63e2154a
comparison
equal deleted inserted replaced
1781:97fbf5beff7b 1833:8b10f48633dc
57 57
58 protected: 58 protected:
59 MemRegion _reserved; 59 MemRegion _reserved;
60 BarrierSet* _barrier_set; 60 BarrierSet* _barrier_set;
61 bool _is_gc_active; 61 bool _is_gc_active;
62 int _n_par_threads;
63
62 unsigned int _total_collections; // ... started 64 unsigned int _total_collections; // ... started
63 unsigned int _total_full_collections; // ... started 65 unsigned int _total_full_collections; // ... started
64 NOT_PRODUCT(volatile size_t _promotion_failure_alot_count;) 66 NOT_PRODUCT(volatile size_t _promotion_failure_alot_count;)
65 NOT_PRODUCT(volatile size_t _promotion_failure_alot_gc_number;) 67 NOT_PRODUCT(volatile size_t _promotion_failure_alot_gc_number;)
66 68
290 _perf_gc_cause->set_value(GCCause::to_string(v)); 292 _perf_gc_cause->set_value(GCCause::to_string(v));
291 } 293 }
292 _gc_cause = v; 294 _gc_cause = v;
293 } 295 }
294 GCCause::Cause gc_cause() { return _gc_cause; } 296 GCCause::Cause gc_cause() { return _gc_cause; }
297
298 // Number of threads currently working on GC tasks.
299 int n_par_threads() { return _n_par_threads; }
300
301 // May be overridden to set additional parallelism.
302 virtual void set_par_threads(int t) { _n_par_threads = t; };
295 303
296 // Preload classes into the shared portion of the heap, and then dump 304 // Preload classes into the shared portion of the heap, and then dump
297 // that data to a file so that it can be loaded directly by another 305 // that data to a file so that it can be loaded directly by another
298 // VM (then terminate). 306 // VM (then terminate).
299 virtual void preload_and_dump(TRAPS) { ShouldNotReachHere(); } 307 virtual void preload_and_dump(TRAPS) { ShouldNotReachHere(); }
604 #ifdef ASSERT 612 #ifdef ASSERT
605 static int fired_fake_oom() { 613 static int fired_fake_oom() {
606 return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt); 614 return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
607 } 615 }
608 #endif 616 #endif
617
618 public:
619 // This is a convenience method that is used in cases where
620 // the actual number of GC worker threads is not pertinent but
621 // only whether there more than 0. Use of this method helps
622 // reduce the occurrence of ParallelGCThreads to uses where the
623 // actual number may be germane.
624 static bool use_parallel_gc_threads() { return ParallelGCThreads > 0; }
609 }; 625 };
610 626
611 // Class to set and reset the GC cause for a CollectedHeap. 627 // Class to set and reset the GC cause for a CollectedHeap.
612 628
613 class GCCauseSetter : StackObj { 629 class GCCauseSetter : StackObj {