Mercurial > hg > graal-jvmci-8
annotate src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp @ 20211:82693fb204a5
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
Summary: The test incorrectly assumed that it had been started with no other previous compilation activity. Fix this by allowing multiple code root free chunk lists, and use one separate from the global one to perform the test.
Reviewed-by: brutisso
author | tschatzl |
---|---|
date | Wed, 16 Apr 2014 10:14:50 +0200 |
parents | 8847586c9037 |
children | 52b4284cb496 570cb6369f17 |
rev | line source |
---|---|
342 | 1 /* |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
342 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1282
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1282
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1282
diff
changeset
|
21 * questions. |
342 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "gc_implementation/g1/concurrentG1Refine.hpp" | |
27 #include "gc_implementation/g1/concurrentG1RefineThread.hpp" | |
28 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
29 #include "gc_implementation/g1/g1HotCardCache.hpp" |
13437
1de8e5356754
8029326: G1 does not check if threads gets created
ehelin
parents:
10372
diff
changeset
|
30 #include "runtime/java.hpp" |
2431
02f49b66361a
7026932: G1: No need to abort VM when card count cache expansion fails
johnc
parents:
2364
diff
changeset
|
31 |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
32 ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h) : |
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
33 _threads(NULL), _n_threads(0), |
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
34 _hot_card_cache(g1h) |
342 | 35 { |
1111 | 36 // Ergomonically select initial concurrent refinement parameters |
1282 | 37 if (FLAG_IS_DEFAULT(G1ConcRefinementGreenZone)) { |
38 FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, MAX2<int>(ParallelGCThreads, 1)); | |
1111 | 39 } |
1282 | 40 set_green_zone(G1ConcRefinementGreenZone); |
1111 | 41 |
1282 | 42 if (FLAG_IS_DEFAULT(G1ConcRefinementYellowZone)) { |
43 FLAG_SET_DEFAULT(G1ConcRefinementYellowZone, green_zone() * 3); | |
1111 | 44 } |
1282 | 45 set_yellow_zone(MAX2<int>(G1ConcRefinementYellowZone, green_zone())); |
1111 | 46 |
1282 | 47 if (FLAG_IS_DEFAULT(G1ConcRefinementRedZone)) { |
48 FLAG_SET_DEFAULT(G1ConcRefinementRedZone, yellow_zone() * 2); | |
1111 | 49 } |
1282 | 50 set_red_zone(MAX2<int>(G1ConcRefinementRedZone, yellow_zone())); |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
51 |
1111 | 52 _n_worker_threads = thread_num(); |
53 // We need one extra thread to do the young gen rset size sampling. | |
54 _n_threads = _n_worker_threads + 1; | |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
55 |
1111 | 56 reset_threshold_step(); |
57 | |
6197 | 58 _threads = NEW_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _n_threads, mtGC); |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
59 |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
60 uint worker_id_offset = DirtyCardQueueSet::num_par_ids(); |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
61 |
1111 | 62 ConcurrentG1RefineThread *next = NULL; |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
63 for (uint i = _n_threads - 1; i != UINT_MAX; i--) { |
1111 | 64 ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, worker_id_offset, i); |
65 assert(t != NULL, "Conc refine should have been created"); | |
13437
1de8e5356754
8029326: G1 does not check if threads gets created
ehelin
parents:
10372
diff
changeset
|
66 if (t->osthread() == NULL) { |
1de8e5356754
8029326: G1 does not check if threads gets created
ehelin
parents:
10372
diff
changeset
|
67 vm_shutdown_during_initialization("Could not create ConcurrentG1RefineThread"); |
1de8e5356754
8029326: G1 does not check if threads gets created
ehelin
parents:
10372
diff
changeset
|
68 } |
1de8e5356754
8029326: G1 does not check if threads gets created
ehelin
parents:
10372
diff
changeset
|
69 |
1111 | 70 assert(t->cg1r() == this, "Conc refine thread should refer to this"); |
71 _threads[i] = t; | |
72 next = t; | |
342 | 73 } |
74 } | |
75 | |
1111 | 76 void ConcurrentG1Refine::reset_threshold_step() { |
1282 | 77 if (FLAG_IS_DEFAULT(G1ConcRefinementThresholdStep)) { |
1111 | 78 _thread_threshold_step = (yellow_zone() - green_zone()) / (worker_thread_num() + 1); |
79 } else { | |
1282 | 80 _thread_threshold_step = G1ConcRefinementThresholdStep; |
795
215f81b4d9b3
6841831: G1: assert(contains_reference(from),"We just added it!") fires
iveresov
parents:
794
diff
changeset
|
81 } |
1111 | 82 } |
83 | |
342 | 84 void ConcurrentG1Refine::init() { |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
85 _hot_card_cache.initialize(); |
342 | 86 } |
87 | |
794 | 88 void ConcurrentG1Refine::stop() { |
89 if (_threads != NULL) { | |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
90 for (uint i = 0; i < _n_threads; i++) { |
794 | 91 _threads[i]->stop(); |
92 } | |
93 } | |
94 } | |
95 | |
1111 | 96 void ConcurrentG1Refine::reinitialize_threads() { |
97 reset_threshold_step(); | |
98 if (_threads != NULL) { | |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
99 for (uint i = 0; i < _n_threads; i++) { |
1111 | 100 _threads[i]->initialize(); |
101 } | |
102 } | |
103 } | |
104 | |
342 | 105 ConcurrentG1Refine::~ConcurrentG1Refine() { |
794 | 106 if (_threads != NULL) { |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
107 for (uint i = 0; i < _n_threads; i++) { |
794 | 108 delete _threads[i]; |
109 } | |
6197 | 110 FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads, mtGC); |
342 | 111 } |
112 } | |
113 | |
794 | 114 void ConcurrentG1Refine::threads_do(ThreadClosure *tc) { |
115 if (_threads != NULL) { | |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
116 for (uint i = 0; i < _n_threads; i++) { |
794 | 117 tc->do_thread(_threads[i]); |
118 } | |
342 | 119 } |
120 } | |
121 | |
10372
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
122 void ConcurrentG1Refine::worker_threads_do(ThreadClosure * tc) { |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
123 if (_threads != NULL) { |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
124 for (uint i = 0; i < worker_thread_num(); i++) { |
10372
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
125 tc->do_thread(_threads[i]); |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
126 } |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
127 } |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
128 } |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
129 |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
130 uint ConcurrentG1Refine::thread_num() { |
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
131 uint n_threads = (G1ConcRefinementThreads > 0) ? G1ConcRefinementThreads |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
132 : ParallelGCThreads; |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
133 return MAX2<uint>(n_threads, 1); |
342 | 134 } |
1019 | 135 |
136 void ConcurrentG1Refine::print_worker_threads_on(outputStream* st) const { | |
17844
8847586c9037
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
13437
diff
changeset
|
137 for (uint i = 0; i < _n_threads; ++i) { |
1019 | 138 _threads[i]->print_on(st); |
139 st->cr(); | |
140 } | |
141 } | |
10372
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
142 |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
143 ConcurrentG1RefineThread * ConcurrentG1Refine::sampling_thread() const { |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
144 return _threads[worker_thread_num()]; |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
145 } |