68 // The line below is the worst bit of C++ hackery I've ever written
69 // (Detlefs, 11/23). You should think of it as equivalent to
70 // "_regions(100, true)": initialize the growable array and inform it
71 // that it should allocate its elem array(s) on the C heap.
72 //
73 // The first argument, however, is actually a comma expression
74 // (set_allocation_type(this, C_HEAP), 100). The purpose of the
75 // set_allocation_type() call is to replace the default allocation
76 // type for embedded objects STACK_OR_EMBEDDED with C_HEAP. It will
77 // allow to pass the assert in GenericGrowableArray() which checks
78 // that a growable array object must be on C heap if elements are.
79 //
80 // Note: containing object is allocated on C heap since it is CHeapObj.
81 //
82 _regions((ResourceObj::set_allocation_type((address) &_regions,
83 ResourceObj::C_HEAP),
84 100), true /* C_Heap */),
85 _curr_index(0), _length(0), _first_par_unreserved_idx(0),
86 _region_live_threshold_bytes(0), _remaining_reclaimable_bytes(0) {
87 _region_live_threshold_bytes =
88 HeapRegion::GrainBytes * (size_t) G1OldCSetRegionLiveThresholdPercent / 100;
89 }
90
91 #ifndef PRODUCT
92 void CollectionSetChooser::verify() {
93 guarantee(_length <= regions_length(),
94 err_msg("_length: %u regions length: %u", _length, regions_length()));
95 guarantee(_curr_index <= _length,
96 err_msg("_curr_index: %u _length: %u", _curr_index, _length));
97 uint index = 0;
98 size_t sum_of_reclaimable_bytes = 0;
99 while (index < _curr_index) {
100 guarantee(regions_at(index) == NULL,
101 "all entries before _curr_index should be NULL");
102 index += 1;
103 }
104 HeapRegion *prev = NULL;
105 while (index < _length) {
106 HeapRegion *curr = regions_at(index++);
107 guarantee(curr != NULL, "Regions in _regions array cannot be NULL");
108 guarantee(!curr->is_young(), "should not be young!");
|
68 // The line below is the worst bit of C++ hackery I've ever written
69 // (Detlefs, 11/23). You should think of it as equivalent to
70 // "_regions(100, true)": initialize the growable array and inform it
71 // that it should allocate its elem array(s) on the C heap.
72 //
73 // The first argument, however, is actually a comma expression
74 // (set_allocation_type(this, C_HEAP), 100). The purpose of the
75 // set_allocation_type() call is to replace the default allocation
76 // type for embedded objects STACK_OR_EMBEDDED with C_HEAP. It will
77 // allow to pass the assert in GenericGrowableArray() which checks
78 // that a growable array object must be on C heap if elements are.
79 //
80 // Note: containing object is allocated on C heap since it is CHeapObj.
81 //
82 _regions((ResourceObj::set_allocation_type((address) &_regions,
83 ResourceObj::C_HEAP),
84 100), true /* C_Heap */),
85 _curr_index(0), _length(0), _first_par_unreserved_idx(0),
86 _region_live_threshold_bytes(0), _remaining_reclaimable_bytes(0) {
87 _region_live_threshold_bytes =
88 HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100;
89 }
90
91 #ifndef PRODUCT
92 void CollectionSetChooser::verify() {
93 guarantee(_length <= regions_length(),
94 err_msg("_length: %u regions length: %u", _length, regions_length()));
95 guarantee(_curr_index <= _length,
96 err_msg("_curr_index: %u _length: %u", _curr_index, _length));
97 uint index = 0;
98 size_t sum_of_reclaimable_bytes = 0;
99 while (index < _curr_index) {
100 guarantee(regions_at(index) == NULL,
101 "all entries before _curr_index should be NULL");
102 index += 1;
103 }
104 HeapRegion *prev = NULL;
105 while (index < _length) {
106 HeapRegion *curr = regions_at(index++);
107 guarantee(curr != NULL, "Regions in _regions array cannot be NULL");
108 guarantee(!curr->is_young(), "should not be young!");
|