< prev index next >

src/hotspot/share/gc/z/zCollectedHeap.cpp

Print this page

170   // Retry allocation
171   result = loader_data->metaspace_non_null()->allocate(size, mdtype);
172   if (result != NULL) {
173     return result;
174   }
175 
176   // Expand and retry allocation
177   result = loader_data->metaspace_non_null()->expand_and_allocate(size, mdtype);
178   if (result != NULL) {
179     return result;
180   }
181 
182   // Out of memory
183   return NULL;
184 }
185 
186 void ZCollectedHeap::collect(GCCause::Cause cause) {
187   _driver->collect(cause);
188 }
189 





190 void ZCollectedHeap::collect_as_vm_thread(GCCause::Cause cause) {
191   // These collection requests are ignored since ZGC can't run a synchronous
192   // GC cycle from within the VM thread. This is considered benign, since the
193   // only GC causes coming in here should be heap dumper and heap inspector.
194   // However, neither the heap dumper nor the heap inspector really need a GC
195   // to happen, but the result of their heap iterations might in that case be
196   // less accurate since they might include objects that would otherwise have
197   // been collected by a GC.
198   assert(Thread::current()->is_VM_thread(), "Should be the VM thread");
199   guarantee(cause == GCCause::_heap_dump ||
200             cause == GCCause::_heap_inspection, "Invalid cause");
201 }
202 
203 void ZCollectedHeap::do_full_collection(bool clear_all_soft_refs) {
204   // Not supported
205   ShouldNotReachHere();
206 }
207 
208 size_t ZCollectedHeap::tlab_capacity(Thread* ignored) const {
209   return _heap.tlab_capacity();

170   // Retry allocation
171   result = loader_data->metaspace_non_null()->allocate(size, mdtype);
172   if (result != NULL) {
173     return result;
174   }
175 
176   // Expand and retry allocation
177   result = loader_data->metaspace_non_null()->expand_and_allocate(size, mdtype);
178   if (result != NULL) {
179     return result;
180   }
181 
182   // Out of memory
183   return NULL;
184 }
185 
186 void ZCollectedHeap::collect(GCCause::Cause cause) {
187   _driver->collect(cause);
188 }
189 
190 void ZCollectedHeap::collect_for_codecache() {
191   // Start synchronous GC
192   collect(GCCause::_codecache_GC_threshold);
193 }
194 
195 void ZCollectedHeap::collect_as_vm_thread(GCCause::Cause cause) {
196   // These collection requests are ignored since ZGC can't run a synchronous
197   // GC cycle from within the VM thread. This is considered benign, since the
198   // only GC causes coming in here should be heap dumper and heap inspector.
199   // However, neither the heap dumper nor the heap inspector really need a GC
200   // to happen, but the result of their heap iterations might in that case be
201   // less accurate since they might include objects that would otherwise have
202   // been collected by a GC.
203   assert(Thread::current()->is_VM_thread(), "Should be the VM thread");
204   guarantee(cause == GCCause::_heap_dump ||
205             cause == GCCause::_heap_inspection, "Invalid cause");
206 }
207 
208 void ZCollectedHeap::do_full_collection(bool clear_all_soft_refs) {
209   // Not supported
210   ShouldNotReachHere();
211 }
212 
213 size_t ZCollectedHeap::tlab_capacity(Thread* ignored) const {
214   return _heap.tlab_capacity();
< prev index next >