Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/codert_vm/runtimeInstrumentation.h
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
#ifndef runtimeinstrumentation_h
24
#define runtimeinstrumentation_h
25
26
#include "j9.h"
27
#include "j9consts.h"
28
29
/**
30
* Initialize VM support for JIT runtime instrumentation. The JIT must call this
31
* function during startup (before calling updateJITRuntimeInstrumentationFlags).
32
*
33
* @param[in] vm The J9JavaVM pointer
34
*
35
* @return 0 on success
36
*/
37
UDATA
38
initializeJITRuntimeInstrumentation(J9JavaVM *vm);
39
40
/**
41
* Terminate VM support for JIT runtime instrumentation. The JIT must call this
42
* function during shutdown.
43
*
44
* @param[in] vm The J9JavaVM pointer
45
*/
46
void
47
shutdownJITRuntimeInstrumentation(J9JavaVM *vm);
48
49
/**
50
* Request an update to the JIT runtime instrumentation flags on the given J9VMThread.
51
* The update will take place asynchronously, at the next async check in the target thread.
52
* This call assumes that a valid control block has been installed by the JIT before any
53
* of the flag bits are enabled.
54
*
55
* This function will return an error if J9_PRIVATE_FLAGS_RI_INITIALIZED
56
* is not set in the privateFlags of the target thread. This will be set if the call to the port library
57
* function j9ri_authorize_current_thread() succeeded when the thread was created.
58
*
59
* The following constants represent valid bits in newFlags:
60
*
61
* J9_JIT_TOGGLE_RI_ON_TRANSITION
62
* This flag is used to control whether or not the VM calls j9ri_disable
63
* when transitioning from compiled code to the interpreter, and j9ri_enable
64
* when transitioning from the interpreter to compiled code.
65
*
66
* J9_JIT_TOGGLE_RI_IN_COMPILED_CODE
67
* This flag is used by the compiled code to guard inline sequences to enable and
68
* disable runtime instrumentation.
69
*
70
* @param[in] targetThread The J9VMThread to update
71
* @param[in] newFlags The new value of the RI flags field
72
*
73
* @return 0 on success (thread is authorized)
74
*/
75
UDATA
76
updateJITRuntimeInstrumentationFlags(J9VMThread *targetThread, UDATA newFlags);
77
78
#endif
79
80