< prev index next >

src/hotspot/share/gc/epsilon/epsilonHeap.cpp

Print this page
rev 53302 : 8217014: Epsilon should not ignore Metadata GC causes
Reviewed-by: stuefe

*** 159,174 **** // ...and print the occupancy line, if needed { size_t last = _last_heap_print; if ((used - last >= _step_heap_print) && Atomic::cmpxchg(used, &_last_heap_print, last) == last) { ! log_info(gc)("Heap: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M (%.2f%%) committed, " SIZE_FORMAT "M (%.2f%%) used", ! max_capacity() / M, ! capacity() / M, ! capacity() * 100.0 / max_capacity(), ! used / M, ! used * 100.0 / max_capacity()); } } assert(is_object_aligned(res), "Object should be aligned: " PTR_FORMAT, p2i(res)); return res; --- 159,170 ---- // ...and print the occupancy line, if needed { size_t last = _last_heap_print; if ((used - last >= _step_heap_print) && Atomic::cmpxchg(used, &_last_heap_print, last) == last) { ! print_heap_info(used); ! print_metaspace_info(); } } assert(is_object_aligned(res), "Object should be aligned: " PTR_FORMAT, p2i(res)); return res;
*** 266,282 **** *gc_overhead_limit_was_exceeded = false; return allocate_work(size); } void EpsilonHeap::collect(GCCause::Cause cause) { log_info(gc)("GC request for \"%s\" is ignored", GCCause::to_string(cause)); _monitoring_support->update_counters(); } void EpsilonHeap::do_full_collection(bool clear_all_soft_refs) { ! log_info(gc)("Full GC request for \"%s\" is ignored", GCCause::to_string(gc_cause())); ! _monitoring_support->update_counters(); } void EpsilonHeap::safe_object_iterate(ObjectClosure *cl) { _space->safe_object_iterate(cl); } --- 262,291 ---- *gc_overhead_limit_was_exceeded = false; return allocate_work(size); } void EpsilonHeap::collect(GCCause::Cause cause) { + switch (cause) { + case GCCause::_metadata_GC_threshold: + case GCCause::_metadata_GC_clear_soft_refs: + // Receiving these causes means the VM itself entered the safepoint for metadata collection. + // While Epsilon does not do GC, it has to perform sizing adjustments, otherwise we would + // re-enter the safepoint again very soon. + + assert(SafepointSynchronize::is_at_safepoint(), "Expected at safepoint"); + log_info(gc)("GC request for \"%s\" is handled", GCCause::to_string(cause)); + MetaspaceGC::compute_new_size(); + print_metaspace_info(); + break; + default: log_info(gc)("GC request for \"%s\" is ignored", GCCause::to_string(cause)); + } _monitoring_support->update_counters(); } void EpsilonHeap::do_full_collection(bool clear_all_soft_refs) { ! collect(gc_cause()); } void EpsilonHeap::safe_object_iterate(ObjectClosure *cl) { _space->safe_object_iterate(cl); }
*** 287,301 **** // Cast away constness: ((VirtualSpace)_virtual_space).print_on(st); st->print_cr("Allocation space:"); _space->print_on(st); } void EpsilonHeap::print_tracing_info() const { ! Log(gc) log; ! size_t allocated_kb = used() / K; ! log.info("Total allocated: " SIZE_FORMAT " KB", ! allocated_kb); ! log.info("Average allocation rate: " SIZE_FORMAT " KB/sec", ! (size_t)(allocated_kb * NANOSECS_PER_SEC / os::elapsed_counter())); } --- 296,341 ---- // Cast away constness: ((VirtualSpace)_virtual_space).print_on(st); st->print_cr("Allocation space:"); _space->print_on(st); + + MetaspaceUtils::print_on(st); } void EpsilonHeap::print_tracing_info() const { ! print_heap_info(used()); ! print_metaspace_info(); ! } ! ! void EpsilonHeap::print_heap_info(size_t used) const { ! size_t reserved = max_capacity(); ! size_t committed = capacity(); ! ! if (reserved != 0) { ! log_info(gc)("Heap: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M (%.2f%%) committed, " SIZE_FORMAT "M (%.2f%%) used", ! reserved / M, ! committed / M, ! committed * 100.0 / reserved, ! used / M, ! used * 100.0 / reserved); ! } else { ! log_info(gc)("Heap: no reliable data"); ! } ! } ! ! void EpsilonHeap::print_metaspace_info() const { ! size_t reserved = MetaspaceUtils::reserved_bytes(); ! size_t committed = MetaspaceUtils::committed_bytes(); ! size_t used = MetaspaceUtils::used_bytes(); ! ! if (reserved != 0) { ! log_info(gc, metaspace)("Metaspace: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M (%.2f%%) committed, " SIZE_FORMAT "M (%.2f%%) used", ! reserved / M, ! committed / M, ! committed * 100.0 / reserved, ! used / M, ! used * 100.0 / reserved); ! } else { ! log_info(gc, metaspace)("Metaspace: no reliable data"); ! } }
< prev index next >