Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_vlhgc/ConfigurationIncrementalGenerational.hpp
5986 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2021 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* 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-exception
21
*******************************************************************************/
22
23
/**
24
* @file
25
* @ingroup GC_Modron_Standard
26
*/
27
28
#if !defined(CONFIGURATIONTAROK_HPP_)
29
#define CONFIGURATIONTAROK_HPP_
30
31
#include "j9.h"
32
#include "j9cfg.h"
33
34
#include "Configuration.hpp"
35
36
class MM_GlobalCollector;
37
class MM_Heap;
38
class MM_HeapRegionManager;
39
class MM_MemoryPool;
40
class MM_MemorySubSpaceTarok;
41
42
43
class MM_ConfigurationIncrementalGenerational : public MM_Configuration
44
{
45
/* Data members / Types */
46
public:
47
protected:
48
private:
49
static const uintptr_t _tarokMinimumRegionSizeInBytes = (512 * 1024);
50
51
/* Methods */
52
public:
53
static MM_Configuration *newInstance(MM_EnvironmentBase *env);
54
55
virtual MM_GlobalCollector *createGlobalCollector(MM_EnvironmentBase *env);
56
virtual MM_Heap *createHeapWithManager(MM_EnvironmentBase *env, UDATA heapBytesRequested, MM_HeapRegionManager *regionManager);
57
virtual MM_HeapRegionManager *createHeapRegionManager(MM_EnvironmentBase *env);
58
virtual J9Pool *createEnvironmentPool(MM_EnvironmentBase *env);
59
virtual MM_MemorySpace *createDefaultMemorySpace(MM_EnvironmentBase *env, MM_Heap *heap, MM_InitializationParameters *parameters);
60
virtual void cleanUpClassLoader(MM_EnvironmentBase *env, J9ClassLoader* classLoader);
61
virtual void prepareParameters(OMR_VM *omrVM, UDATA minimumSpaceSize, UDATA minimumNewSpaceSize, UDATA initialNewSpaceSize,
62
UDATA maximumNewSpaceSize, UDATA minimumTenureSpaceSize, UDATA initialTenureSpaceSize, UDATA maximumTenureSpaceSize,
63
UDATA memoryMax, UDATA tenureFlags, MM_InitializationParameters *parameters);
64
65
/**
66
* Constructor sets default arraylet leaf size to 0. This will be updated to match effective region size
67
* after the effective region size has been established in MM_GCExtensionsBase::regionSize.
68
*/
69
MM_ConfigurationIncrementalGenerational(MM_EnvironmentBase *env)
70
#if defined(J9VM_GC_COMBINATION_SPEC)
71
: MM_Configuration(env, gc_policy_balanced, mm_regionAlignment, calculateDefaultRegionSize(env), 0, gc_modron_wrtbar_cardmark_incremental, gc_modron_allocation_type_tlh)
72
#else
73
: MM_Configuration(env, gc_policy_balanced, mm_regionAlignment, calculateDefaultRegionSize(env), 0, gc_modron_wrtbar_cardmark, gc_modron_allocation_type_tlh)
74
#endif /* J9VM_GC_COMBINATION_SPEC */
75
{
76
_typeId = __FUNCTION__;
77
}
78
79
virtual void defaultMemorySpaceAllocated(MM_GCExtensionsBase *extensions, void* defaultMemorySpace);
80
81
protected:
82
virtual MM_EnvironmentBase *allocateNewEnvironment(MM_GCExtensionsBase *extensions, OMR_VMThread *omrVMThread);
83
virtual bool initializeEnvironment(MM_EnvironmentBase *env);
84
virtual bool initialize(MM_EnvironmentBase *env);
85
virtual void tearDown(MM_EnvironmentBase *env);
86
87
/**
88
* Once the region size is calculated each configuration needs to verify that
89
* it is valid.
90
*
91
* @param env[in] - the current environment
92
* @param regionSize[in] - the current regionSize to verify
93
* @return valid - is the regionSize valid
94
*/
95
virtual bool verifyRegionSize(MM_EnvironmentBase *env, UDATA regionSize);
96
97
/**
98
* Initializes the NUMAManager.
99
*
100
* lpnguyen TODO: move this out of configuration as we should not have to "configure" NUMA. The only reason this is here is
101
* because ConfigurationIncrementalGenerational.hpp will disable physical NUMA if it would create too many ACs and ideal AC calculation
102
* requires configuration to be done (regionSize set up).
103
*
104
* @param env[in] - the current environment
105
*/
106
virtual bool initializeNUMAManager(MM_EnvironmentBase *env);
107
108
private:
109
static UDATA
110
calculateDefaultRegionSize(MM_EnvironmentBase *env)
111
{
112
UDATA regionSize = 0;
113
114
MM_GCExtensionsBase *extensions = env->getExtensions();
115
UDATA regionCount = extensions->memoryMax / _tarokMinimumRegionSizeInBytes;
116
/* try to select region size such that the resulting region count is in the range of [1024, 2048] */
117
if (regionCount < 1024 || regionCount > 2048) {
118
regionSize = OMR_MAX(extensions->memoryMax / 1024, _tarokMinimumRegionSizeInBytes);
119
} else {
120
regionSize = _tarokMinimumRegionSizeInBytes;
121
}
122
123
return regionSize;
124
}
125
};
126
127
#endif /* CONFIGURATIONTAROK_HPP_ */
128
129