Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_vlhgc/EnvironmentVLHGC.cpp
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
#include "j9.h"
24
#include "j9cfg.h"
25
26
#include "EnvironmentVLHGC.hpp"
27
#include "GCExtensions.hpp"
28
#include "HeapRegionManager.hpp"
29
#include "InterRegionRememberedSet.hpp"
30
#include "RememberedSetCardBucket.hpp"
31
32
MM_EnvironmentVLHGC::MM_EnvironmentVLHGC(OMR_VMThread *omrVMThread)
33
: MM_EnvironmentBase(omrVMThread)
34
,_survivorCopyScanCache(NULL)
35
,_scanCache(NULL)
36
,_deferredScanCache(NULL)
37
, _copyForwardCompactGroups(NULL)
38
, _previousConcurrentYieldCheckBytesScanned(0)
39
, _rsclBufferControlBlockHead(NULL)
40
, _rsclBufferControlBlockTail(NULL)
41
, _rsclBufferControlBlockCount(0)
42
, _rememberedSetCardBucketPool(NULL)
43
, _lastOverflowedRsclWithReleasedBuffers(NULL)
44
{
45
_typeId = __FUNCTION__;
46
}
47
48
/**
49
* Create an Environment object.
50
*/
51
MM_EnvironmentVLHGC::MM_EnvironmentVLHGC(J9JavaVM *javaVM)
52
: MM_EnvironmentBase(javaVM->omrVM)
53
,_survivorCopyScanCache(NULL)
54
,_scanCache(NULL)
55
,_deferredScanCache(NULL)
56
, _copyForwardCompactGroups(NULL)
57
, _previousConcurrentYieldCheckBytesScanned(0)
58
, _rsclBufferControlBlockHead(NULL)
59
, _rsclBufferControlBlockTail(NULL)
60
, _rsclBufferControlBlockCount(0)
61
, _rememberedSetCardBucketPool(NULL)
62
, _lastOverflowedRsclWithReleasedBuffers(NULL)
63
{
64
_typeId = __FUNCTION__;
65
}
66
67
MM_EnvironmentVLHGC *
68
MM_EnvironmentVLHGC::newInstance(MM_GCExtensionsBase *extensions, OMR_VMThread *vmThread)
69
{
70
MM_EnvironmentVLHGC *env = NULL;
71
72
void* envPtr = (void *)pool_newElement(extensions->environments);
73
if(NULL != envPtr) {
74
env = new(envPtr) MM_EnvironmentVLHGC(vmThread);
75
if (!env->initialize(extensions)) {
76
env->kill();
77
env = NULL;
78
}
79
}
80
81
return env;
82
}
83
84
void
85
MM_EnvironmentVLHGC::kill()
86
{
87
MM_EnvironmentBase::kill();
88
}
89
90
bool
91
MM_EnvironmentVLHGC::initialize(MM_GCExtensionsBase *extensions )
92
{
93
/* initialize base class */
94
return MM_EnvironmentBase::initialize(extensions);
95
}
96
97
void
98
MM_EnvironmentVLHGC::initializeGCThread()
99
{
100
Assert_MM_true(NULL == _rememberedSetCardBucketPool);
101
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(this);
102
uintptr_t threadPoolSize = extensions->getHeap()->getHeapRegionManager()->getTableRegionCount();
103
/* Make this thread aware of its RSCL buckets for all regions */
104
_rememberedSetCardBucketPool = &extensions->rememberedSetCardBucketPool[getWorkerID() * threadPoolSize];
105
/* Associate buckets with appropriate RSCL (each RSCL maintains a list of its own buckets) */
106
extensions->interRegionRememberedSet->threadLocalInitialize(this);
107
}
108
109
void
110
MM_EnvironmentVLHGC::tearDown(MM_GCExtensionsBase *extensions)
111
{
112
/* tearDown base class */
113
MM_EnvironmentBase::tearDown(extensions);
114
}
115
116