6984287: Regularize how GC parallel workers are specified

Associate number of GC workers with the workgang as opposed to the task.

Reviewed-by: johnc, ysr
This commit is contained in:
Jon Masamitsu 2010-09-20 14:38:38 -07:00
parent 3af63c10ab
commit 28e56b8970
29 changed files with 504 additions and 216 deletions

View file

@ -59,6 +59,8 @@ class CollectedHeap : public CHeapObj {
MemRegion _reserved;
BarrierSet* _barrier_set;
bool _is_gc_active;
int _n_par_threads;
unsigned int _total_collections; // ... started
unsigned int _total_full_collections; // ... started
NOT_PRODUCT(volatile size_t _promotion_failure_alot_count;)
@ -293,6 +295,12 @@ class CollectedHeap : public CHeapObj {
}
GCCause::Cause gc_cause() { return _gc_cause; }
// Number of threads currently working on GC tasks.
int n_par_threads() { return _n_par_threads; }
// May be overridden to set additional parallelism.
virtual void set_par_threads(int t) { _n_par_threads = t; };
// Preload classes into the shared portion of the heap, and then dump
// that data to a file so that it can be loaded directly by another
// VM (then terminate).
@ -606,6 +614,14 @@ class CollectedHeap : public CHeapObj {
return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
}
#endif
public:
// This is a convenience method that is used in cases where
// the actual number of GC worker threads is not pertinent but
// only whether there more than 0. Use of this method helps
// reduce the occurrence of ParallelGCThreads to uses where the
// actual number may be germane.
static bool use_parallel_gc_threads() { return ParallelGCThreads > 0; }
};
// Class to set and reset the GC cause for a CollectedHeap.