Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/env/J9VMEnv.hpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 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 J9_VMENV_INCL
24
#define J9_VMENV_INCL
25
26
/*
27
* The following #define and typedef must appear before any #includes in this file
28
*/
29
#ifndef J9_VMENV_CONNECTOR
30
#define J9_VMENV_CONNECTOR
31
namespace J9 { class VMEnv; }
32
namespace J9 { typedef J9::VMEnv VMEnvConnector; }
33
#endif
34
35
#include "env/OMRVMEnv.hpp"
36
#include "env/jittypes.h"
37
#include "infra/Annotations.hpp"
38
#include "j9.h"
39
40
struct OMR_VMThread;
41
class TR_J9VMBase;
42
class TR_FrontEnd;
43
namespace TR { class Compilation; }
44
45
namespace J9
46
{
47
48
class OMR_EXTENSIBLE VMEnv : public OMR::VMEnvConnector
49
{
50
public:
51
52
int64_t maxHeapSizeInBytes();
53
54
uintptr_t thisThreadGetPendingExceptionOffset();
55
56
bool hasResumableTrapHandler(TR::Compilation *comp);
57
bool hasResumableTrapHandler(OMR_VMThread *omrVMThread);
58
59
using OMR::VMEnvConnector::getUSecClock;
60
uint64_t getUSecClock(TR::Compilation *comp);
61
uint64_t getUSecClock(OMR_VMThread *omrVMThread);
62
63
uint64_t getHighResClock(TR::Compilation *comp);
64
uint64_t getHighResClock(OMR_VMThread *omrVMThread);
65
66
uint64_t getHighResClockResolution(TR::Compilation *comp);
67
uint64_t getHighResClockResolution(OMR_VMThread *omrVMThread);
68
static uint64_t getHighResClockResolution(TR_FrontEnd *fej9);
69
uint64_t getHighResClockResolution();
70
71
bool hasAccess(OMR_VMThread *omrVMThread);
72
bool hasAccess(J9VMThread *j9VMThread);
73
bool hasAccess(TR::Compilation *comp);
74
75
bool acquireVMAccessIfNeeded(OMR_VMThread *omrVMThread);
76
bool acquireVMAccessIfNeeded(TR_J9VMBase *fej9);
77
bool acquireVMAccessIfNeeded(TR::Compilation *comp);
78
79
bool tryToAcquireAccess(TR::Compilation *, bool *);
80
bool tryToAcquireAccess(OMR_VMThread *, bool *);
81
82
void releaseVMAccessIfNeeded(TR::Compilation *comp, bool haveAcquiredVMAccess);
83
void releaseVMAccessIfNeeded(OMR_VMThread *, bool haveAcquiredVMAccess);
84
void releaseVMAccessIfNeeded(TR_J9VMBase *, bool haveAcquiredVMAccess);
85
86
void releaseAccess(TR::Compilation *comp);
87
void releaseAccess(OMR_VMThread *omrVMThread);
88
void releaseAccess(TR_J9VMBase *fej9);
89
90
J9VMThread *J9VMThreadFromOMRVMThread(OMR_VMThread *omrVMThread)
91
{
92
return (J9VMThread *)omrVMThread->_language_vmthread;
93
}
94
95
bool canMethodEnterEventBeHooked(TR::Compilation *comp);
96
bool canMethodExitEventBeHooked(TR::Compilation *comp);
97
bool isSelectiveMethodEnterExitEnabled(TR::Compilation *comp);
98
99
uintptr_t getOverflowSafeAllocSize(TR::Compilation *comp);
100
101
int64_t cpuTimeSpentInCompilationThread(TR::Compilation *comp);
102
103
// On-stack replacement
104
//
105
uintptr_t OSRFrameHeaderSizeInBytes(TR::Compilation *comp);
106
uintptr_t OSRFrameSizeInBytes(TR::Compilation *comp, TR_OpaqueMethodBlock* method);
107
bool ensureOSRBufferSize(TR::Compilation *comp, uintptr_t osrFrameSizeInBytes, uintptr_t osrScratchBufferSizeInBytes, uintptr_t osrStackFrameSizeInBytes);
108
uintptr_t thisThreadGetOSRReturnAddressOffset(TR::Compilation *comp);
109
110
uintptr_t thisThreadGetGSIntermediateResultOffset(TR::Compilation *comp);
111
uintptr_t thisThreadGetConcurrentScavengeActiveByteAddressOffset(TR::Compilation *comp);
112
uintptr_t thisThreadGetEvacuateBaseAddressOffset(TR::Compilation *comp);
113
uintptr_t thisThreadGetEvacuateTopAddressOffset(TR::Compilation *comp);
114
uintptr_t thisThreadGetGSOperandAddressOffset(TR::Compilation *comp);
115
uintptr_t thisThreadGetGSHandlerAddressOffset(TR::Compilation *comp);
116
size_t getInterpreterVTableOffset();
117
118
bool isVMInStartupPhase(J9JITConfig *jitConfig);
119
};
120
121
}
122
123
#endif
124
125