Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/shared/vmGCOperations.cpp @ 2125:7246a374a9f2
6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
Summary: Make JvmtiGCMark safe to run non-safepoint and instrument CMS
Reviewed-by: ysr, dcubed
author | kamg |
---|---|
date | Mon, 10 Jan 2011 17:14:53 -0500 |
parents | f95d63e2154a |
children | c798c277ddd1 |
comparison
equal
deleted
inserted
replaced
2124:e31d8c656c5b | 2125:7246a374a9f2 |
---|---|
29 #include "memory/gcLocker.inline.hpp" | 29 #include "memory/gcLocker.inline.hpp" |
30 #include "memory/genCollectedHeap.hpp" | 30 #include "memory/genCollectedHeap.hpp" |
31 #include "memory/oopFactory.hpp" | 31 #include "memory/oopFactory.hpp" |
32 #include "oops/instanceKlass.hpp" | 32 #include "oops/instanceKlass.hpp" |
33 #include "oops/instanceRefKlass.hpp" | 33 #include "oops/instanceRefKlass.hpp" |
34 #include "prims/jvmtiExport.hpp" | |
35 #include "runtime/handles.inline.hpp" | 34 #include "runtime/handles.inline.hpp" |
36 #include "runtime/init.hpp" | 35 #include "runtime/init.hpp" |
37 #include "runtime/interfaceSupport.hpp" | 36 #include "runtime/interfaceSupport.hpp" |
38 #include "utilities/dtrace.hpp" | 37 #include "utilities/dtrace.hpp" |
39 #include "utilities/preserveException.hpp" | 38 #include "utilities/preserveException.hpp" |
40 #ifndef SERIALGC | 39 #ifndef SERIALGC |
41 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | 40 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
42 #endif | 41 #endif |
42 | |
43 HS_DTRACE_PROBE_DECL1(hotspot, gc__begin, bool); | 43 HS_DTRACE_PROBE_DECL1(hotspot, gc__begin, bool); |
44 HS_DTRACE_PROBE_DECL(hotspot, gc__end); | 44 HS_DTRACE_PROBE_DECL(hotspot, gc__end); |
45 | 45 |
46 // The same dtrace probe can't be inserted in two different files, so we | 46 // The same dtrace probe can't be inserted in two different files, so we |
47 // have to call it here, so it's only in one file. Can't create new probes | 47 // have to call it here, so it's only in one file. Can't create new probes |
156 HeapInspection::heap_inspection(_out, _need_prologue /* need_prologue */); | 156 HeapInspection::heap_inspection(_out, _need_prologue /* need_prologue */); |
157 } | 157 } |
158 | 158 |
159 | 159 |
160 void VM_GenCollectForAllocation::doit() { | 160 void VM_GenCollectForAllocation::doit() { |
161 JvmtiGCForAllocationMarker jgcm; | 161 SvcGCMarker sgcm(SvcGCMarker::MINOR); |
162 notify_gc_begin(false); | |
163 | 162 |
164 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 163 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
165 GCCauseSetter gccs(gch, _gc_cause); | 164 GCCauseSetter gccs(gch, _gc_cause); |
166 _res = gch->satisfy_failed_allocation(_size, _tlab); | 165 _res = gch->satisfy_failed_allocation(_size, _tlab); |
167 assert(gch->is_in_reserved_or_null(_res), "result not in heap"); | 166 assert(gch->is_in_reserved_or_null(_res), "result not in heap"); |
168 | 167 |
169 if (_res == NULL && GC_locker::is_active_and_needs_gc()) { | 168 if (_res == NULL && GC_locker::is_active_and_needs_gc()) { |
170 set_gc_locked(); | 169 set_gc_locked(); |
171 } | 170 } |
172 notify_gc_end(); | |
173 } | 171 } |
174 | 172 |
175 void VM_GenCollectFull::doit() { | 173 void VM_GenCollectFull::doit() { |
176 JvmtiGCFullMarker jgcm; | 174 SvcGCMarker sgcm(SvcGCMarker::FULL); |
177 notify_gc_begin(true); | |
178 | 175 |
179 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 176 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
180 GCCauseSetter gccs(gch, _gc_cause); | 177 GCCauseSetter gccs(gch, _gc_cause); |
181 gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level); | 178 gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level); |
182 notify_gc_end(); | |
183 } | 179 } |
184 | 180 |
185 void VM_GenCollectForPermanentAllocation::doit() { | 181 void VM_GenCollectForPermanentAllocation::doit() { |
186 JvmtiGCForAllocationMarker jgcm; | 182 SvcGCMarker sgcm(SvcGCMarker::FULL); |
187 notify_gc_begin(true); | 183 |
188 SharedHeap* heap = (SharedHeap*)Universe::heap(); | 184 SharedHeap* heap = (SharedHeap*)Universe::heap(); |
189 GCCauseSetter gccs(heap, _gc_cause); | 185 GCCauseSetter gccs(heap, _gc_cause); |
190 switch (heap->kind()) { | 186 switch (heap->kind()) { |
191 case (CollectedHeap::GenCollectedHeap): { | 187 case (CollectedHeap::GenCollectedHeap): { |
192 GenCollectedHeap* gch = (GenCollectedHeap*)heap; | 188 GenCollectedHeap* gch = (GenCollectedHeap*)heap; |
207 _res = heap->perm_gen()->allocate(_size, false); | 203 _res = heap->perm_gen()->allocate(_size, false); |
208 assert(heap->is_in_reserved_or_null(_res), "result not in heap"); | 204 assert(heap->is_in_reserved_or_null(_res), "result not in heap"); |
209 if (_res == NULL && GC_locker::is_active_and_needs_gc()) { | 205 if (_res == NULL && GC_locker::is_active_and_needs_gc()) { |
210 set_gc_locked(); | 206 set_gc_locked(); |
211 } | 207 } |
212 notify_gc_end(); | 208 } |
213 } |