Path: blob/master/runtime/gc_vlhgc/ConfigurationIncrementalGenerational.hpp
5986 views
/*******************************************************************************1* Copyright (c) 1991, 2021 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122/**23* @file24* @ingroup GC_Modron_Standard25*/2627#if !defined(CONFIGURATIONTAROK_HPP_)28#define CONFIGURATIONTAROK_HPP_2930#include "j9.h"31#include "j9cfg.h"3233#include "Configuration.hpp"3435class MM_GlobalCollector;36class MM_Heap;37class MM_HeapRegionManager;38class MM_MemoryPool;39class MM_MemorySubSpaceTarok;404142class MM_ConfigurationIncrementalGenerational : public MM_Configuration43{44/* Data members / Types */45public:46protected:47private:48static const uintptr_t _tarokMinimumRegionSizeInBytes = (512 * 1024);4950/* Methods */51public:52static MM_Configuration *newInstance(MM_EnvironmentBase *env);5354virtual MM_GlobalCollector *createGlobalCollector(MM_EnvironmentBase *env);55virtual MM_Heap *createHeapWithManager(MM_EnvironmentBase *env, UDATA heapBytesRequested, MM_HeapRegionManager *regionManager);56virtual MM_HeapRegionManager *createHeapRegionManager(MM_EnvironmentBase *env);57virtual J9Pool *createEnvironmentPool(MM_EnvironmentBase *env);58virtual MM_MemorySpace *createDefaultMemorySpace(MM_EnvironmentBase *env, MM_Heap *heap, MM_InitializationParameters *parameters);59virtual void cleanUpClassLoader(MM_EnvironmentBase *env, J9ClassLoader* classLoader);60virtual void prepareParameters(OMR_VM *omrVM, UDATA minimumSpaceSize, UDATA minimumNewSpaceSize, UDATA initialNewSpaceSize,61UDATA maximumNewSpaceSize, UDATA minimumTenureSpaceSize, UDATA initialTenureSpaceSize, UDATA maximumTenureSpaceSize,62UDATA memoryMax, UDATA tenureFlags, MM_InitializationParameters *parameters);6364/**65* Constructor sets default arraylet leaf size to 0. This will be updated to match effective region size66* after the effective region size has been established in MM_GCExtensionsBase::regionSize.67*/68MM_ConfigurationIncrementalGenerational(MM_EnvironmentBase *env)69#if defined(J9VM_GC_COMBINATION_SPEC)70: MM_Configuration(env, gc_policy_balanced, mm_regionAlignment, calculateDefaultRegionSize(env), 0, gc_modron_wrtbar_cardmark_incremental, gc_modron_allocation_type_tlh)71#else72: MM_Configuration(env, gc_policy_balanced, mm_regionAlignment, calculateDefaultRegionSize(env), 0, gc_modron_wrtbar_cardmark, gc_modron_allocation_type_tlh)73#endif /* J9VM_GC_COMBINATION_SPEC */74{75_typeId = __FUNCTION__;76}7778virtual void defaultMemorySpaceAllocated(MM_GCExtensionsBase *extensions, void* defaultMemorySpace);7980protected:81virtual MM_EnvironmentBase *allocateNewEnvironment(MM_GCExtensionsBase *extensions, OMR_VMThread *omrVMThread);82virtual bool initializeEnvironment(MM_EnvironmentBase *env);83virtual bool initialize(MM_EnvironmentBase *env);84virtual void tearDown(MM_EnvironmentBase *env);8586/**87* Once the region size is calculated each configuration needs to verify that88* it is valid.89*90* @param env[in] - the current environment91* @param regionSize[in] - the current regionSize to verify92* @return valid - is the regionSize valid93*/94virtual bool verifyRegionSize(MM_EnvironmentBase *env, UDATA regionSize);9596/**97* Initializes the NUMAManager.98*99* lpnguyen TODO: move this out of configuration as we should not have to "configure" NUMA. The only reason this is here is100* because ConfigurationIncrementalGenerational.hpp will disable physical NUMA if it would create too many ACs and ideal AC calculation101* requires configuration to be done (regionSize set up).102*103* @param env[in] - the current environment104*/105virtual bool initializeNUMAManager(MM_EnvironmentBase *env);106107private:108static UDATA109calculateDefaultRegionSize(MM_EnvironmentBase *env)110{111UDATA regionSize = 0;112113MM_GCExtensionsBase *extensions = env->getExtensions();114UDATA regionCount = extensions->memoryMax / _tarokMinimumRegionSizeInBytes;115/* try to select region size such that the resulting region count is in the range of [1024, 2048] */116if (regionCount < 1024 || regionCount > 2048) {117regionSize = OMR_MAX(extensions->memoryMax / 1024, _tarokMinimumRegionSizeInBytes);118} else {119regionSize = _tarokMinimumRegionSizeInBytes;120}121122return regionSize;123}124};125126#endif /* CONFIGURATIONTAROK_HPP_ */127128129