Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_realtime/RealtimeRootScanner.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_Metronome
26
*/
27
28
#if !defined(REALTIMEROOTSCANNER_HPP_)
29
#define REALTIMEROOTSCANNER_HPP_
30
31
#include "j9.h"
32
#include "j9cfg.h"
33
#include "modronopt.h"
34
35
#include "EnvironmentRealtime.hpp"
36
#include "GlobalCollector.hpp"
37
#include "GCExtensions.hpp"
38
#include "Scheduler.hpp"
39
#include "MemorySubSpace.hpp"
40
#include "MemorySubSpaceMetronome.hpp"
41
#include "MemoryPoolSegregated.hpp"
42
#include "ObjectAllocationInterface.hpp"
43
#include "RootScanner.hpp"
44
#include "RealtimeGC.hpp"
45
#include "RealtimeMarkingScheme.hpp"
46
#include "StackSlotValidator.hpp"
47
48
class MM_ParallelDispatcher;
49
class MM_MemorySubSpace;
50
class MM_MemorySubSpaceMetronome;
51
52
class MM_RealtimeRootScanner : public MM_RootScanner
53
{
54
/*
55
* Data members
56
*/
57
private:
58
protected:
59
MM_RealtimeGC *_realtimeGC;
60
MM_RealtimeMarkingScheme *_markingScheme;
61
MM_EnvironmentRealtime *_env;
62
63
public:
64
UDATA _threadCount;
65
I_32 _yieldCount;
66
67
/*
68
* Function members
69
*/
70
private:
71
protected:
72
public:
73
virtual void doClass(J9Class* clazz);
74
75
#if defined(J9VM_GC_REALTIME)
76
void doStringTableSlot(J9Object **slotPtr, GC_StringTableIterator *stringTableIterator);
77
virtual void doStringCacheTableSlot(J9Object **slotPtr);
78
#endif /* J9VM_GC_REALTIME */
79
80
virtual void scanThreads(MM_EnvironmentBase *env);
81
virtual bool scanOneThread(MM_EnvironmentBase *env, J9VMThread* walkThread, void* localData);
82
virtual void scanOneThreadImpl(MM_EnvironmentRealtime *env, J9VMThread* walkThread, void* localData);
83
void reportThreadCount(MM_EnvironmentBase *env);
84
void scanAtomicRoots(MM_EnvironmentRealtime *env);
85
86
/* The yield family of methods override the RootScanner to do actual yielding.
87
* Their implementations basically use the scheduler API */
88
virtual bool shouldYieldFromClassScan(UDATA timeSlackNanoSec = 0);
89
virtual bool shouldYieldFromStringScan();
90
virtual bool shouldYieldFromMonitorScan();
91
virtual bool shouldYield();
92
virtual void yield();
93
virtual bool condYield(U_64 timeSlackNanoSec = 0);
94
95
CompletePhaseCode scanClassesComplete(MM_EnvironmentBase *env);
96
97
virtual const char* scannerName() = 0;
98
99
virtual void doClassSlot(J9Class *classPtr);
100
101
virtual void scanMonitorLookupCaches(MM_EnvironmentBase *env);
102
103
virtual void scanStringTable(MM_EnvironmentBase *env);
104
105
MM_RealtimeRootScanner(MM_EnvironmentRealtime *env, MM_RealtimeGC *realtimeGC)
106
: MM_RootScanner(env)
107
, _realtimeGC(realtimeGC)
108
, _markingScheme(realtimeGC->getMarkingScheme())
109
, _env(env)
110
, _threadCount(0)
111
, _yieldCount(0)
112
{
113
_typeId = __FUNCTION__;
114
#if defined(J9VM_GC_REALTIME)
115
/* String table should be clearable, not a hard root */
116
setStringTableAsRoot(false);
117
#endif /* defined(J9VM_GC_REALTIME) */
118
}
119
};
120
121
#endif /* REALTIMEROOTSCANNER_HPP_ */
122
123
124