Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_check/CheckCycle.hpp
5985 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2014 IBM Corp. and others
4
*
5
* This program and the accompanying materials are made available under
6
* the terms of the Eclipse Public License 2.0 which accompanies this
7
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
* or the Apache License, Version 2.0 which accompanies this distribution and
9
* is available at https://www.apache.org/licenses/LICENSE-2.0.
10
*
11
* This Source Code may also be made available under the following
12
* Secondary Licenses when the conditions for such availability set
13
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
* General Public License, version 2 with the GNU Classpath
15
* Exception [1] and GNU General Public License, version 2 with the
16
* OpenJDK Assembly Exception [2].
17
*
18
* [1] https://www.gnu.org/software/classpath/license.html
19
* [2] http://openjdk.java.net/legal/assembly-exception.html
20
*
21
* 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
22
*******************************************************************************/
23
24
/**
25
* @file
26
* @ingroup GC_Check
27
*/
28
29
#if !defined(CHECKCYCLE_HPP_)
30
#define CHECKCYCLE_HPP_
31
32
#include "j9.h"
33
#include "j9cfg.h"
34
35
#include "Base.hpp"
36
#include "CheckBase.hpp"
37
38
class GC_Check;
39
class GC_CheckEngine;
40
41
class GC_CheckCycle : public MM_Base
42
{
43
/*
44
* Data members
45
*/
46
private:
47
typedef struct {
48
const char *name;
49
UDATA bitmask;
50
GC_Check *(*function)(J9JavaVM *javaVM, GC_CheckEngine *engine);
51
} funcStruct;
52
53
const static funcStruct funcArray[];
54
55
UDATA _checkFlags;
56
UDATA _miscFlags;
57
GCCheckInvokedBy _invokedBy; /**< What stage of GC invoked the check */
58
UDATA _manualCheckInvocation; /**< Allow user to identify which installed GCCheck triggered message */
59
UDATA _errorCount; /**< Number of errors encountered */
60
61
GC_Check *_checks; /**< Pointer to head of linked list of checks to run in this cycle */
62
63
J9JavaVM *_javaVM;
64
J9PortLibrary *_portLibrary;
65
GC_CheckEngine *_engine;
66
67
protected:
68
public:
69
70
/*
71
* Function members
72
*/
73
private:
74
void generateCheckList(UDATA scanFlags);
75
76
bool initialize(const char *args);
77
78
protected:
79
public:
80
81
static void printHelp(J9PortLibrary *portLib);
82
83
UDATA getCheckFlags() { return _checkFlags; };
84
UDATA getMiscFlags() { return _miscFlags; };
85
GCCheckInvokedBy getInvoker() { return _invokedBy; };
86
UDATA getManualCheckNumber() { return _manualCheckInvocation; };
87
88
UDATA nextErrorCount() { return ++_errorCount; };
89
90
/**
91
* Run the checks
92
* Iterates over the _checks linked list calling run() on each item in the list.
93
* @param invokedBy Identifier of the point in the GC the check has been called from
94
* @param filterFlags Tells which subset of the check list should be used (1bit meaning the checker will be used)
95
*/
96
void run(GCCheckInvokedBy invokedBy, UDATA filterFlags = J9MODRON_GCCHK_SCAN_ALL_SLOTS);
97
void fixDeadObjects(GCCheckInvokedBy invokedBy);
98
static GC_CheckCycle *newInstance(J9JavaVM *javaVM, GC_CheckEngine *, const char *args, UDATA manualCountInvocation = 0);
99
virtual void kill();
100
101
GC_CheckCycle(J9JavaVM *javaVM, GC_CheckEngine *engine, UDATA manualCountInvocation)
102
: MM_Base()
103
, _checkFlags(0)
104
, _miscFlags(0)
105
, _invokedBy(invocation_unknown)
106
, _manualCheckInvocation(manualCountInvocation)
107
, _errorCount(0)
108
, _checks(NULL)
109
, _javaVM(javaVM)
110
, _portLibrary(javaVM->portLibrary)
111
, _engine(engine)
112
{}
113
};
114
115
#endif /* CHECKCYCLE_HPP_ */
116
117