Path: blob/master/src/hotspot/share/gc/z/zArguments.cpp
66644 views
/*1* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223#include "precompiled.hpp"24#include "gc/z/zAddressSpaceLimit.hpp"25#include "gc/z/zArguments.hpp"26#include "gc/z/zCollectedHeap.hpp"27#include "gc/z/zGlobals.hpp"28#include "gc/z/zHeuristics.hpp"29#include "gc/shared/gcArguments.hpp"30#include "runtime/globals.hpp"31#include "runtime/globals_extension.hpp"32#include "runtime/java.hpp"3334void ZArguments::initialize_alignments() {35SpaceAlignment = ZGranuleSize;36HeapAlignment = SpaceAlignment;37}3839void ZArguments::initialize() {40GCArguments::initialize();4142// Check mark stack size43const size_t mark_stack_space_limit = ZAddressSpaceLimit::mark_stack();44if (ZMarkStackSpaceLimit > mark_stack_space_limit) {45if (!FLAG_IS_DEFAULT(ZMarkStackSpaceLimit)) {46vm_exit_during_initialization("ZMarkStackSpaceLimit too large for limited address space");47}48FLAG_SET_DEFAULT(ZMarkStackSpaceLimit, mark_stack_space_limit);49}5051// Enable NUMA by default52if (FLAG_IS_DEFAULT(UseNUMA)) {53FLAG_SET_DEFAULT(UseNUMA, true);54}5556// Select number of parallel threads57if (FLAG_IS_DEFAULT(ParallelGCThreads)) {58FLAG_SET_DEFAULT(ParallelGCThreads, ZHeuristics::nparallel_workers());59}6061if (ParallelGCThreads == 0) {62vm_exit_during_initialization("The flag -XX:+UseZGC can not be combined with -XX:ParallelGCThreads=0");63}6465// Select number of concurrent threads66if (FLAG_IS_DEFAULT(ConcGCThreads)) {67FLAG_SET_DEFAULT(ConcGCThreads, ZHeuristics::nconcurrent_workers());68}6970if (ConcGCThreads == 0) {71vm_exit_during_initialization("The flag -XX:+UseZGC can not be combined with -XX:ConcGCThreads=0");72}7374// The heuristics used when UseDynamicNumberOfGCThreads is75// enabled defaults to using a ZAllocationSpikeTolerance of 1.76if (UseDynamicNumberOfGCThreads && FLAG_IS_DEFAULT(ZAllocationSpikeTolerance)) {77FLAG_SET_DEFAULT(ZAllocationSpikeTolerance, 1);78}7980#ifdef COMPILER281// Enable loop strip mining by default82if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {83FLAG_SET_DEFAULT(UseCountedLoopSafepoints, true);84if (FLAG_IS_DEFAULT(LoopStripMiningIter)) {85FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);86}87}88#endif8990// CompressedOops not supported91FLAG_SET_DEFAULT(UseCompressedOops, false);9293// Verification before startup and after exit not (yet) supported94FLAG_SET_DEFAULT(VerifyDuringStartup, false);95FLAG_SET_DEFAULT(VerifyBeforeExit, false);9697if (VerifyBeforeGC || VerifyDuringGC || VerifyAfterGC) {98FLAG_SET_DEFAULT(ZVerifyRoots, true);99FLAG_SET_DEFAULT(ZVerifyObjects, true);100}101}102103size_t ZArguments::heap_virtual_to_physical_ratio() {104return ZHeapViews * ZVirtualToPhysicalRatio;105}106107size_t ZArguments::conservative_max_heap_alignment() {108return 0;109}110111CollectedHeap* ZArguments::create_heap() {112return new ZCollectedHeap();113}114115bool ZArguments::is_supported() const {116return is_os_supported();117}118119120