Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/shared/vmGCOperations.cpp @ 10405:f2110083203d
8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
author | sla |
---|---|
date | Mon, 10 Jun 2013 11:30:51 +0200 |
parents | 868d87ed63c8 |
children | bf9e50c573ad |
comparison
equal
deleted
inserted
replaced
10404:d0add7016434 | 10405:f2110083203d |
---|---|
143 bool VM_GC_HeapInspection::skip_operation() const { | 143 bool VM_GC_HeapInspection::skip_operation() const { |
144 assert(Universe::heap()->supports_heap_inspection(), "huh?"); | 144 assert(Universe::heap()->supports_heap_inspection(), "huh?"); |
145 return false; | 145 return false; |
146 } | 146 } |
147 | 147 |
148 bool VM_GC_HeapInspection::collect() { | |
149 if (GC_locker::is_active()) { | |
150 return false; | |
151 } | |
152 Universe::heap()->collect_as_vm_thread(GCCause::_heap_inspection); | |
153 return true; | |
154 } | |
155 | |
148 void VM_GC_HeapInspection::doit() { | 156 void VM_GC_HeapInspection::doit() { |
149 HandleMark hm; | 157 HandleMark hm; |
150 CollectedHeap* ch = Universe::heap(); | 158 Universe::heap()->ensure_parsability(false); // must happen, even if collection does |
151 ch->ensure_parsability(false); // must happen, even if collection does | 159 // not happen (e.g. due to GC_locker) |
152 // not happen (e.g. due to GC_locker) | 160 // or _full_gc being false |
153 if (_full_gc) { | 161 if (_full_gc) { |
154 // The collection attempt below would be skipped anyway if | 162 if (!collect()) { |
155 // the gc locker is held. The following dump may then be a tad | 163 // The collection attempt was skipped because the gc locker is held. |
156 // misleading to someone expecting only live objects to show | 164 // The following dump may then be a tad misleading to someone expecting |
157 // up in the dump (see CR 6944195). Just issue a suitable warning | 165 // only live objects to show up in the dump (see CR 6944195). Just issue |
158 // in that case and do not attempt to do a collection. | 166 // a suitable warning in that case and do not attempt to do a collection. |
159 // The latter is a subtle point, because even a failed attempt | 167 // The latter is a subtle point, because even a failed attempt |
160 // to GC will, in fact, induce one in the future, which we | 168 // to GC will, in fact, induce one in the future, which we |
161 // probably want to avoid in this case because the GC that we may | 169 // probably want to avoid in this case because the GC that we may |
162 // be about to attempt holds value for us only | 170 // be about to attempt holds value for us only |
163 // if it happens now and not if it happens in the eventual | 171 // if it happens now and not if it happens in the eventual |
164 // future. | 172 // future. |
165 if (GC_locker::is_active()) { | |
166 warning("GC locker is held; pre-dump GC was skipped"); | 173 warning("GC locker is held; pre-dump GC was skipped"); |
167 } else { | |
168 ch->collect_as_vm_thread(GCCause::_heap_inspection); | |
169 } | 174 } |
170 } | 175 } |
171 HeapInspection inspect(_csv_format, _print_help, _print_class_stats, | 176 HeapInspection inspect(_csv_format, _print_help, _print_class_stats, |
172 _columns); | 177 _columns); |
173 inspect.heap_inspection(_out, _need_prologue /* need_prologue */); | 178 inspect.heap_inspection(_out); |
174 } | 179 } |
175 | 180 |
176 | 181 |
177 void VM_GenCollectForAllocation::doit() { | 182 void VM_GenCollectForAllocation::doit() { |
178 SvcGCMarker sgcm(SvcGCMarker::MINOR); | 183 SvcGCMarker sgcm(SvcGCMarker::MINOR); |