Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/il/J9StaticSymbol.hpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2019 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_STATICSYMBOL_INCL
24
#define J9_STATICSYMBOL_INCL
25
26
/*
27
* The following #define and typedef must appear before any #includes in this file
28
*/
29
#ifndef J9_STATICSYMBOL_CONNECTOR
30
#define J9_STATICSYMBOL_CONNECTOR
31
namespace J9 { class StaticSymbol; }
32
namespace J9 { typedef J9::StaticSymbol StaticSymbolConnector; }
33
#endif
34
35
#include <stdint.h>
36
#include "il/DataTypes.hpp"
37
#include "il/OMRStaticSymbol.hpp"
38
#include "il/Symbol.hpp"
39
40
namespace TR { class StaticSymbol; }
41
42
namespace J9
43
{
44
45
/**
46
* A symbol with an address
47
*/
48
class OMR_EXTENSIBLE StaticSymbol : public OMR::StaticSymbolConnector
49
{
50
51
protected:
52
53
StaticSymbol(TR::DataType d) :
54
OMR::StaticSymbolConnector(d) { }
55
56
StaticSymbol(TR::DataType d, void * address) :
57
OMR::StaticSymbolConnector(d, address) { }
58
59
StaticSymbol(TR::DataType d, uint32_t s) :
60
OMR::StaticSymbolConnector(d, s) { }
61
62
/* ------- TR_CallSiteTableEntrySymbol --------- */
63
public:
64
65
void makeCallSiteTableEntry(int32_t callSiteIndex);
66
int32_t getCallSiteIndex();
67
68
private:
69
70
int32_t _callSiteIndex;
71
72
/* ------- TR_ConstantDynamicSymbol --------- */
73
public:
74
75
/** \brief
76
* Populate the class signature fields and primitive flag of this constant dynamic symbol.
77
*
78
* \param classSignature
79
* The class signature string of the constant dynamic. For primitive this is the signature of the corresponding autobox class.
80
*
81
* \param classSignatureLength
82
* The length of the class signature string of the constant dynamic.
83
*
84
* \param isPrimitive
85
* Determines whether the constant dynamic is primitive type.
86
*
87
* \return
88
* Fields of this static symbol are populated.
89
*/
90
void makeConstantDynamic(char * classSignature, int32_t classSignatureLength, bool isPrimitive);
91
92
/** \brief
93
* Retrieves the class signature string for this constant dynamic static symbol.
94
*
95
* \param classSignatureLength
96
* The length of the class signature string of the constant dynamic. Modified in place.
97
*
98
* \return
99
* The class signature string for this constant dynamic static symbol.
100
*/
101
char * getConstantDynamicClassSignature(int32_t & classSignatureLength);
102
103
/** \brief
104
* Retrieves whether the underlying constant dynamic is of primitive type.
105
*
106
* \return
107
* <c>true</c> if the underlying constant dynamic is primitive; <c>false</c> otherwise.
108
*/
109
bool isConstantDynamicPrimitive();
110
111
private:
112
113
char * _classSignature;
114
int32_t _classSignatureLength;
115
bool _isPrimitive;
116
117
/* ------ TR_RecognizedStaticSymbol ---------- */
118
public:
119
120
template <typename AllocatorType>
121
static TR::StaticSymbol * createRecognized(AllocatorType m, TR::DataType d, TR::Symbol::RecognizedField f);
122
123
/**
124
* If this symbol has a valid recognized field, return it. Otherwise, return
125
* TR::Symbol::UnknownField
126
*/
127
TR::Symbol::RecognizedField getRecognizedField();
128
129
private:
130
131
void makeRecognized(TR::Symbol::RecognizedField f)
132
{
133
_recognizedField = f;
134
_flags.set(RecognizedStatic);
135
}
136
137
TR::Symbol::RecognizedField _recognizedField;
138
139
/* ------- TR_MethodTypeTableEntrySymbol ------ */
140
public:
141
template <typename AllocatorType>
142
static TR::StaticSymbol * createMethodTypeTableEntry(AllocatorType m, int32_t methodTypeIndex);
143
144
int32_t getMethodTypeIndex();
145
146
private:
147
void makeMethodTypeTableEntry(int32_t methodTypeIndex);
148
149
150
int32_t _methodTypeIndex;
151
152
};
153
154
}
155
156
#endif
157
158
159