< prev index next >

src/share/vm/gc/g1/heapRegionManager.cpp

Print this page
rev 11972 : [mq]: 8157952-sangheon-review

*** 1,7 **** /* ! * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 70,95 **** MemRegion mr(bottom, bottom + HeapRegion::GrainWords); assert(reserved().contains(mr), "invariant"); return g1h->new_heap_region(hrm_index, mr); } ! void HeapRegionManager::commit_regions(uint index, size_t num_regions) { guarantee(num_regions > 0, "Must commit more than zero regions"); guarantee(_num_committed + num_regions <= max_length(), "Cannot commit more than the maximum amount of regions"); _num_committed += (uint)num_regions; ! _heap_mapper->commit_regions(index, num_regions); // Also commit auxiliary data ! _prev_bitmap_mapper->commit_regions(index, num_regions); ! _next_bitmap_mapper->commit_regions(index, num_regions); ! _bot_mapper->commit_regions(index, num_regions); ! _cardtable_mapper->commit_regions(index, num_regions); ! _card_counts_mapper->commit_regions(index, num_regions); } void HeapRegionManager::uncommit_regions(uint start, size_t num_regions) { guarantee(num_regions >= 1, "Need to specify at least one region to uncommit, tried to uncommit zero regions at %u", start); guarantee(_num_committed >= num_regions, "pre-condition"); --- 70,95 ---- MemRegion mr(bottom, bottom + HeapRegion::GrainWords); assert(reserved().contains(mr), "invariant"); return g1h->new_heap_region(hrm_index, mr); } ! void HeapRegionManager::commit_regions(uint index, size_t num_regions, WorkGang* pretouch_gang) { guarantee(num_regions > 0, "Must commit more than zero regions"); guarantee(_num_committed + num_regions <= max_length(), "Cannot commit more than the maximum amount of regions"); _num_committed += (uint)num_regions; ! _heap_mapper->commit_regions(index, num_regions, pretouch_gang); // Also commit auxiliary data ! _prev_bitmap_mapper->commit_regions(index, num_regions, pretouch_gang); ! _next_bitmap_mapper->commit_regions(index, num_regions, pretouch_gang); ! _bot_mapper->commit_regions(index, num_regions, pretouch_gang); ! _cardtable_mapper->commit_regions(index, num_regions, pretouch_gang); ! _card_counts_mapper->commit_regions(index, num_regions, pretouch_gang); } void HeapRegionManager::uncommit_regions(uint start, size_t num_regions) { guarantee(num_regions >= 1, "Need to specify at least one region to uncommit, tried to uncommit zero regions at %u", start); guarantee(_num_committed >= num_regions, "pre-condition");
*** 115,127 **** _cardtable_mapper->uncommit_regions(start, num_regions); _card_counts_mapper->uncommit_regions(start, num_regions); } ! void HeapRegionManager::make_regions_available(uint start, uint num_regions) { guarantee(num_regions > 0, "No point in calling this for zero regions"); ! commit_regions(start, num_regions); for (uint i = start; i < start + num_regions; i++) { if (_regions.get_by_index(i) == NULL) { HeapRegion* new_hr = new_heap_region(i); _regions.set_by_index(i, new_hr); _allocated_heapregions_length = MAX2(_allocated_heapregions_length, i + 1); --- 115,127 ---- _cardtable_mapper->uncommit_regions(start, num_regions); _card_counts_mapper->uncommit_regions(start, num_regions); } ! void HeapRegionManager::make_regions_available(uint start, uint num_regions, WorkGang* pretouch_gang) { guarantee(num_regions > 0, "No point in calling this for zero regions"); ! commit_regions(start, num_regions, pretouch_gang); for (uint i = start; i < start + num_regions; i++) { if (_regions.get_by_index(i) == NULL) { HeapRegion* new_hr = new_heap_region(i); _regions.set_by_index(i, new_hr); _allocated_heapregions_length = MAX2(_allocated_heapregions_length, i + 1);
*** 160,174 **** _card_counts_mapper->reserved_size(); return MemoryUsage(0, used_sz, committed_sz, committed_sz); } ! uint HeapRegionManager::expand_by(uint num_regions) { ! return expand_at(0, num_regions); } ! uint HeapRegionManager::expand_at(uint start, uint num_regions) { if (num_regions == 0) { return 0; } uint cur = start; --- 160,174 ---- _card_counts_mapper->reserved_size(); return MemoryUsage(0, used_sz, committed_sz, committed_sz); } ! uint HeapRegionManager::expand_by(uint num_regions, WorkGang* pretouch_workers) { ! return expand_at(0, num_regions, pretouch_workers); } ! uint HeapRegionManager::expand_at(uint start, uint num_regions, WorkGang* pretouch_workers) { if (num_regions == 0) { return 0; } uint cur = start;
*** 178,188 **** uint expanded = 0; while (expanded < num_regions && (num_last_found = find_unavailable_from_idx(cur, &idx_last_found)) > 0) { uint to_expand = MIN2(num_regions - expanded, num_last_found); ! make_regions_available(idx_last_found, to_expand); expanded += to_expand; cur = idx_last_found + num_last_found + 1; } verify_optional(); --- 178,188 ---- uint expanded = 0; while (expanded < num_regions && (num_last_found = find_unavailable_from_idx(cur, &idx_last_found)) > 0) { uint to_expand = MIN2(num_regions - expanded, num_last_found); ! make_regions_available(idx_last_found, to_expand, pretouch_workers); expanded += to_expand; cur = idx_last_found + num_last_found + 1; } verify_optional();
< prev index next >