Mercurial > hg > graal-jvmci-8
annotate src/share/vm/gc_implementation/g1/g1Allocator.cpp @ 24234:ea6f94ab283b default tip
Added tag jvmci-0.36 for changeset 8128b98d4736
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Mon, 18 Sep 2017 18:49:45 +0200 |
parents | c132be0fb74d |
children |
rev | line source |
---|---|
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
1 /* |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
4 * |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
8 * |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
13 * accompanied this code). |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
14 * |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
18 * |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
21 * questions. |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
22 * |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
23 */ |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
24 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
26 #include "gc_implementation/g1/g1Allocator.hpp" |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
27 #include "gc_implementation/g1/g1CollectedHeap.hpp" |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
28 #include "gc_implementation/g1/g1CollectorPolicy.hpp" |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
29 #include "gc_implementation/g1/heapRegion.inline.hpp" |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
30 #include "gc_implementation/g1/heapRegionSet.inline.hpp" |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
31 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
32 void G1DefaultAllocator::init_mutator_alloc_region() { |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
33 assert(_mutator_alloc_region.get() == NULL, "pre-condition"); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
34 _mutator_alloc_region.init(); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
35 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
36 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
37 void G1DefaultAllocator::release_mutator_alloc_region() { |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
38 _mutator_alloc_region.release(); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
39 assert(_mutator_alloc_region.get() == NULL, "post-condition"); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
40 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
41 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
42 void G1Allocator::reuse_retained_old_region(EvacuationInfo& evacuation_info, |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
43 OldGCAllocRegion* old, |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
44 HeapRegion** retained_old) { |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
45 HeapRegion* retained_region = *retained_old; |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
46 *retained_old = NULL; |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
47 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
48 // We will discard the current GC alloc region if: |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
49 // a) it's in the collection set (it can happen!), |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
50 // b) it's already full (no point in using it), |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
51 // c) it's empty (this means that it was emptied during |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
52 // a cleanup and it should be on the free list now), or |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
53 // d) it's humongous (this means that it was emptied |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
54 // during a cleanup and was added to the free list, but |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
55 // has been subsequently used to allocate a humongous |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
56 // object that may be less than the region size). |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
57 if (retained_region != NULL && |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
58 !retained_region->in_collection_set() && |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
59 !(retained_region->top() == retained_region->end()) && |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
60 !retained_region->is_empty() && |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
61 !retained_region->isHumongous()) { |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20404
diff
changeset
|
62 retained_region->record_timestamp(); |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
63 // The retained region was added to the old region set when it was |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
64 // retired. We have to remove it now, since we don't allow regions |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
65 // we allocate to in the region sets. We'll re-add it later, when |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
66 // it's retired again. |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
67 _g1h->_old_set.remove(retained_region); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
68 bool during_im = _g1h->g1_policy()->during_initial_mark_pause(); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
69 retained_region->note_start_of_copying(during_im); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
70 old->set(retained_region); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
71 _g1h->_hr_printer.reuse(retained_region); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
72 evacuation_info.set_alloc_regions_used_before(retained_region->used()); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
73 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
74 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
75 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
76 void G1DefaultAllocator::init_gc_alloc_regions(EvacuationInfo& evacuation_info) { |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
77 assert_at_safepoint(true /* should_be_vm_thread */); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
78 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
79 _survivor_gc_alloc_region.init(); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
80 _old_gc_alloc_region.init(); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
81 reuse_retained_old_region(evacuation_info, |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
82 &_old_gc_alloc_region, |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
83 &_retained_old_gc_alloc_region); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
84 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
85 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
86 void G1DefaultAllocator::release_gc_alloc_regions(uint no_of_gc_workers, EvacuationInfo& evacuation_info) { |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
87 AllocationContext_t context = AllocationContext::current(); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
88 evacuation_info.set_allocation_regions(survivor_gc_alloc_region(context)->count() + |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
89 old_gc_alloc_region(context)->count()); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
90 survivor_gc_alloc_region(context)->release(); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
91 // If we have an old GC alloc region to release, we'll save it in |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
92 // _retained_old_gc_alloc_region. If we don't |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
93 // _retained_old_gc_alloc_region will become NULL. This is what we |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
94 // want either way so no reason to check explicitly for either |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
95 // condition. |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
96 _retained_old_gc_alloc_region = old_gc_alloc_region(context)->release(); |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20404
diff
changeset
|
97 if (_retained_old_gc_alloc_region != NULL) { |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20404
diff
changeset
|
98 _retained_old_gc_alloc_region->record_retained_region(); |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20404
diff
changeset
|
99 } |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
100 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
101 if (ResizePLAB) { |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
102 _g1h->_survivor_plab_stats.adjust_desired_plab_sz(no_of_gc_workers); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
103 _g1h->_old_plab_stats.adjust_desired_plab_sz(no_of_gc_workers); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
104 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
105 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
106 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
107 void G1DefaultAllocator::abandon_gc_alloc_regions() { |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
108 assert(survivor_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
109 assert(old_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
110 _retained_old_gc_alloc_region = NULL; |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
111 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
112 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
113 G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) : |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
114 ParGCAllocBuffer(gclab_word_size), _retired(true) { } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
115 |
22901
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
116 HeapWord* G1ParGCAllocator::allocate_direct_or_new_plab(InCSetState dest, |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
117 size_t word_sz, |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
118 AllocationContext_t context) { |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
119 size_t gclab_word_size = _g1h->desired_plab_sz(dest); |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
120 if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) { |
22901
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
121 G1ParGCAllocBuffer* alloc_buf = alloc_buffer(dest, context); |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
122 add_to_alloc_buffer_waste(alloc_buf->words_remaining()); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
123 alloc_buf->retire(false /* end_of_gc */, false /* retain */); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
124 |
22901
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
125 HeapWord* buf = _g1h->par_allocate_during_gc(dest, gclab_word_size, context); |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
126 if (buf == NULL) { |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
127 return NULL; // Let caller handle allocation failure. |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
128 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
129 // Otherwise. |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
130 alloc_buf->set_word_size(gclab_word_size); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
131 alloc_buf->set_buf(buf); |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
132 |
22901
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
133 HeapWord* const obj = alloc_buf->allocate(word_sz); |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
134 assert(obj != NULL, "buffer was definitely big enough..."); |
22901
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
135 return obj; |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
136 } else { |
22901
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
137 return _g1h->par_allocate_during_gc(dest, word_sz, context); |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
138 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
139 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
140 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
141 G1DefaultParGCAllocator::G1DefaultParGCAllocator(G1CollectedHeap* g1h) : |
22901
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
142 G1ParGCAllocator(g1h), |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
143 _surviving_alloc_buffer(g1h->desired_plab_sz(InCSetState::Young)), |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
144 _tenured_alloc_buffer(g1h->desired_plab_sz(InCSetState::Old)) { |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
145 for (uint state = 0; state < InCSetState::Num; state++) { |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
146 _alloc_buffers[state] = NULL; |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
147 } |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
148 _alloc_buffers[InCSetState::Young] = &_surviving_alloc_buffer; |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
149 _alloc_buffers[InCSetState::Old] = &_tenured_alloc_buffer; |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
150 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
151 |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
152 void G1DefaultParGCAllocator::retire_alloc_buffers() { |
22901
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
153 for (uint state = 0; state < InCSetState::Num; state++) { |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
154 G1ParGCAllocBuffer* const buf = _alloc_buffers[state]; |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
155 if (buf != NULL) { |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
156 add_to_alloc_buffer_waste(buf->words_remaining()); |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
157 buf->flush_stats_and_retire(_g1h->alloc_buffer_stats(state), |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
158 true /* end_of_gc */, |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
159 false /* retain */); |
c132be0fb74d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
22897
diff
changeset
|
160 } |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
161 } |
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
diff
changeset
|
162 } |