Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp @ 11173:6b0fd0964b87
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 31 Jul 2013 11:00:54 +0200 |
parents | e72f7eecc96d |
children | 1de8e5356754 |
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" |
2431
02f49b66361a
7026932: G1: No need to abort VM when card count cache expansion fails
johnc
parents:
2364
diff
changeset
|
30 |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
31 ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h) : |
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
32 _threads(NULL), _n_threads(0), |
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
33 _hot_card_cache(g1h) |
342 | 34 { |
1111 | 35 // Ergomonically select initial concurrent refinement parameters |
1282 | 36 if (FLAG_IS_DEFAULT(G1ConcRefinementGreenZone)) { |
37 FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, MAX2<int>(ParallelGCThreads, 1)); | |
1111 | 38 } |
1282 | 39 set_green_zone(G1ConcRefinementGreenZone); |
1111 | 40 |
1282 | 41 if (FLAG_IS_DEFAULT(G1ConcRefinementYellowZone)) { |
42 FLAG_SET_DEFAULT(G1ConcRefinementYellowZone, green_zone() * 3); | |
1111 | 43 } |
1282 | 44 set_yellow_zone(MAX2<int>(G1ConcRefinementYellowZone, green_zone())); |
1111 | 45 |
1282 | 46 if (FLAG_IS_DEFAULT(G1ConcRefinementRedZone)) { |
47 FLAG_SET_DEFAULT(G1ConcRefinementRedZone, yellow_zone() * 2); | |
1111 | 48 } |
1282 | 49 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
|
50 |
1111 | 51 _n_worker_threads = thread_num(); |
52 // We need one extra thread to do the young gen rset size sampling. | |
53 _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
|
54 |
1111 | 55 reset_threshold_step(); |
56 | |
6197 | 57 _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
|
58 |
1111 | 59 int worker_id_offset = (int)DirtyCardQueueSet::num_par_ids(); |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
60 |
1111 | 61 ConcurrentG1RefineThread *next = NULL; |
62 for (int i = _n_threads - 1; i >= 0; i--) { | |
63 ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, worker_id_offset, i); | |
64 assert(t != NULL, "Conc refine should have been created"); | |
65 assert(t->cg1r() == this, "Conc refine thread should refer to this"); | |
66 _threads[i] = t; | |
67 next = t; | |
342 | 68 } |
69 } | |
70 | |
1111 | 71 void ConcurrentG1Refine::reset_threshold_step() { |
1282 | 72 if (FLAG_IS_DEFAULT(G1ConcRefinementThresholdStep)) { |
1111 | 73 _thread_threshold_step = (yellow_zone() - green_zone()) / (worker_thread_num() + 1); |
74 } else { | |
1282 | 75 _thread_threshold_step = G1ConcRefinementThresholdStep; |
795
215f81b4d9b3
6841831: G1: assert(contains_reference(from),"We just added it!") fires
iveresov
parents:
794
diff
changeset
|
76 } |
1111 | 77 } |
78 | |
342 | 79 void ConcurrentG1Refine::init() { |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
80 _hot_card_cache.initialize(); |
342 | 81 } |
82 | |
794 | 83 void ConcurrentG1Refine::stop() { |
84 if (_threads != NULL) { | |
85 for (int i = 0; i < _n_threads; i++) { | |
86 _threads[i]->stop(); | |
87 } | |
88 } | |
89 } | |
90 | |
1111 | 91 void ConcurrentG1Refine::reinitialize_threads() { |
92 reset_threshold_step(); | |
93 if (_threads != NULL) { | |
94 for (int i = 0; i < _n_threads; i++) { | |
95 _threads[i]->initialize(); | |
96 } | |
97 } | |
98 } | |
99 | |
342 | 100 ConcurrentG1Refine::~ConcurrentG1Refine() { |
794 | 101 if (_threads != NULL) { |
102 for (int i = 0; i < _n_threads; i++) { | |
103 delete _threads[i]; | |
104 } | |
6197 | 105 FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads, mtGC); |
342 | 106 } |
107 } | |
108 | |
794 | 109 void ConcurrentG1Refine::threads_do(ThreadClosure *tc) { |
110 if (_threads != NULL) { | |
111 for (int i = 0; i < _n_threads; i++) { | |
112 tc->do_thread(_threads[i]); | |
113 } | |
342 | 114 } |
115 } | |
116 | |
10372
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
117 void ConcurrentG1Refine::worker_threads_do(ThreadClosure * tc) { |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
118 if (_threads != NULL) { |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
119 for (int i = 0; i < worker_thread_num(); i++) { |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
120 tc->do_thread(_threads[i]); |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
121 } |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
122 } |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
123 } |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
124 |
10246
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
125 int ConcurrentG1Refine::thread_num() { |
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
126 int n_threads = (G1ConcRefinementThreads > 0) ? G1ConcRefinementThreads |
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
127 : ParallelGCThreads; |
194f52aa2f23
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
6220
diff
changeset
|
128 return MAX2<int>(n_threads, 1); |
342 | 129 } |
1019 | 130 |
131 void ConcurrentG1Refine::print_worker_threads_on(outputStream* st) const { | |
132 for (int i = 0; i < _n_threads; ++i) { | |
133 _threads[i]->print_on(st); | |
134 st->cr(); | |
135 } | |
136 } | |
10372
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
137 |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
138 ConcurrentG1RefineThread * ConcurrentG1Refine::sampling_thread() const { |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
139 return _threads[worker_thread_num()]; |
e72f7eecc96d
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
10246
diff
changeset
|
140 } |