< prev index next >

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

Print this page




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




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


< prev index next >