Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_glue_java/ConcurrentSafepointCallbackJava.hpp
5985 views
1
/*******************************************************************************
2
* Copyright (c) 2015, 2017 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
#if !defined(CONCURRENTSAFEPOINTCALLBACKJAVA_HPP_)
24
#define CONCURRENTSAFEPOINTCALLBACKJAVA_HPP_
25
26
#include "j9cfg.h"
27
28
#if defined (OMR_GC_MODRON_CONCURRENT_MARK)
29
30
#include "j9.h"
31
#include "vmhook.h"
32
#include "j9comp.h"
33
#include "ConcurrentSafepointCallback.hpp"
34
#include "EnvironmentStandard.hpp"
35
36
/**
37
* @todo Provide typedef documentation
38
* @ingroup GC_Modron_Standard
39
*/
40
41
class MM_ConcurrentSafepointCallbackJava : public MM_ConcurrentSafepointCallback
42
{
43
private:
44
intptr_t _asyncEventKey;
45
#if defined(AIXPPC) || defined(LINUXPPC)
46
bool _cancelAfterGC;
47
#endif /* defined(AIXPPC) || defined(LINUXPPC) */
48
protected:
49
public:
50
51
private:
52
bool initialize(MM_EnvironmentBase *env);
53
static void vmInitialized(J9HookInterface** hook, uintptr_t eventNum, void* eventData, void* userData);
54
static void vmTerminating(J9HookInterface** hook, uintptr_t eventNum, void* eventData, void* userData);
55
static void reportGlobalGCComplete(J9HookInterface** hook, uintptr_t eventNum, void* eventData, void* userData);
56
static void registerAsyncEventHandler(MM_EnvironmentBase *env, MM_ConcurrentSafepointCallbackJava *callback);
57
static void asyncEventHandler(J9VMThread *vmThread, intptr_t handlerKey, void *userData);
58
59
void globalGCComplete(MM_EnvironmentBase *env);
60
61
protected:
62
public:
63
#if defined(AIXPPC) || defined(LINUXPPC)
64
virtual void registerCallback(MM_EnvironmentBase *env, SafepointCallbackHandler handler, void *userData, bool cancelAfterGC = false);
65
#else
66
virtual void registerCallback(MM_EnvironmentBase *env, SafepointCallbackHandler handler, void *userData);
67
#endif /* defined(AIXPPC) || defined(LINUXPPC) */
68
69
virtual void cancelCallback(MM_EnvironmentBase *env);
70
71
virtual void requestCallback(MM_EnvironmentBase *env);
72
73
static MM_ConcurrentSafepointCallbackJava *newInstance(MM_EnvironmentBase *env);
74
virtual void kill(MM_EnvironmentBase *env);
75
76
/**
77
* Create a MM_ConcurrentSafepointCallbackJava object
78
*/
79
MM_ConcurrentSafepointCallbackJava(MM_EnvironmentBase *env)
80
: MM_ConcurrentSafepointCallback(env)
81
,_asyncEventKey(-1)
82
#if defined(AIXPPC) || defined(LINUXPPC)
83
,_cancelAfterGC(false)
84
#endif /* defined(AIXPPC) || defined(LINUXPPC) */
85
{
86
_typeId = __FUNCTION__;
87
}
88
};
89
90
#endif /* defined (OMR_GC_MODRON_CONCURRENT_MARK)*/
91
92
#endif /* CONCURRENTSAFEPOINTCALLBACKJAVA_HPP_ */
93
94