equal
deleted
inserted
replaced
370 return new_obj; |
370 return new_obj; |
371 } |
371 } |
372 |
372 |
373 size_t G1CollectedHeap::humongous_obj_size_in_regions(size_t word_size) { |
373 size_t G1CollectedHeap::humongous_obj_size_in_regions(size_t word_size) { |
374 assert(is_humongous(word_size), "Object of size " SIZE_FORMAT " must be humongous here", word_size); |
374 assert(is_humongous(word_size), "Object of size " SIZE_FORMAT " must be humongous here", word_size); |
375 return align_size_up_(word_size, HeapRegion::GrainWords) / HeapRegion::GrainWords; |
375 return align_up_(word_size, HeapRegion::GrainWords) / HeapRegion::GrainWords; |
376 } |
376 } |
377 |
377 |
378 // If could fit into free regions w/o expansion, try. |
378 // If could fit into free regions w/o expansion, try. |
379 // Otherwise, if can expand, do so. |
379 // Otherwise, if can expand, do so. |
380 // Otherwise, if using ex regions might help, try with ex given back. |
380 // Otherwise, if using ex regions might help, try with ex given back. |
1604 return NULL; |
1604 return NULL; |
1605 } |
1605 } |
1606 |
1606 |
1607 bool G1CollectedHeap::expand(size_t expand_bytes, WorkGang* pretouch_workers, double* expand_time_ms) { |
1607 bool G1CollectedHeap::expand(size_t expand_bytes, WorkGang* pretouch_workers, double* expand_time_ms) { |
1608 size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes); |
1608 size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes); |
1609 aligned_expand_bytes = align_size_up(aligned_expand_bytes, |
1609 aligned_expand_bytes = align_up(aligned_expand_bytes, |
1610 HeapRegion::GrainBytes); |
1610 HeapRegion::GrainBytes); |
1611 |
1611 |
1612 log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: " SIZE_FORMAT "B expansion amount: " SIZE_FORMAT "B", |
1612 log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: " SIZE_FORMAT "B expansion amount: " SIZE_FORMAT "B", |
1613 expand_bytes, aligned_expand_bytes); |
1613 expand_bytes, aligned_expand_bytes); |
1614 |
1614 |
1645 } |
1645 } |
1646 |
1646 |
1647 void G1CollectedHeap::shrink_helper(size_t shrink_bytes) { |
1647 void G1CollectedHeap::shrink_helper(size_t shrink_bytes) { |
1648 size_t aligned_shrink_bytes = |
1648 size_t aligned_shrink_bytes = |
1649 ReservedSpace::page_align_size_down(shrink_bytes); |
1649 ReservedSpace::page_align_size_down(shrink_bytes); |
1650 aligned_shrink_bytes = align_size_down(aligned_shrink_bytes, |
1650 aligned_shrink_bytes = align_down(aligned_shrink_bytes, |
1651 HeapRegion::GrainBytes); |
1651 HeapRegion::GrainBytes); |
1652 uint num_regions_to_remove = (uint)(shrink_bytes / HeapRegion::GrainBytes); |
1652 uint num_regions_to_remove = (uint)(shrink_bytes / HeapRegion::GrainBytes); |
1653 |
1653 |
1654 uint num_regions_removed = _hrm.shrink_by(num_regions_to_remove); |
1654 uint num_regions_removed = _hrm.shrink_by(num_regions_to_remove); |
1655 size_t shrunk_bytes = num_regions_removed * HeapRegion::GrainBytes; |
1655 size_t shrunk_bytes = num_regions_removed * HeapRegion::GrainBytes; |
2433 } |
2433 } |
2434 |
2434 |
2435 // For G1 TLABs should not contain humongous objects, so the maximum TLAB size |
2435 // For G1 TLABs should not contain humongous objects, so the maximum TLAB size |
2436 // must be equal to the humongous object limit. |
2436 // must be equal to the humongous object limit. |
2437 size_t G1CollectedHeap::max_tlab_size() const { |
2437 size_t G1CollectedHeap::max_tlab_size() const { |
2438 return align_size_down(_humongous_object_threshold_in_words, MinObjAlignment); |
2438 return align_down(_humongous_object_threshold_in_words, MinObjAlignment); |
2439 } |
2439 } |
2440 |
2440 |
2441 size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const { |
2441 size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const { |
2442 AllocationContext_t context = AllocationContext::current(); |
2442 AllocationContext_t context = AllocationContext::current(); |
2443 return _allocator->unsafe_max_tlab_alloc(context); |
2443 return _allocator->unsafe_max_tlab_alloc(context); |