1128 }
1129 return 0;
1130 }
1131
1132 size_t GenCollectedHeap::tlab_used(Thread* thr) const {
1133 assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
1134 if (_young_gen->supports_tlab_allocation()) {
1135 return _young_gen->tlab_used();
1136 }
1137 return 0;
1138 }
1139
1140 size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const {
1141 assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
1142 if (_young_gen->supports_tlab_allocation()) {
1143 return _young_gen->unsafe_max_tlab_alloc();
1144 }
1145 return 0;
1146 }
1147
1148 HeapWord* GenCollectedHeap::allocate_new_tlab(size_t size) {
1149 bool gc_overhead_limit_was_exceeded;
1150 return mem_allocate_work(size /* size */,
1151 true /* is_tlab */,
1152 &gc_overhead_limit_was_exceeded);
1153 }
1154
1155 // Requires "*prev_ptr" to be non-NULL. Deletes and a block of minimal size
1156 // from the list headed by "*prev_ptr".
1157 static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
1158 bool first = true;
1159 size_t min_size = 0; // "first" makes this conceptually infinite.
1160 ScratchBlock **smallest_ptr, *smallest;
1161 ScratchBlock *cur = *prev_ptr;
1162 while (cur) {
1163 assert(*prev_ptr == cur, "just checking");
1164 if (first || cur->num_words < min_size) {
1165 smallest_ptr = prev_ptr;
1166 smallest = cur;
1167 min_size = smallest->num_words;
1168 first = false;
1169 }
1170 prev_ptr = &cur->next;
|
1128 }
1129 return 0;
1130 }
1131
1132 size_t GenCollectedHeap::tlab_used(Thread* thr) const {
1133 assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
1134 if (_young_gen->supports_tlab_allocation()) {
1135 return _young_gen->tlab_used();
1136 }
1137 return 0;
1138 }
1139
1140 size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const {
1141 assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
1142 if (_young_gen->supports_tlab_allocation()) {
1143 return _young_gen->unsafe_max_tlab_alloc();
1144 }
1145 return 0;
1146 }
1147
1148 HeapWord* GenCollectedHeap::allocate_new_tlab(size_t min_word_size,
1149 size_t desired_word_size,
1150 size_t* actual_word_size) {
1151 bool gc_overhead_limit_was_exceeded;
1152 *actual_word_size = desired_word_size;
1153 return mem_allocate_work(desired_word_size /* size */,
1154 true /* is_tlab */,
1155 &gc_overhead_limit_was_exceeded);
1156 }
1157
1158 // Requires "*prev_ptr" to be non-NULL. Deletes and a block of minimal size
1159 // from the list headed by "*prev_ptr".
1160 static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
1161 bool first = true;
1162 size_t min_size = 0; // "first" makes this conceptually infinite.
1163 ScratchBlock **smallest_ptr, *smallest;
1164 ScratchBlock *cur = *prev_ptr;
1165 while (cur) {
1166 assert(*prev_ptr == cur, "just checking");
1167 if (first || cur->num_words < min_size) {
1168 smallest_ptr = prev_ptr;
1169 smallest = cur;
1170 min_size = smallest->num_words;
1171 first = false;
1172 }
1173 prev_ptr = &cur->next;
|