--- old/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp 2020-05-26 09:44:29.204159611 +0200 +++ new/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp 2020-05-26 09:44:28.888160030 +0200 @@ -46,6 +46,7 @@ #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.hpp" +#include "gc/shenandoah/shenandoahInitLogger.hpp" #include "gc/shenandoah/shenandoahMarkCompact.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" #include "gc/shenandoah/shenandoahMemoryPool.hpp" @@ -404,13 +405,10 @@ _control_thread = new ShenandoahControlThread(); - log_info(gc, init)("Initialize Shenandoah heap: " SIZE_FORMAT "%s initial, " SIZE_FORMAT "%s min, " SIZE_FORMAT "%s max", - byte_size_in_proper_unit(_initial_size), proper_unit_for_byte_size(_initial_size), - byte_size_in_proper_unit(_minimum_size), proper_unit_for_byte_size(_minimum_size), - byte_size_in_proper_unit(max_capacity()), proper_unit_for_byte_size(max_capacity()) - ); + _ref_proc_mt_processing = ParallelRefProcEnabled && (ParallelGCThreads > 1); + _ref_proc_mt_discovery = _max_workers > 1; - log_info(gc, init)("Safepointing mechanism: thread-local poll"); + ShenandoahInitLogger::print(); return JNI_OK; } @@ -440,8 +438,6 @@ err_msg("GC mode \"%s\" is experimental, and must be enabled via -XX:+UnlockExperimentalVMOptions.", _gc_mode->name())); } - log_info(gc, init)("Shenandoah GC mode: %s", - _gc_mode->name()); _heuristics = _gc_mode->initialize_heuristics(); @@ -455,8 +451,6 @@ err_msg("Heuristics \"%s\" is experimental, and must be enabled via -XX:+UnlockExperimentalVMOptions.", _heuristics->name())); } - log_info(gc, init)("Shenandoah heuristics: %s", - _heuristics->name()); } #ifdef _MSC_VER @@ -505,8 +499,6 @@ { _heap = this; - log_info(gc, init)("GC threads: " UINT32_FORMAT " parallel, " UINT32_FORMAT " concurrent", ParallelGCThreads, ConcGCThreads); - BarrierSet::set_barrier_set(new ShenandoahBarrierSet(this)); _max_workers = MAX2(_max_workers, 1U); @@ -2152,23 +2144,16 @@ void ShenandoahHeap::ref_processing_init() { assert(_max_workers > 0, "Sanity"); - bool mt_processing = ParallelRefProcEnabled && (ParallelGCThreads > 1); - bool mt_discovery = _max_workers > 1; - _ref_processor = new ReferenceProcessor(&_subject_to_discovery, // is_subject_to_discovery - mt_processing, // MT processing + _ref_proc_mt_processing, // MT processing _max_workers, // Degree of MT processing - mt_discovery, // MT discovery + _ref_proc_mt_discovery, // MT discovery _max_workers, // Degree of MT discovery false, // Reference discovery is not atomic NULL, // No closure, should be installed before use true); // Scale worker threads - log_info(gc, init)("Reference processing: %s discovery, %s processing", - mt_discovery ? "parallel" : "serial", - mt_processing ? "parallel" : "serial"); - shenandoah_assert_rp_isalive_not_installed(); } --- old/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp 2020-05-26 09:44:30.008158543 +0200 +++ new/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp 2020-05-26 09:44:29.700158952 +0200 @@ -457,6 +457,7 @@ public: ShenandoahCollectorPolicy* shenandoah_policy() const { return _shenandoah_policy; } + ShenandoahMode* mode() const { return _gc_mode; } ShenandoahHeuristics* heuristics() const { return _heuristics; } ShenandoahFreeSet* free_set() const { return _free_set; } ShenandoahConcurrentMark* concurrent_mark() { return _scm; } @@ -496,11 +497,15 @@ AlwaysTrueClosure _subject_to_discovery; ReferenceProcessor* _ref_processor; ShenandoahSharedFlag _process_references; + bool _ref_proc_mt_discovery; + bool _ref_proc_mt_processing; void ref_processing_init(); public: ReferenceProcessor* ref_processor() { return _ref_processor; } + bool ref_processor_mt_discovery() { return _ref_proc_mt_discovery; } + bool ref_processor_mt_processing() { return _ref_proc_mt_processing; } void set_process_references(bool pr); bool process_references() const; --- old/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp 2020-05-26 09:44:30.776157522 +0200 +++ new/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp 2020-05-26 09:44:30.464157936 +0200 @@ -609,13 +609,6 @@ guarantee(MaxTLABSizeBytes == 0, "we should only set it once"); MaxTLABSizeBytes = MaxTLABSizeWords * HeapWordSize; assert (MaxTLABSizeBytes > MinTLABSize, "should be larger"); - - log_info(gc, init)("Regions: " SIZE_FORMAT " x " SIZE_FORMAT "%s", - RegionCount, byte_size_in_proper_unit(RegionSizeBytes), proper_unit_for_byte_size(RegionSizeBytes)); - log_info(gc, init)("Humongous object threshold: " SIZE_FORMAT "%s", - byte_size_in_proper_unit(HumongousThresholdBytes), proper_unit_for_byte_size(HumongousThresholdBytes)); - log_info(gc, init)("Max TLAB size: " SIZE_FORMAT "%s", - byte_size_in_proper_unit(MaxTLABSizeBytes), proper_unit_for_byte_size(MaxTLABSizeBytes)); } void ShenandoahHeapRegion::do_commit() { --- /dev/null 2020-05-19 20:56:12.388772705 +0200 +++ new/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp 2020-05-26 09:44:31.232156917 +0200 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2020, Red Hat, Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/shenandoah/shenandoahHeap.hpp" +#include "gc/shenandoah/shenandoahHeapRegion.hpp" +#include "gc/shenandoah/shenandoahInitLogger.hpp" +#include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp" +#include "gc/shenandoah/mode/shenandoahMode.hpp" +#include "logging/log.hpp" +#include "runtime/globals.hpp" +#include "utilities/globalDefinitions.hpp" + +void ShenandoahInitLogger::print_heap() { + GCInitLogger::print_heap(); + + ShenandoahHeap* heap = ShenandoahHeap::heap(); + + log_info(gc, init)("Mode: %s", + heap->mode()->name()); + + log_info(gc, init)("Heuristics: %s", + heap->heuristics()->name()); + + log_info(gc, init)("Heap Region Count: " SIZE_FORMAT, + ShenandoahHeapRegion::region_count()); + + log_info(gc, init)("Heap Region Size: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(ShenandoahHeapRegion::region_size_bytes()), + exact_unit_for_byte_size(ShenandoahHeapRegion::region_size_bytes())); + + log_info(gc, init)("TLAB Size Max: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(ShenandoahHeapRegion::max_tlab_size_bytes()), + exact_unit_for_byte_size(ShenandoahHeapRegion::max_tlab_size_bytes())); + + log_info(gc, init)("Humongous Object Threshold: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(ShenandoahHeapRegion::humongous_threshold_bytes()), + exact_unit_for_byte_size(ShenandoahHeapRegion::humongous_threshold_bytes())); + + log_info(gc, init)("Reference Processing: %s discovery, %s processing", + heap->ref_processor_mt_discovery() ? "Parallel" : "Serial", + heap->ref_processor_mt_processing() ? "Parallel" : "Serial"); +} + +void ShenandoahInitLogger::print() { + ShenandoahInitLogger init_log; + init_log.print_all(); +} --- /dev/null 2020-05-19 20:56:12.388772705 +0200 +++ new/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.hpp 2020-05-26 09:44:32.012155881 +0200 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020, Red Hat, Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHINITLOGGER_HPP +#define SHARE_GC_SHENANDOAH_SHENANDOAHINITLOGGER_HPP + +#include "gc/shared/gcInitLogger.hpp" + +class ShenandoahInitLogger : public GCInitLogger { +protected: + virtual void print_heap(); + +public: + static void print(); +}; + +#endif // SHARE_GC_SHENANDOAH_SHENANDOAHINITLOGGER_HPP