hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp
changeset 46704 211b3f6b75ef
parent 46625 edefffab74e2
child 46750 bcab0128a16f
equal deleted inserted replaced
46703:f152b500376e 46704:211b3f6b75ef
   142 bool G1CMMarkStack::resize(size_t new_capacity) {
   142 bool G1CMMarkStack::resize(size_t new_capacity) {
   143   assert(is_empty(), "Only resize when stack is empty.");
   143   assert(is_empty(), "Only resize when stack is empty.");
   144   assert(new_capacity <= _max_chunk_capacity,
   144   assert(new_capacity <= _max_chunk_capacity,
   145          "Trying to resize stack to " SIZE_FORMAT " chunks when the maximum is " SIZE_FORMAT, new_capacity, _max_chunk_capacity);
   145          "Trying to resize stack to " SIZE_FORMAT " chunks when the maximum is " SIZE_FORMAT, new_capacity, _max_chunk_capacity);
   146 
   146 
   147   TaskQueueEntryChunk* new_base = MmapArrayAllocator<TaskQueueEntryChunk, mtGC>::allocate_or_null(new_capacity);
   147   TaskQueueEntryChunk* new_base = MmapArrayAllocator<TaskQueueEntryChunk>::allocate_or_null(new_capacity, mtGC);
   148 
   148 
   149   if (new_base == NULL) {
   149   if (new_base == NULL) {
   150     log_warning(gc)("Failed to reserve memory for new overflow mark stack with " SIZE_FORMAT " chunks and size " SIZE_FORMAT "B.", new_capacity, new_capacity * sizeof(TaskQueueEntryChunk));
   150     log_warning(gc)("Failed to reserve memory for new overflow mark stack with " SIZE_FORMAT " chunks and size " SIZE_FORMAT "B.", new_capacity, new_capacity * sizeof(TaskQueueEntryChunk));
   151     return false;
   151     return false;
   152   }
   152   }
   153   // Release old mapping.
   153   // Release old mapping.
   154   if (_base != NULL) {
   154   if (_base != NULL) {
   155     MmapArrayAllocator<TaskQueueEntryChunk, mtGC>::free(_base, _chunk_capacity);
   155     MmapArrayAllocator<TaskQueueEntryChunk>::free(_base, _chunk_capacity);
   156   }
   156   }
   157 
   157 
   158   _base = new_base;
   158   _base = new_base;
   159   _chunk_capacity = new_capacity;
   159   _chunk_capacity = new_capacity;
   160   set_empty();
   160   set_empty();
   203   }
   203   }
   204 }
   204 }
   205 
   205 
   206 G1CMMarkStack::~G1CMMarkStack() {
   206 G1CMMarkStack::~G1CMMarkStack() {
   207   if (_base != NULL) {
   207   if (_base != NULL) {
   208     MmapArrayAllocator<TaskQueueEntryChunk, mtGC>::free(_base, _chunk_capacity);
   208     MmapArrayAllocator<TaskQueueEntryChunk>::free(_base, _chunk_capacity);
   209   }
   209   }
   210 }
   210 }
   211 
   211 
   212 void G1CMMarkStack::add_chunk_to_list(TaskQueueEntryChunk* volatile* list, TaskQueueEntryChunk* elem) {
   212 void G1CMMarkStack::add_chunk_to_list(TaskQueueEntryChunk* volatile* list, TaskQueueEntryChunk* elem) {
   213   elem->next = *list;
   213   elem->next = *list;