Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/compile/J9SymbolReferenceTable.hpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2022 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_SYMBOLREFERENCETABLE_INCL
24
#define J9_SYMBOLREFERENCETABLE_INCL
25
26
/*
27
* The following #define and typedef must appear before any #includes in this file
28
*/
29
#ifndef J9_SYMBOLREFERENCETABLE_CONNECTOR
30
#define J9_SYMBOLREFERENCETABLE_CONNECTOR
31
namespace J9 { class SymbolReferenceTable; }
32
namespace J9 { typedef J9::SymbolReferenceTable SymbolReferenceTableConnector; }
33
#endif
34
35
#include "compile/OMRSymbolReferenceTable.hpp"
36
37
#include <stddef.h>
38
#include <stdint.h>
39
#include <map>
40
#include "env/jittypes.h"
41
42
class TR_BitVector;
43
class TR_PersistentClassInfo;
44
namespace TR { class Compilation; }
45
46
47
class TR_ImmutableInfo
48
{
49
public:
50
TR_ALLOC(TR_Memory::SymbolReferenceTable)
51
52
TR_ImmutableInfo(TR_OpaqueClassBlock *clazz, TR_BitVector *immutableSymRefs, TR_BitVector *immutableConstructorDefAliases)
53
: _clazz(clazz), _immutableSymRefNumbers(immutableSymRefs), _immutableConstructorDefAliases(immutableConstructorDefAliases)
54
{
55
}
56
57
TR_OpaqueClassBlock *_clazz;
58
TR_BitVector *_immutableSymRefNumbers;
59
TR_BitVector *_immutableConstructorDefAliases;
60
};
61
62
63
64
namespace J9
65
{
66
67
class SymbolReferenceTable : public OMR::SymbolReferenceTableConnector
68
{
69
public:
70
71
SymbolReferenceTable(size_t size, TR::Compilation *comp);
72
73
TR::SymbolReference * findOrCreateCountForRecompileSymbolRef();
74
TR::SymbolReference * findDiscontiguousArraySizeSymbolRef() { return element(discontiguousArraySizeSymbol); }
75
TR::SymbolReference * findOrCreateOSRBufferSymbolRef();
76
TR::SymbolReference * findOrCreateOSRScratchBufferSymbolRef();
77
TR::SymbolReference * findOrCreateOSRFrameIndexSymbolRef();
78
79
/** \brief
80
* Find or create VMThread tempSlot symbol reference. J9VMThread.tempSlot provides a mechanism for the
81
* compiler to provide information that the VM can use for various reasons - such as locating items on
82
* the stack during a call to internal native methods that are signature-polymorphic.
83
*
84
* \return
85
* TR::SymbolReference* the VMThreadTempSlotField symbol reference
86
*/
87
TR::SymbolReference * findOrCreateVMThreadTempSlotFieldSymbolRef();
88
89
/** \brief
90
* Find or create VMThread.floatTemp1 symbol reference. J9VMThread.floatTemp1 provides an additional
91
* mechanism for the compiler to provide information that the VM can use for various reasons
92
*
93
* \return
94
* TR::SymbolReference* the VMThread.floatTemp1 symbol reference
95
*/
96
TR::SymbolReference * findOrCreateVMThreadFloatTemp1SymbolRef();
97
98
/** \brief
99
* Find or create symref for vTableIndex field of struct J9JNIMethodID
100
*
101
* \param offset
102
* The offsetof value for vTableIndex field
103
*
104
* \return
105
* TR::SymbolReference* the symref representing vTableIndex field
106
*/
107
TR::SymbolReference * findOrCreateJ9JNIMethodIDvTableIndexFieldSymbol(intptr_t offset);
108
109
// CG linkage
110
TR::SymbolReference * findOrCreateAcquireVMAccessSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol); // minor rework
111
TR::SymbolReference * findOrCreateReleaseVMAccessSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol); // minor rework
112
TR::SymbolReference * findOrCreateStackOverflowSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol); // minor rework
113
TR::SymbolReference * findOrCreateThrowCurrentExceptionSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0); // minor rework
114
TR::SymbolReference * findOrCreateThrowUnreportedExceptionSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);
115
116
TR::SymbolReference * findOrCreateWriteBarrierStoreSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);
117
TR::SymbolReference * findOrCreateWriteBarrierStoreGenerationalSymbolRef(TR::ResolvedMethodSymbol *owningMethodSymbol = 0);
118
TR::SymbolReference * findOrCreateConstantPoolAddressSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
119
120
// FE
121
TR::SymbolReference * findOrCreateFloatSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
122
TR::SymbolReference * findOrCreateDoubleSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
123
TR::SymbolReference * createSystemRuntimeHelper(TR_RuntimeHelper, bool = false, bool = false, bool preservesAllRegisters = false);
124
TR::SymbolReference * findOrCreateStaticMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
125
TR::SymbolReference * findOrCreateSpecialMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
126
TR::SymbolReference * findOrCreateVirtualMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
127
TR::SymbolReference * findOrCreateInterfaceMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
128
TR::SymbolReference * findOrCreateDynamicMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t callSiteIndex, bool * unresolvedInCP = 0);
129
TR::SymbolReference * findOrCreateHandleMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, bool * unresolvedInCP = 0);
130
TR::SymbolReference * findOrCreateHandleMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, char *signature);
131
TR::SymbolReference * findOrCreateCallSiteTableEntrySymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t callSiteIndex);
132
TR::SymbolReference * findOrCreateMethodTypeTableEntrySymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
133
#if defined(J9VM_OPT_METHOD_HANDLE)
134
TR::SymbolReference * findOrCreateVarHandleMethodTypeTableEntrySymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
135
#endif /* defined(J9VM_OPT_METHOD_HANDLE) */
136
TR::SymbolReference * methodSymRefWithSignature(TR::SymbolReference *original, char *effectiveSignature, int32_t effectiveSignatureLength);
137
TR::SymbolReference * findOrCreateTypeCheckArrayStoreSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
138
TR::SymbolReference * findOrCreateArrayClassRomPtrSymbolRef();
139
TR::SymbolReference * findOrCreateJavaLangReferenceReferentShadowSymbol(TR::ResolvedMethodSymbol *, bool , TR::DataType, uint32_t, bool);
140
TR::SymbolReference * findOrCreateWriteBarrierStoreGenerationalAndConcurrentMarkSymbolRef(TR::ResolvedMethodSymbol *owningMethodSymbol = 0);
141
TR::SymbolReference * findOrCreateWriteBarrierStoreRealTimeGCSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);
142
TR::SymbolReference * findOrCreateWriteBarrierClassStoreRealTimeGCSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);
143
TR::SymbolReference * findOrCreateWriteBarrierBatchStoreSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);
144
145
TR::SymbolReference * findOrCreateAcmpeqHelperSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);
146
TR::SymbolReference * findOrCreateAcmpneHelperSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);
147
148
// these helpers are guaranteed to never throw if the receiving object is not null,
149
// so we explicit generate NULLCHKs and assume the helpers will never throw
150
TR::SymbolReference * findOrCreateGetFlattenableFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);
151
TR::SymbolReference * findOrCreateWithFlattenableFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);
152
TR::SymbolReference * findOrCreatePutFlattenableFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);
153
TR::SymbolReference * findOrCreateGetFlattenableStaticFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);
154
TR::SymbolReference * findOrCreatePutFlattenableStaticFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);
155
156
// these helpers may throw exception such as ArrayIndexOutOfBoundsException or ArrayStoreException etc.
157
TR::SymbolReference * findOrCreateLoadFlattenableArrayElementSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);
158
TR::SymbolReference * findOrCreateStoreFlattenableArrayElementSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);
159
160
// This helper walks the iTables to find the VFT offset for an interface
161
// method that is not known until runtime (and therefore does not have an
162
// IPIC data snippet). The parameters are the receiver class, interface
163
// class, and iTable index (though in the trees they must appear as
164
// children in the opposite order), and the return value is the VFT offset.
165
//
166
// The given receiver class must implement the given interface class.
167
//
168
TR::SymbolReference * findOrCreateLookupDynamicInterfaceMethodSymbolRef();
169
170
// This helper is a variant of jitLookupDynamicInterfaceMethod that requires
171
// the dispatched callee to be public, otherwise throwing IllegalAccessError.
172
TR::SymbolReference * findOrCreateLookupDynamicPublicInterfaceMethodSymbolRef();
173
174
TR::SymbolReference * findOrCreateShadowSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, bool isStore);
175
TR::SymbolReference * findOrFabricateShadowSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, TR::Symbol::RecognizedField recognizedField, TR::DataType type, uint32_t offset, bool isVolatile, bool isPrivate, bool isFinal, char* name = NULL);
176
177
/** \brief
178
* Returns a symbol reference for an entity not present in the constant pool.
179
*
180
* For resolved symrefs, if an appropriate one is found, it will be returned
181
* even if it originated from a call to findOrCreateShadowSymbol.
182
*
183
* \param containingClass
184
* The class that contains the field.
185
* \param type
186
* The data type of the field.
187
* \param offset
188
* The offset of the field.
189
* \param isVolatile
190
* Specifies whether the field is volatile.
191
* \param isPrivate
192
* Specifies whether the field is private.
193
* \param isFinal
194
* Specifies whether the field is final.
195
* \param name
196
* The name of the field.
197
* \param signature
198
* The signature of the field.
199
* \return
200
* Returns a symbol reference fabricated for the field.
201
*/
202
TR::SymbolReference * findOrFabricateShadowSymbol(TR_OpaqueClassBlock *containingClass, TR::DataType type, uint32_t offset, bool isVolatile, bool isPrivate, bool isFinal, const char *name, const char *signature);
203
204
/** \brief
205
* Returns an array shadow symbol reference fabricated for the field of a flattened array element.
206
*
207
* \param arrayComponentClass
208
* The array component class that contains the field.
209
* \param type
210
* The data type of the field.
211
* \param fieldOffset
212
* The offset of the field.
213
* \param isPrivate
214
* Specifies whether the field is private.
215
* \param fieldName
216
* The name of the field.
217
* \param fieldSignature
218
* The signature of the field.
219
* \return
220
* Returns an array shadow symbol reference fabricated for the field of a flattened array element.
221
*/
222
TR::SymbolReference * findOrFabricateFlattenedArrayElementFieldShadowSymbol(TR_OpaqueClassBlock *arrayComponentClass, TR::DataType type, uint32_t fieldOffset, bool isPrivate, const char *fieldName, const char *fieldSignature);
223
224
TR::SymbolReference * findOrCreateObjectNewInstanceImplSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol);
225
TR::SymbolReference * findOrCreateDLTBlockSymbolRef();
226
TR::SymbolReference * findDLTBlockSymbolRef();
227
TR::SymbolReference * findOrCreateMultiANewArraySymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
228
TR::SymbolReference * findOrCreateInstanceShapeSymbolRef();
229
TR::SymbolReference * findOrCreateInstanceDescriptionSymbolRef();
230
TR::SymbolReference * findOrCreateDescriptionWordFromPtrSymbolRef();
231
TR::SymbolReference * findOrCreateClassFlagsSymbolRef();
232
TR::SymbolReference * findOrCreateClassAndDepthFlagsSymbolRef();
233
TR::SymbolReference * findOrCreateArrayComponentTypeAsPrimitiveSymbolRef();
234
TR::SymbolReference * findOrCreateMethodTypeCheckSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
235
TR::SymbolReference * findOrCreateIncompatibleReceiverSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
236
TR::SymbolReference * findOrCreateIncompatibleClassChangeErrorSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
237
TR::SymbolReference * findOrCreateReportStaticMethodEnterSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
238
TR::SymbolReference * findOrCreateReportMethodExitSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
239
TR::SymbolReference * findOrCreateHeaderFlagsSymbolRef();
240
TR::SymbolReference * findOrCreateDiscontiguousArraySizeSymbolRef();
241
TR::SymbolReference * findOrCreateClassLoaderSymbolRef(TR_ResolvedMethod *);
242
TR::SymbolReference * findOrCreateCurrentThreadSymbolRef();
243
TR::SymbolReference * findOrCreateJ9MethodExtraFieldSymbolRef(intptr_t offset);
244
TR::SymbolReference * findOrCreateJ9MethodConstantPoolFieldSymbolRef(intptr_t offset);
245
TR::SymbolReference * findOrCreateStartPCLinkageInfoSymbolRef(intptr_t offset);
246
TR::SymbolReference * findOrCreatePerCodeCacheHelperSymbolRef(TR_CCPreLoadedCode helper, uintptr_t helperAddr);
247
TR::SymbolReference * findOrCreateANewArraySymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
248
TR::SymbolReference * findOrCreateStringSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
249
/** \brief
250
* Finds or creates a constant dynamic static symbol reference.
251
*
252
* \param owningMethodSymbol
253
* The owning resolved method symbol.
254
*
255
* \param cpIndex
256
* The constant pool index of the constant dynamic.
257
*
258
* \param symbolTypeSig
259
* The underlying class type signature string of the constant dynamic. For primitive this is the signature of the corresponding autobox class.
260
*
261
* \param symbolTypeSigLength
262
* Length of the underlying class type signature string.
263
*
264
* \param isCondyPrimitive
265
* Determines whether the constant dynamic is of primitive type.
266
*
267
* \return
268
* The static symbol reference of the constant dynamic.
269
*/
270
TR::SymbolReference * findOrCreateConstantDynamicSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, char* symbolTypeSig, int32_t symbolTypeSigLength, bool isCondyPrimitive);
271
TR::SymbolReference * findContiguousArraySizeSymbolRef() { return element(contiguousArraySizeSymbol); }
272
TR::SymbolReference * findOrCreateMethodMonitorEntrySymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
273
TR::SymbolReference * findOrCreateMethodMonitorExitSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
274
TR::SymbolReference * findOrCreateCompiledMethodSymbolRef();
275
TR::SymbolReference * findOrCreateMethodTypeSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
276
TR::SymbolReference * findOrCreateMethodHandleSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
277
TR::SymbolReference * findOrCreateClassStaticsSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);
278
TR::SymbolReference * findOrCreateStaticSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, bool isStore);
279
280
TR::SymbolReference * findOrCreateClassIsArraySymbolRef();
281
282
TR::SymbolReference * findArrayClassRomPtrSymbolRef();
283
TR::SymbolReference * findClassRomPtrSymbolRef();
284
285
TR::SymbolReference * findClassFromJavaLangClassAsPrimitiveSymbolRef();
286
TR::SymbolReference * findOrCreateClassFromJavaLangClassAsPrimitiveSymbolRef();
287
288
TR::SymbolReference * findOrCreateJavaLangClassFromClassSymbolRef();
289
TR::SymbolReference * findOrCreateClassFromJavaLangClassSymbolRef();
290
TR::SymbolReference * findOrCreateInitializeStatusFromClassSymbolRef();
291
TR::SymbolReference * findInitializeStatusFromClassSymbolRef();
292
TR::SymbolReference * findOrCreateClassRomPtrSymbolRef();
293
TR::SymbolReference * findOrCreateArrayComponentTypeSymbolRef();
294
295
TR::SymbolReference * findOrCreateProfilingBufferCursorSymbolRef();
296
TR::SymbolReference * findOrCreateProfilingBufferEndSymbolRef();
297
TR::SymbolReference * findOrCreateProfilingBufferSymbolRef(intptr_t offset = 0);
298
299
// optimizer
300
TR::SymbolReference * findOrCreateRamStaticsFromClassSymbolRef();
301
TR::SymbolReference * findOrCreateGlobalFragmentSymbolRef();
302
TR::SymbolReference * findOrCreateThreadDebugEventData(int32_t index);
303
304
// optimizer (loop versioner)
305
TR::SymbolReference * findOrCreateThreadLowTenureAddressSymbolRef();
306
TR::SymbolReference * findOrCreateThreadHighTenureAddressSymbolRef();
307
308
TR::SymbolReference * findOrCreateFragmentParentSymbolRef();
309
310
/** \brief
311
* Finds an unsafe symbol reference with given constraints if it exists.
312
*
313
* \param type
314
* The type of the unsafe symbol.
315
*
316
* \param javaObjectReference
317
* Determines whether this symbol reference is referencing a Java object field.
318
*
319
* \param javaStaticReference
320
* Determines whether this symbol reference is referencing a Java object static field.
321
*
322
* \param isVolatile
323
* Determines whether this symbol should be treated with volatile semantics.
324
*
325
* \return
326
* The unsafe symbol reference with given constraints if it exists; <c>NULL</c> otherwise.
327
*/
328
TR::SymbolReference* findUnsafeSymbolRef(TR::DataType type, bool javaObjectReference = false, bool javaStaticReference = false, bool isVolatile = false);
329
330
/** \brief
331
* Finds an unsafe symbol reference with given constraints if it exists, or creates one if no such symbol
332
* reference already exists.
333
*
334
* \param type
335
* The type of the unsafe symbol.
336
*
337
* \param javaObjectReference
338
* Determines whether this symbol reference is referencing a Java object field.
339
*
340
* \param javaStaticReference
341
* Determines whether this symbol reference is referencing a Java object static field.
342
*
343
* \param isVolatile
344
* Determines whether this symbol should be treated with volatile semantics.
345
*
346
* \return
347
* The unsafe symbol reference with given constraints if it exists.
348
*/
349
TR::SymbolReference* findOrCreateUnsafeSymbolRef(TR::DataType type, bool javaObjectReference = false, bool javaStaticReference = false, bool isVolatile = false);
350
351
TR::SymbolReference * findOrCreateImmutableGenericIntShadowSymbolReference(intptr_t offset); // "Immutable" means no aliasing issues; ie. reads from these shadows can be freely reordered wrt anything else
352
353
TR::SymbolReference * findOrCreateCheckCastForArrayStoreSymbolRef(TR::ResolvedMethodSymbol *owningMethodSymbol);
354
355
/** \brief
356
* Finds the <objectEqualityComparison> "nonhelper" symbol reference,
357
* creating it if necessary.
358
*
359
* \return
360
* The <objectEqualityComparison> symbol reference.
361
*/
362
TR::SymbolReference *findOrCreateObjectEqualityComparisonSymbolRef();
363
TR::SymbolReference *findOrCreateObjectInequalityComparisonSymbolRef();
364
365
/**
366
* \brief
367
* Finds the <encodeASCII> symbol
368
* reference, creating it if necessary.
369
*
370
* \return
371
* The <encodeASCII> symbol reference.
372
*/
373
TR::SymbolReference *findOrCreateEncodeASCIISymbolRef();
374
375
/**
376
* \brief
377
* Finds the <nonNullableArrayNullStoreCheck> "nonhelper" symbol
378
* reference, creating it if necessary.
379
*
380
* \return
381
* The <nonNullableArrayNullStoreCheck> symbol reference.
382
*/
383
TR::SymbolReference *findOrCreateNonNullableArrayNullStoreCheckSymbolRef();
384
385
/**
386
* \brief
387
* Creates a new symbol for a parameter within the supplied owning method of the
388
* specified type and slot index.
389
*
390
* \param owningMethodSymbol
391
* Resolved method symbol for which this parameter is created.
392
*
393
* \param slot
394
* Slot index for this parameter.
395
*
396
* \param type
397
* TR::DataType of the parameter.
398
*
399
* \param knownObjectIndex
400
* known object index is needed if the parameter is a known object, like the receiver of a customer thunk
401
*
402
* \return
403
* The created TR::ParameterSymbol
404
*/
405
TR::ParameterSymbol * createParameterSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t slot, TR::DataType type, TR::KnownObjectTable::Index knownObjectIndex = TR::KnownObjectTable::UNKNOWN);
406
407
void initShadowSymbol(TR_ResolvedMethod *, TR::SymbolReference *, bool, TR::DataType, uint32_t, bool);
408
409
List<TR::SymbolReference> *dynamicMethodSymrefsByCallSiteIndex(int32_t index);
410
bool isFieldClassObject(TR::SymbolReference *symRef);
411
bool isFieldTypeBool(TR::SymbolReference *symRef);
412
bool isStaticTypeBool(TR::SymbolReference *symRef);
413
bool isReturnTypeBool(TR::SymbolReference *symRef);
414
415
/*
416
* Creates symbol references for parameters in @param owningMethodSymbol
417
* and add them to the current symbol reference table which is usually different
418
* from the global symbol reference table. This API is used for peeking and
419
* optimizations where a local symbol reference table is needed.
420
*/
421
void addParameters(TR::ResolvedMethodSymbol * owningMethodSymbol);
422
423
// NO LONGER NEEDED? Disabled since inception (2009)
424
void checkUserField(TR::SymbolReference *);
425
426
// Immutability
427
void checkImmutable(TR::SymbolReference *);
428
TR_ImmutableInfo *findOrCreateImmutableInfo(TR_OpaqueClassBlock *);
429
bool isImmutable(TR::SymbolReference *);
430
int immutableConstructorId(TR::MethodSymbol *);
431
bool hasImmutable() { return _hasImmutable; }
432
void setHasImmutable(bool b) { _hasImmutable = b; }
433
List<TR_ImmutableInfo> &immutableInfo() { return _immutableInfo; }
434
TR_Array<TR_BitVector *> &immutableSymRefNumbers() { return _immutableSymRefNumbers; }
435
436
int userFieldMethodId(TR::MethodSymbol *);
437
bool hasUserField() { return _hasUserField; }
438
void setHasUserField(bool b) { _hasUserField = b; }
439
440
void performClassLookahead(TR_PersistentClassInfo *, TR_ResolvedMethod *);
441
442
443
TR::SymbolReference * findShadowSymbol(TR_ResolvedMethod * owningMethod, int32_t cpIndex, TR::DataType, TR::Symbol::RecognizedField *recognizedField = NULL);
444
445
/**
446
* @brief Retrieve the textual name of the given NonHelperSymbol
447
*
448
* @param[in] nonHelper : the nonHelper symbol
449
*
450
* @return Textual name of the NonHelperSymbol
451
*/
452
static const char *getNonHelperSymbolName(CommonNonhelperSymbol nonHelper);
453
454
protected:
455
456
TR::Symbol *_currentThreadDebugEventDataSymbol;
457
List<TR::SymbolReference> _currentThreadDebugEventDataSymbolRefs;
458
List<TR::SymbolReference> _constantPoolAddressSymbolRefs;
459
460
private:
461
462
struct ResolvedFieldShadowKey
463
{
464
ResolvedFieldShadowKey(
465
TR_OpaqueClassBlock *containingClass,
466
uint32_t offset,
467
TR::DataType type)
468
: _containingClass(containingClass)
469
, _offset(offset)
470
, _type(type)
471
{}
472
473
TR_OpaqueClassBlock * const _containingClass;
474
const uint32_t _offset;
475
const TR::DataType _type;
476
477
bool operator<(const ResolvedFieldShadowKey &rhs) const
478
{
479
const ResolvedFieldShadowKey &lhs = *this;
480
std::less<void*> ptrLt;
481
482
if (lhs._containingClass != rhs._containingClass)
483
return ptrLt(lhs._containingClass, rhs._containingClass);
484
else if (lhs._offset != rhs._offset)
485
return lhs._offset < rhs._offset;
486
else
487
return lhs._type.getDataType() < rhs._type.getDataType();
488
}
489
};
490
491
typedef std::pair<const ResolvedFieldShadowKey, TR::SymbolReference*> ResolvedFieldShadowsEntry;
492
typedef TR::typed_allocator<ResolvedFieldShadowsEntry, TR::Allocator> ResolvedFieldShadowsAlloc;
493
typedef std::map<ResolvedFieldShadowKey, TR::SymbolReference*, std::less<ResolvedFieldShadowKey>, ResolvedFieldShadowsAlloc> ResolvedFieldShadows;
494
495
typedef std::pair<const ResolvedFieldShadowKey, TR::SymbolReference*> FlattenedArrayElementFieldShadowsEntry;
496
typedef TR::typed_allocator<FlattenedArrayElementFieldShadowsEntry, TR::Allocator> FlattenedArrayElementFieldShadowsAlloc;
497
typedef std::map<ResolvedFieldShadowKey, TR::SymbolReference*, std::less<ResolvedFieldShadowKey>, FlattenedArrayElementFieldShadowsAlloc> FlattenedArrayElementFieldShadows;
498
499
/**
500
* \brief Find if an existing resolved shadow exists matching the given key.
501
*
502
* The \p key is used to lookup the shadow symref. If a matching symref is found,
503
* the properties specified by the other boolean parameters are checked to make
504
* sure the properties of the symbol either match or have a more conservatively
505
* correct value. In other words, the properties need not match if the values
506
* set on the symbol would still be functionally correct. If they are not, an
507
* assert is fired.
508
*
509
* \param key is the key used to search for the symref
510
* \param isVolatile specifies whether the symbol found must be volatile.
511
* Expecting a non-volatile symbol but finding a volatile is functionally correct.
512
* However, expectinga a volatile symbol and finding a non-volatile one is incorrect,
513
* so an assert is fired.
514
* \param isPrivate specifies whether the symbol found must be private.
515
* Expecting a private symbol but finding a non-private one is functionally correct.
516
* However, expecting a non-private symbol and finding a private is incorrect,
517
* so an assert is fired.
518
* \param isFinal specifies whether the symbol found must be final.
519
* Expecting a final symbol but finding a non-final one is functionally correct.
520
* However, expecting a non-final field and finding a final one is incorrect,
521
* so an assert is fired.
522
* \return TR::SymbolReference* the shadow symref if found, NULL otherwise
523
*/
524
TR::SymbolReference * findResolvedFieldShadow(ResolvedFieldShadowKey key, bool isVolatile, bool isPrivate, bool isFinal);
525
/**
526
* \brief Find if an existing flattened array shadow exists matching the given key.
527
*
528
* \param key is the key used to search for the symref
529
* \param isPrivate specifies whether the symbol found must be private.
530
* \return TR::SymbolReference* the flattened array shadow symref if found, NULL otherwise
531
*/
532
TR::SymbolReference * findFlattenedArrayElementFieldShadow(ResolvedFieldShadowKey key, bool isPrivate);
533
534
/**
535
* \brief Create a shadow symbol
536
*
537
* \param type is the type of the shadow
538
* \param isVolatile specifies whether the shadow corresponds to a vloatile field
539
* \param isPrivate specifies whether the shadow corresponds to a private field
540
* \param isFinal specifies whether the shadow corresponds to a final field
541
* \param name is the name of the corresponding field
542
* \param recognizedField sepcifies a recognized field the symbol corresponds to
543
* \return TR::Symbol* the pointer to the new symbol
544
*/
545
TR::Symbol * createShadowSymbol(TR::DataType type, bool isVolatile, bool isPrivate, bool isFinal, const char *name, TR::Symbol::RecognizedField recognizedField);
546
547
TR::SymbolReference * createShadowSymbolWithoutCpIndex(TR::ResolvedMethodSymbol *, bool , TR::DataType, uint32_t, bool);
548
TR::SymbolReference * findJavaLangReferenceReferentShadowSymbol(TR_ResolvedMethod * owningMethod, TR::DataType, uint32_t);
549
550
TR_Array<List<TR::SymbolReference>*> _dynamicMethodSymrefsByCallSiteIndex;
551
552
List<TR_ImmutableInfo> _immutableInfo;
553
TR_Array<TR_BitVector *> _immutableSymRefNumbers;
554
555
/** \brief
556
* Represents the set of symbol references to static fields of Java objects.
557
*/
558
TR_Array<TR::SymbolReference *> * _unsafeJavaStaticSymRefs;
559
560
/** \brief
561
* Represents the set of symbol references to static volatile fields of Java objects.
562
*/
563
TR_Array<TR::SymbolReference *> * _unsafeJavaStaticVolatileSymRefs;
564
565
ResolvedFieldShadows _resolvedFieldShadows;
566
567
FlattenedArrayElementFieldShadows _flattenedArrayElementFieldShadows;
568
569
static const char *_commonNonHelperSymbolNames[];
570
571
};
572
573
}
574
#define _numImmutableClasses (TR::java_lang_String_init - TR::java_lang_Boolean_init + 1)
575
576
#endif
577
578