8016276: CMS concurrentMarkSweepGeneration contains lots of unnecessary allocation failure handling
Reviewed-by: stefank, pliden
This commit is contained in:
parent
bedce0572a
commit
b6009d4a48
@ -208,10 +208,6 @@ ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
|
||||
use_adaptive_freelists,
|
||||
dictionaryChoice);
|
||||
NOT_PRODUCT(debug_cms_space = _cmsSpace;)
|
||||
if (_cmsSpace == NULL) {
|
||||
vm_exit_during_initialization(
|
||||
"CompactibleFreeListSpace allocation failure");
|
||||
}
|
||||
_cmsSpace->_gen = this;
|
||||
|
||||
_gc_stats = new CMSGCStats();
|
||||
@ -230,14 +226,8 @@ ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
|
||||
typedef CMSParGCThreadState* CMSParGCThreadStatePtr;
|
||||
_par_gc_thread_states =
|
||||
NEW_C_HEAP_ARRAY(CMSParGCThreadStatePtr, ParallelGCThreads, mtGC);
|
||||
if (_par_gc_thread_states == NULL) {
|
||||
vm_exit_during_initialization("Could not allocate par gc structs");
|
||||
}
|
||||
for (uint i = 0; i < ParallelGCThreads; i++) {
|
||||
_par_gc_thread_states[i] = new CMSParGCThreadState(cmsSpace());
|
||||
if (_par_gc_thread_states[i] == NULL) {
|
||||
vm_exit_during_initialization("Could not allocate par gc structs");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_par_gc_thread_states = NULL;
|
||||
@ -586,11 +576,6 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
|
||||
return;
|
||||
}
|
||||
_hash_seed = NEW_C_HEAP_ARRAY(int, num_queues, mtGC);
|
||||
if (_hash_seed == NULL) {
|
||||
warning("_hash_seed array allocation failure");
|
||||
return;
|
||||
}
|
||||
|
||||
typedef Padded<OopTaskQueue> PaddedOopTaskQueue;
|
||||
for (i = 0; i < num_queues; i++) {
|
||||
PaddedOopTaskQueue *q = new PaddedOopTaskQueue();
|
||||
@ -633,12 +618,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
|
||||
_eden_chunk_index = 0;
|
||||
_eden_chunk_capacity = (_young_gen->max_capacity()+CMSSamplingGrain)/CMSSamplingGrain;
|
||||
_eden_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, _eden_chunk_capacity, mtGC);
|
||||
if (_eden_chunk_array == NULL) {
|
||||
_eden_chunk_capacity = 0;
|
||||
warning("GC/CMS: _eden_chunk_array allocation failure");
|
||||
}
|
||||
}
|
||||
assert(_eden_chunk_array != NULL || _eden_chunk_capacity == 0, "Error");
|
||||
|
||||
// Support for parallelizing survivor space rescan
|
||||
if ((CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) || CMSParallelInitialMarkEnabled) {
|
||||
@ -648,52 +628,15 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
|
||||
_survivor_plab_array = NEW_C_HEAP_ARRAY(ChunkArray, ParallelGCThreads, mtGC);
|
||||
_survivor_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, 2*max_plab_samples, mtGC);
|
||||
_cursor = NEW_C_HEAP_ARRAY(size_t, ParallelGCThreads, mtGC);
|
||||
if (_survivor_plab_array == NULL || _survivor_chunk_array == NULL
|
||||
|| _cursor == NULL) {
|
||||
warning("Failed to allocate survivor plab/chunk array");
|
||||
if (_survivor_plab_array != NULL) {
|
||||
FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
|
||||
_survivor_plab_array = NULL;
|
||||
}
|
||||
if (_survivor_chunk_array != NULL) {
|
||||
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
|
||||
_survivor_chunk_array = NULL;
|
||||
}
|
||||
if (_cursor != NULL) {
|
||||
FREE_C_HEAP_ARRAY(size_t, _cursor);
|
||||
_cursor = NULL;
|
||||
}
|
||||
} else {
|
||||
_survivor_chunk_capacity = 2*max_plab_samples;
|
||||
for (uint i = 0; i < ParallelGCThreads; i++) {
|
||||
HeapWord** vec = NEW_C_HEAP_ARRAY(HeapWord*, max_plab_samples, mtGC);
|
||||
if (vec == NULL) {
|
||||
warning("Failed to allocate survivor plab array");
|
||||
for (int j = i; j > 0; j--) {
|
||||
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array());
|
||||
}
|
||||
FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
|
||||
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
|
||||
_survivor_plab_array = NULL;
|
||||
_survivor_chunk_array = NULL;
|
||||
_survivor_chunk_capacity = 0;
|
||||
break;
|
||||
} else {
|
||||
ChunkArray* cur =
|
||||
::new (&_survivor_plab_array[i]) ChunkArray(vec,
|
||||
max_plab_samples);
|
||||
assert(cur->end() == 0, "Should be 0");
|
||||
assert(cur->array() == vec, "Should be vec");
|
||||
assert(cur->capacity() == max_plab_samples, "Error");
|
||||
}
|
||||
}
|
||||
_survivor_chunk_capacity = 2*max_plab_samples;
|
||||
for (uint i = 0; i < ParallelGCThreads; i++) {
|
||||
HeapWord** vec = NEW_C_HEAP_ARRAY(HeapWord*, max_plab_samples, mtGC);
|
||||
ChunkArray* cur = ::new (&_survivor_plab_array[i]) ChunkArray(vec, max_plab_samples);
|
||||
assert(cur->end() == 0, "Should be 0");
|
||||
assert(cur->array() == vec, "Should be vec");
|
||||
assert(cur->capacity() == max_plab_samples, "Error");
|
||||
}
|
||||
}
|
||||
assert( ( _survivor_plab_array != NULL
|
||||
&& _survivor_chunk_array != NULL)
|
||||
|| ( _survivor_chunk_capacity == 0
|
||||
&& _survivor_chunk_index == 0),
|
||||
"Error");
|
||||
|
||||
NOT_PRODUCT(_overflow_counter = CMSMarkStackOverflowInterval;)
|
||||
_gc_counters = new CollectorCounters("CMS", 1);
|
||||
|
Loading…
Reference in New Issue
Block a user