Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_check/Check.hpp
5990 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2014 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_Check
26
*/
27
28
#if !defined(CHECK_HPP_)
29
#define CHECK_HPP_
30
31
#include "j9.h"
32
#include "j9cfg.h"
33
34
#include "Base.hpp"
35
#include "GCExtensions.hpp"
36
37
class GC_CheckEngine;
38
39
/**
40
* GC_Check - abstract class for defining types of check
41
*
42
* An abstract class for defining a type of check gc_check
43
* can perform. Actual checks should derive from this then
44
* be attached to a "check cycle" that manages all the checks
45
* to be performed during one invocation of gc_check
46
*/
47
class GC_Check : public MM_Base
48
{
49
/*
50
* Data members
51
*/
52
private:
53
protected:
54
J9JavaVM *_javaVM;
55
GC_CheckEngine *_engine;
56
MM_GCExtensions *_extensions;
57
J9PortLibrary *_portLibrary; /**< we use a separate portlibrary (not the one from the javaVM) because this code
58
also runs out-of-process, where javaVM is the crashed VM (that doesn't have
59
a valid portlibrary) */
60
61
GC_Check *_next; /**< pointer to the next check in the list (these objects are chained inside a GC_CheckCycle) */
62
UDATA _bitId; /**< identifier of particular Check class that is initialized by appropriate J9MODRON_GCCHK_SCAN_xxx bit */
63
64
public:
65
66
/*
67
* Function members
68
*/
69
private:
70
protected:
71
virtual void check() = 0; /**< run the check */
72
virtual void print() = 0; /**< dump the check structure to tty */
73
74
public:
75
virtual void kill() = 0;
76
77
void setNext(GC_Check *check) { _next = check; }
78
GC_Check *getNext(void) { return _next; }
79
void setBitId(UDATA bitId) { _bitId = bitId; }
80
UDATA getBitId() { return _bitId; }
81
82
void run(bool shouldCheck, bool shouldPrint); /**< run gc_check on the structure */
83
virtual const char *getCheckName() = 0; /**< get a string representing this check-type */
84
85
GC_Check(J9JavaVM *javaVM, GC_CheckEngine *engine)
86
: MM_Base()
87
, _javaVM(javaVM)
88
, _engine(engine)
89
, _extensions(MM_GCExtensions::getExtensions(javaVM))
90
, _portLibrary(javaVM->portLibrary)
91
, _next(NULL)
92
, _bitId(0)
93
{ }
94
};
95
96
#endif /* CHECK_HPP_ */
97
98