< prev index next >

src/hotspot/share/gc/z/zPhysicalMemory.cpp

Print this page

        

*** 145,190 **** // Insert before first segment insert_segment(0, segment.start(), segment.size(), segment.is_committed()); } bool ZPhysicalMemory::commit_segment(int index, size_t size) { ! ZPhysicalMemorySegment& segment = _segments.at(index); ! assert(size <= segment.size(), "Invalid size"); ! assert(!segment.is_committed(), "Invalid state"); ! ! if (size == segment.size()) { // Completely committed ! segment.set_committed(true); return true; } if (size > 0) { // Partially committed, split segment ! insert_segment(index + 1, segment.start() + size, segment.size() - size, false /* committed */); ! replace_segment(index, segment.start(), size, true /* committed */); } return false; } bool ZPhysicalMemory::uncommit_segment(int index, size_t size) { ! ZPhysicalMemorySegment& segment = _segments.at(index); ! ! assert(size <= segment.size(), "Invalid size"); ! assert(segment.is_committed(), "Invalid state"); ! if (size == segment.size()) { // Completely uncommitted ! segment.set_committed(false); return true; } if (size > 0) { // Partially uncommitted, split segment ! insert_segment(index + 1, segment.start() + size, segment.size() - size, true /* committed */); ! replace_segment(index, segment.start(), size, false /* committed */); } return false; } --- 145,186 ---- // Insert before first segment insert_segment(0, segment.start(), segment.size(), segment.is_committed()); } bool ZPhysicalMemory::commit_segment(int index, size_t size) { ! assert(size <= _segments.at(index).size(), "Invalid size"); ! assert(!_segments.at(index).is_committed(), "Invalid state"); ! if (size == _segments.at(index).size()) { // Completely committed ! _segments.at(index).set_committed(true); return true; } if (size > 0) { // Partially committed, split segment ! insert_segment(index + 1, _segments.at(index).start() + size, _segments.at(index).size() - size, false /* committed */); ! replace_segment(index, _segments.at(index).start(), size, true /* committed */); } return false; } bool ZPhysicalMemory::uncommit_segment(int index, size_t size) { ! assert(size <= _segments.at(index).size(), "Invalid size"); ! assert(_segments.at(index).is_committed(), "Invalid state"); ! if (size == _segments.at(index).size()) { // Completely uncommitted ! _segments.at(index).set_committed(false); return true; } if (size > 0) { // Partially uncommitted, split segment ! insert_segment(index + 1, _segments.at(index).start() + size, _segments.at(index).size() - size, true /* committed */); ! replace_segment(index, _segments.at(index).start(), size, false /* committed */); } return false; }
< prev index next >