Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_vlhgc/CopyForwardDelegate.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_Tarok
26
*/
27
28
#if !defined(COPYFORWARDDELEGATE_HPP_)
29
#define COPYFORWARDDELEGATE_HPP_
30
31
#include "j9.h"
32
#include "j9cfg.h"
33
34
#include "CopyForwardScheme.hpp"
35
36
class MM_EnvironmentVLHGC;
37
class MM_GCExtensions;
38
class MM_HeapRegionManager;
39
40
class MM_CopyForwardDelegate : public MM_BaseNonVirtual
41
{
42
/* Data Members */
43
private:
44
J9JavaVM *_javaVM; /**< Cached JVM reference */
45
MM_GCExtensions *_extensions; /**< Cached GC global variable container */
46
MM_CopyForwardScheme *_breadthFirstCopyForwardScheme; /**< Underlying mechanics for breadth-first copyForward garbage collection */
47
48
protected:
49
public:
50
51
/* Member Functions */
52
private:
53
/**
54
* Updates the contents of _extensions->compactGroupPersistentStats before a PGC copy-forward operation.
55
* @param env[in] The main GC thread
56
*/
57
void updatePersistentStatsBeforeCopyForward(MM_EnvironmentVLHGC *env);
58
59
/**
60
* Updates the contents of _extensions->compactGroupPersistentStats before a PGC copy-forward operation.
61
* @param env[in] The main GC thread
62
*/
63
void updatePersistentStatsAfterCopyForward(MM_EnvironmentVLHGC *env);
64
65
protected:
66
public:
67
MM_CopyForwardDelegate(MM_EnvironmentVLHGC *env);
68
69
/**
70
* Initialize the receivers internal support structures and state.
71
* @param env[in] Main thread.
72
*/
73
bool initialize(MM_EnvironmentVLHGC *env);
74
75
/**
76
* Clean up the receivers internal support structures and state.
77
* @param env[in] Main thread.
78
*/
79
void tearDown(MM_EnvironmentVLHGC *env);
80
81
/**
82
* Runs a PGC collect using the copy forward mechanism. This call does report events, before and after the collection, but does not collect statistics.
83
* @param env[in] The main GC thread
84
*/
85
void performCopyForwardForPartialGC(MM_EnvironmentVLHGC *env);
86
87
/**
88
* Infrastructure and state setup pre-copyForward.
89
* @param env[in] Main GC thread.
90
*/
91
void preCopyForwardSetup(MM_EnvironmentVLHGC *env);
92
93
/**
94
* Infrastructure and state cleanup post-copyForward.
95
* @param env[in] Main GC thread.
96
*/
97
void postCopyForwardCleanup(MM_EnvironmentVLHGC *env);
98
99
/**
100
* Estimate the number of bytes required for survivor space given the set of _shouldMark regions and their historical survival rates.
101
* @param env[in] the current thread
102
* @return the estimated number of bytes which will survive
103
*/
104
UDATA estimateRequiredSurvivorBytes(MM_EnvironmentVLHGC *env);
105
106
/**
107
* Return true if the copyForward is running under Hybrid mode
108
*/
109
bool isHybrid(MM_EnvironmentVLHGC *env)
110
{
111
bool ret = false;
112
if (NULL != _breadthFirstCopyForwardScheme) {
113
ret = _breadthFirstCopyForwardScheme->isHybrid(env);
114
}
115
return ret;
116
}
117
118
/**
119
* Set the number of regions, which are need to be reserved for Mark/Compact only in CollectionSet due to short of survivor regions for CopyForward
120
*/
121
void setReservedNonEvacuatedRegions(UDATA regionCount)
122
{
123
if (NULL != _breadthFirstCopyForwardScheme) {
124
_breadthFirstCopyForwardScheme->setReservedNonEvacuatedRegions(regionCount);
125
}
126
}
127
128
MMINLINE bool isConcurrentCycleInProgress()
129
{
130
return _breadthFirstCopyForwardScheme->isConcurrentCycleInProgress();
131
}
132
};
133
134
135
#endif /* COPYFORWARDDELEGATE_HPP_ */
136
137