equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "gc/g1/g1Allocator.inline.hpp" |
26 #include "gc/g1/g1Allocator.inline.hpp" |
27 #include "gc/g1/g1AllocRegion.inline.hpp" |
27 #include "gc/g1/g1AllocRegion.inline.hpp" |
28 #include "gc/g1/g1EvacStats.inline.hpp" |
28 #include "gc/g1/g1EvacStats.inline.hpp" |
29 #include "gc/g1/g1CollectedHeap.inline.hpp" |
29 #include "gc/g1/g1CollectedHeap.inline.hpp" |
30 #include "gc/g1/g1MarkSweep.hpp" |
|
31 #include "gc/g1/heapRegion.inline.hpp" |
30 #include "gc/g1/heapRegion.inline.hpp" |
32 #include "gc/g1/heapRegionSet.inline.hpp" |
31 #include "gc/g1/heapRegionSet.inline.hpp" |
33 |
32 |
34 G1DefaultAllocator::G1DefaultAllocator(G1CollectedHeap* heap) : |
33 G1DefaultAllocator::G1DefaultAllocator(G1CollectedHeap* heap) : |
35 G1Allocator(heap), |
34 G1Allocator(heap), |
331 undo_wasted += buf->undo_waste(); |
330 undo_wasted += buf->undo_waste(); |
332 } |
331 } |
333 } |
332 } |
334 } |
333 } |
335 |
334 |
|
335 bool G1ArchiveAllocator::_archive_check_enabled = false; |
|
336 G1ArchiveRegionMap G1ArchiveAllocator::_archive_region_map; |
|
337 |
336 G1ArchiveAllocator* G1ArchiveAllocator::create_allocator(G1CollectedHeap* g1h) { |
338 G1ArchiveAllocator* G1ArchiveAllocator::create_allocator(G1CollectedHeap* g1h) { |
337 // Create the archive allocator, and also enable archive object checking |
339 // Create the archive allocator, and also enable archive object checking |
338 // in mark-sweep, since we will be creating archive regions. |
340 // in mark-sweep, since we will be creating archive regions. |
339 G1ArchiveAllocator* result = new G1ArchiveAllocator(g1h); |
341 G1ArchiveAllocator* result = new G1ArchiveAllocator(g1h); |
340 G1MarkSweep::enable_archive_object_check(); |
342 enable_archive_object_check(); |
341 return result; |
343 return result; |
342 } |
344 } |
343 |
345 |
344 bool G1ArchiveAllocator::alloc_new_region() { |
346 bool G1ArchiveAllocator::alloc_new_region() { |
345 // Allocate the highest free region in the reserved heap, |
347 // Allocate the highest free region in the reserved heap, |
360 // min_region_size'd chunk of the allocated G1 region. |
362 // min_region_size'd chunk of the allocated G1 region. |
361 _bottom = hr->bottom(); |
363 _bottom = hr->bottom(); |
362 _max = _bottom + HeapRegion::min_region_size_in_words(); |
364 _max = _bottom + HeapRegion::min_region_size_in_words(); |
363 |
365 |
364 // Tell mark-sweep that objects in this region are not to be marked. |
366 // Tell mark-sweep that objects in this region are not to be marked. |
365 G1MarkSweep::set_range_archive(MemRegion(_bottom, HeapRegion::GrainWords), true); |
367 set_range_archive(MemRegion(_bottom, HeapRegion::GrainWords), true); |
366 |
368 |
367 // Since we've modified the old set, call update_sizes. |
369 // Since we've modified the old set, call update_sizes. |
368 _g1h->g1mm()->update_sizes(); |
370 _g1h->g1mm()->update_sizes(); |
369 return true; |
371 return true; |
370 } |
372 } |