Path: blob/master/src/hotspot/share/gc/z/zArguments.cpp
40957 views
/*1* Copyright (c) 2017, 2020, 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#ifdef COMPILER275// Enable loop strip mining by default76if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {77FLAG_SET_DEFAULT(UseCountedLoopSafepoints, true);78if (FLAG_IS_DEFAULT(LoopStripMiningIter)) {79FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);80}81}82#endif8384// CompressedOops not supported85FLAG_SET_DEFAULT(UseCompressedOops, false);8687// Verification before startup and after exit not (yet) supported88FLAG_SET_DEFAULT(VerifyDuringStartup, false);89FLAG_SET_DEFAULT(VerifyBeforeExit, false);9091if (VerifyBeforeGC || VerifyDuringGC || VerifyAfterGC) {92FLAG_SET_DEFAULT(ZVerifyRoots, true);93FLAG_SET_DEFAULT(ZVerifyObjects, true);94}95}9697size_t ZArguments::heap_virtual_to_physical_ratio() {98return ZHeapViews * ZVirtualToPhysicalRatio;99}100101size_t ZArguments::conservative_max_heap_alignment() {102return 0;103}104105CollectedHeap* ZArguments::create_heap() {106return new ZCollectedHeap();107}108109bool ZArguments::is_supported() const {110return is_os_supported();111}112113114