Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/aarch64/codegen/J9ARM64Snippet.hpp
6004 views
1
/*******************************************************************************
2
* Copyright (c) 2019, 2020 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 J9ARM64SNIPPET_INCL
24
#define J9ARM64SNIPPET_INCL
25
26
#include "codegen/Snippet.hpp"
27
#include "codegen/ARM64HelperCallSnippet.hpp"
28
#include "j9cfg.h"
29
30
#define LOCK_INC_DEC_VALUE OBJECT_HEADER_LOCK_FIRST_RECURSION_BIT
31
32
namespace TR {
33
34
class ARM64MonitorEnterSnippet : public TR::ARM64HelperCallSnippet
35
{
36
TR::LabelSymbol *_incLabel;
37
38
public:
39
40
/**
41
* @brief Constructor
42
*/
43
ARM64MonitorEnterSnippet(TR::CodeGenerator *codeGen,
44
TR::Node *monitorNode,
45
TR::LabelSymbol *incLabel,
46
TR::LabelSymbol *callLabel,
47
TR::LabelSymbol *restartLabel);
48
49
/**
50
* @brief Answers the Snippet kind
51
* @return Snippet kind
52
*/
53
virtual Kind getKind() { return IsMonitorEnter; }
54
55
/**
56
* @brief Emits the Snippet body
57
* @return instruction cursor
58
*/
59
virtual uint8_t *emitSnippetBody();
60
61
/**
62
* @brief Prints the Snippet
63
*/
64
virtual void print(TR::FILE *, TR_Debug *);
65
66
/**
67
* @brief Answers the Snippet length
68
* @return Snippet length
69
*/
70
virtual uint32_t getLength(int32_t estimatedSnippetStart);
71
72
/**
73
* @brief Sets estimated binary location
74
* @return estimated binary location
75
*/
76
virtual int32_t setEstimatedCodeLocation(int32_t p);
77
78
/**
79
* @brief Answers the incLabel
80
* @return incLabel
81
*/
82
TR::LabelSymbol *getIncLabel() { return _incLabel; };
83
};
84
85
class ARM64MonitorExitSnippet : public TR::ARM64HelperCallSnippet
86
{
87
TR::LabelSymbol *_decLabel;
88
89
public:
90
91
/**
92
* @brief Constructor
93
*/
94
ARM64MonitorExitSnippet(TR::CodeGenerator *codeGen,
95
TR::Node *monitorNode,
96
TR::LabelSymbol *decLabel,
97
TR::LabelSymbol *callLabel,
98
TR::LabelSymbol *restartLabel);
99
100
/**
101
* @brief Answers the Snippet kind
102
* @return Snippet kind
103
*/
104
virtual Kind getKind() { return IsMonitorExit; }
105
106
/**
107
* @brief Emits the Snippet body
108
* @return instruction cursor
109
*/
110
virtual uint8_t *emitSnippetBody();
111
112
/**
113
* @brief Prints the Snippet
114
*/
115
virtual void print(TR::FILE *, TR_Debug *);
116
117
/**
118
* @brief Answers the Snippet length
119
* @return Snippet length
120
*/
121
virtual uint32_t getLength(int32_t estimatedSnippetStart);
122
123
/**
124
* @brief Sets estimated binary location
125
* @return estimated binary location
126
*/
127
virtual int32_t setEstimatedCodeLocation(int32_t p);
128
129
/**
130
* @brief Answers the decLabel
131
* @return decLabel
132
*/
133
TR::LabelSymbol *getDecLabel() { return _decLabel; }
134
};
135
}
136
137
#endif
138
139