< prev index next >

src/hotspot/share/gc/shared/genCollectedHeap.cpp

Print this page




1138 
1139 HeapWord* GenCollectedHeap::allocate_new_tlab(size_t min_size,
1140                                               size_t requested_size,
1141                                               size_t* actual_size) {
1142   bool gc_overhead_limit_was_exceeded;
1143   HeapWord* result = mem_allocate_work(requested_size /* size */,
1144                                        true /* is_tlab */,
1145                                        &gc_overhead_limit_was_exceeded);
1146   if (result != NULL) {
1147     *actual_size = requested_size;
1148   }
1149 
1150   return result;
1151 }
1152 
1153 // Requires "*prev_ptr" to be non-NULL.  Deletes and a block of minimal size
1154 // from the list headed by "*prev_ptr".
1155 static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
1156   bool first = true;
1157   size_t min_size = 0;   // "first" makes this conceptually infinite.
1158   ScratchBlock **smallest_ptr, *smallest;
1159   ScratchBlock  *cur = *prev_ptr;
1160   while (cur) {
1161     assert(*prev_ptr == cur, "just checking");
1162     if (first || cur->num_words < min_size) {
1163       smallest_ptr = prev_ptr;
1164       smallest     = cur;
1165       min_size     = smallest->num_words;
1166       first        = false;
1167     }
1168     prev_ptr = &cur->next;
1169     cur     =  cur->next;
1170   }
1171   smallest      = *smallest_ptr;
1172   *smallest_ptr = smallest->next;
1173   return smallest;
1174 }
1175 
1176 // Sort the scratch block list headed by res into decreasing size order,
1177 // and set "res" to the result.
1178 static void sort_scratch_list(ScratchBlock*& list) {




1138 
1139 HeapWord* GenCollectedHeap::allocate_new_tlab(size_t min_size,
1140                                               size_t requested_size,
1141                                               size_t* actual_size) {
1142   bool gc_overhead_limit_was_exceeded;
1143   HeapWord* result = mem_allocate_work(requested_size /* size */,
1144                                        true /* is_tlab */,
1145                                        &gc_overhead_limit_was_exceeded);
1146   if (result != NULL) {
1147     *actual_size = requested_size;
1148   }
1149 
1150   return result;
1151 }
1152 
1153 // Requires "*prev_ptr" to be non-NULL.  Deletes and a block of minimal size
1154 // from the list headed by "*prev_ptr".
1155 static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
1156   bool first = true;
1157   size_t min_size = 0;   // "first" makes this conceptually infinite.
1158   ScratchBlock **smallest_ptr = NULL, *smallest;
1159   ScratchBlock  *cur = *prev_ptr;
1160   while (cur) {
1161     assert(*prev_ptr == cur, "just checking");
1162     if (first || cur->num_words < min_size) {
1163       smallest_ptr = prev_ptr;
1164       smallest     = cur;
1165       min_size     = smallest->num_words;
1166       first        = false;
1167     }
1168     prev_ptr = &cur->next;
1169     cur     =  cur->next;
1170   }
1171   smallest      = *smallest_ptr;
1172   *smallest_ptr = smallest->next;
1173   return smallest;
1174 }
1175 
1176 // Sort the scratch block list headed by res into decreasing size order,
1177 // and set "res" to the result.
1178 static void sort_scratch_list(ScratchBlock*& list) {


< prev index next >