1558 }
1559
1560 return true;
1561 }
1562
1563 void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) {
1564 // do_collection() will return whether it succeeded in performing
1565 // the GC. Currently, there is no facility on the
1566 // do_full_collection() API to notify the caller than the collection
1567 // did not succeed (e.g., because it was locked out by the GC
1568 // locker). So, right now, we'll ignore the return value.
1569 bool dummy = do_collection(true, /* explicit_gc */
1570 clear_all_soft_refs,
1571 0 /* word_size */);
1572 }
1573
1574 // This code is mostly copied from TenuredGeneration.
1575 void
1576 G1CollectedHeap::
1577 resize_if_necessary_after_full_collection(size_t word_size) {
1578 assert(MinHeapFreeRatio <= MaxHeapFreeRatio, "sanity check");
1579
1580 // Include the current allocation, if any, and bytes that will be
1581 // pre-allocated to support collections, as "used".
1582 const size_t used_after_gc = used();
1583 const size_t capacity_after_gc = capacity();
1584 const size_t free_after_gc = capacity_after_gc - used_after_gc;
1585
1586 // This is enforced in arguments.cpp.
1587 assert(MinHeapFreeRatio <= MaxHeapFreeRatio,
1588 "otherwise the code below doesn't make sense");
1589
1590 // We don't have floating point command-line arguments
1591 const double minimum_free_percentage = (double) MinHeapFreeRatio / 100.0;
1592 const double maximum_used_percentage = 1.0 - minimum_free_percentage;
1593 const double maximum_free_percentage = (double) MaxHeapFreeRatio / 100.0;
1594 const double minimum_used_percentage = 1.0 - maximum_free_percentage;
1595
1596 const size_t min_heap_size = collector_policy()->min_heap_byte_size();
1597 const size_t max_heap_size = collector_policy()->max_heap_byte_size();
1598
1599 // We have to be careful here as these two calculations can overflow
|
1558 }
1559
1560 return true;
1561 }
1562
1563 void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) {
1564 // do_collection() will return whether it succeeded in performing
1565 // the GC. Currently, there is no facility on the
1566 // do_full_collection() API to notify the caller than the collection
1567 // did not succeed (e.g., because it was locked out by the GC
1568 // locker). So, right now, we'll ignore the return value.
1569 bool dummy = do_collection(true, /* explicit_gc */
1570 clear_all_soft_refs,
1571 0 /* word_size */);
1572 }
1573
1574 // This code is mostly copied from TenuredGeneration.
1575 void
1576 G1CollectedHeap::
1577 resize_if_necessary_after_full_collection(size_t word_size) {
1578 // Include the current allocation, if any, and bytes that will be
1579 // pre-allocated to support collections, as "used".
1580 const size_t used_after_gc = used();
1581 const size_t capacity_after_gc = capacity();
1582 const size_t free_after_gc = capacity_after_gc - used_after_gc;
1583
1584 // This is enforced in arguments.cpp.
1585 assert(MinHeapFreeRatio <= MaxHeapFreeRatio,
1586 "otherwise the code below doesn't make sense");
1587
1588 // We don't have floating point command-line arguments
1589 const double minimum_free_percentage = (double) MinHeapFreeRatio / 100.0;
1590 const double maximum_used_percentage = 1.0 - minimum_free_percentage;
1591 const double maximum_free_percentage = (double) MaxHeapFreeRatio / 100.0;
1592 const double minimum_used_percentage = 1.0 - maximum_free_percentage;
1593
1594 const size_t min_heap_size = collector_policy()->min_heap_byte_size();
1595 const size_t max_heap_size = collector_policy()->max_heap_byte_size();
1596
1597 // We have to be careful here as these two calculations can overflow
|