Path: blob/master/runtime/compiler/compile/J9SymbolReferenceTable.hpp
6000 views
/*******************************************************************************1* Copyright (c) 2000, 2022 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/2122#ifndef J9_SYMBOLREFERENCETABLE_INCL23#define J9_SYMBOLREFERENCETABLE_INCL2425/*26* The following #define and typedef must appear before any #includes in this file27*/28#ifndef J9_SYMBOLREFERENCETABLE_CONNECTOR29#define J9_SYMBOLREFERENCETABLE_CONNECTOR30namespace J9 { class SymbolReferenceTable; }31namespace J9 { typedef J9::SymbolReferenceTable SymbolReferenceTableConnector; }32#endif3334#include "compile/OMRSymbolReferenceTable.hpp"3536#include <stddef.h>37#include <stdint.h>38#include <map>39#include "env/jittypes.h"4041class TR_BitVector;42class TR_PersistentClassInfo;43namespace TR { class Compilation; }444546class TR_ImmutableInfo47{48public:49TR_ALLOC(TR_Memory::SymbolReferenceTable)5051TR_ImmutableInfo(TR_OpaqueClassBlock *clazz, TR_BitVector *immutableSymRefs, TR_BitVector *immutableConstructorDefAliases)52: _clazz(clazz), _immutableSymRefNumbers(immutableSymRefs), _immutableConstructorDefAliases(immutableConstructorDefAliases)53{54}5556TR_OpaqueClassBlock *_clazz;57TR_BitVector *_immutableSymRefNumbers;58TR_BitVector *_immutableConstructorDefAliases;59};60616263namespace J964{6566class SymbolReferenceTable : public OMR::SymbolReferenceTableConnector67{68public:6970SymbolReferenceTable(size_t size, TR::Compilation *comp);7172TR::SymbolReference * findOrCreateCountForRecompileSymbolRef();73TR::SymbolReference * findDiscontiguousArraySizeSymbolRef() { return element(discontiguousArraySizeSymbol); }74TR::SymbolReference * findOrCreateOSRBufferSymbolRef();75TR::SymbolReference * findOrCreateOSRScratchBufferSymbolRef();76TR::SymbolReference * findOrCreateOSRFrameIndexSymbolRef();7778/** \brief79* Find or create VMThread tempSlot symbol reference. J9VMThread.tempSlot provides a mechanism for the80* compiler to provide information that the VM can use for various reasons - such as locating items on81* the stack during a call to internal native methods that are signature-polymorphic.82*83* \return84* TR::SymbolReference* the VMThreadTempSlotField symbol reference85*/86TR::SymbolReference * findOrCreateVMThreadTempSlotFieldSymbolRef();8788/** \brief89* Find or create VMThread.floatTemp1 symbol reference. J9VMThread.floatTemp1 provides an additional90* mechanism for the compiler to provide information that the VM can use for various reasons91*92* \return93* TR::SymbolReference* the VMThread.floatTemp1 symbol reference94*/95TR::SymbolReference * findOrCreateVMThreadFloatTemp1SymbolRef();9697/** \brief98* Find or create symref for vTableIndex field of struct J9JNIMethodID99*100* \param offset101* The offsetof value for vTableIndex field102*103* \return104* TR::SymbolReference* the symref representing vTableIndex field105*/106TR::SymbolReference * findOrCreateJ9JNIMethodIDvTableIndexFieldSymbol(intptr_t offset);107108// CG linkage109TR::SymbolReference * findOrCreateAcquireVMAccessSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol); // minor rework110TR::SymbolReference * findOrCreateReleaseVMAccessSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol); // minor rework111TR::SymbolReference * findOrCreateStackOverflowSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol); // minor rework112TR::SymbolReference * findOrCreateThrowCurrentExceptionSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0); // minor rework113TR::SymbolReference * findOrCreateThrowUnreportedExceptionSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);114115TR::SymbolReference * findOrCreateWriteBarrierStoreSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);116TR::SymbolReference * findOrCreateWriteBarrierStoreGenerationalSymbolRef(TR::ResolvedMethodSymbol *owningMethodSymbol = 0);117TR::SymbolReference * findOrCreateConstantPoolAddressSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);118119// FE120TR::SymbolReference * findOrCreateFloatSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);121TR::SymbolReference * findOrCreateDoubleSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);122TR::SymbolReference * createSystemRuntimeHelper(TR_RuntimeHelper, bool = false, bool = false, bool preservesAllRegisters = false);123TR::SymbolReference * findOrCreateStaticMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);124TR::SymbolReference * findOrCreateSpecialMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);125TR::SymbolReference * findOrCreateVirtualMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);126TR::SymbolReference * findOrCreateInterfaceMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);127TR::SymbolReference * findOrCreateDynamicMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t callSiteIndex, bool * unresolvedInCP = 0);128TR::SymbolReference * findOrCreateHandleMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, bool * unresolvedInCP = 0);129TR::SymbolReference * findOrCreateHandleMethodSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, char *signature);130TR::SymbolReference * findOrCreateCallSiteTableEntrySymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t callSiteIndex);131TR::SymbolReference * findOrCreateMethodTypeTableEntrySymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);132#if defined(J9VM_OPT_METHOD_HANDLE)133TR::SymbolReference * findOrCreateVarHandleMethodTypeTableEntrySymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);134#endif /* defined(J9VM_OPT_METHOD_HANDLE) */135TR::SymbolReference * methodSymRefWithSignature(TR::SymbolReference *original, char *effectiveSignature, int32_t effectiveSignatureLength);136TR::SymbolReference * findOrCreateTypeCheckArrayStoreSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);137TR::SymbolReference * findOrCreateArrayClassRomPtrSymbolRef();138TR::SymbolReference * findOrCreateJavaLangReferenceReferentShadowSymbol(TR::ResolvedMethodSymbol *, bool , TR::DataType, uint32_t, bool);139TR::SymbolReference * findOrCreateWriteBarrierStoreGenerationalAndConcurrentMarkSymbolRef(TR::ResolvedMethodSymbol *owningMethodSymbol = 0);140TR::SymbolReference * findOrCreateWriteBarrierStoreRealTimeGCSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);141TR::SymbolReference * findOrCreateWriteBarrierClassStoreRealTimeGCSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);142TR::SymbolReference * findOrCreateWriteBarrierBatchStoreSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = 0);143144TR::SymbolReference * findOrCreateAcmpeqHelperSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);145TR::SymbolReference * findOrCreateAcmpneHelperSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);146147// these helpers are guaranteed to never throw if the receiving object is not null,148// so we explicit generate NULLCHKs and assume the helpers will never throw149TR::SymbolReference * findOrCreateGetFlattenableFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);150TR::SymbolReference * findOrCreateWithFlattenableFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);151TR::SymbolReference * findOrCreatePutFlattenableFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);152TR::SymbolReference * findOrCreateGetFlattenableStaticFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);153TR::SymbolReference * findOrCreatePutFlattenableStaticFieldSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);154155// these helpers may throw exception such as ArrayIndexOutOfBoundsException or ArrayStoreException etc.156TR::SymbolReference * findOrCreateLoadFlattenableArrayElementSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);157TR::SymbolReference * findOrCreateStoreFlattenableArrayElementSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol = NULL);158159// This helper walks the iTables to find the VFT offset for an interface160// method that is not known until runtime (and therefore does not have an161// IPIC data snippet). The parameters are the receiver class, interface162// class, and iTable index (though in the trees they must appear as163// children in the opposite order), and the return value is the VFT offset.164//165// The given receiver class must implement the given interface class.166//167TR::SymbolReference * findOrCreateLookupDynamicInterfaceMethodSymbolRef();168169// This helper is a variant of jitLookupDynamicInterfaceMethod that requires170// the dispatched callee to be public, otherwise throwing IllegalAccessError.171TR::SymbolReference * findOrCreateLookupDynamicPublicInterfaceMethodSymbolRef();172173TR::SymbolReference * findOrCreateShadowSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, bool isStore);174TR::SymbolReference * findOrFabricateShadowSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, TR::Symbol::RecognizedField recognizedField, TR::DataType type, uint32_t offset, bool isVolatile, bool isPrivate, bool isFinal, char* name = NULL);175176/** \brief177* Returns a symbol reference for an entity not present in the constant pool.178*179* For resolved symrefs, if an appropriate one is found, it will be returned180* even if it originated from a call to findOrCreateShadowSymbol.181*182* \param containingClass183* The class that contains the field.184* \param type185* The data type of the field.186* \param offset187* The offset of the field.188* \param isVolatile189* Specifies whether the field is volatile.190* \param isPrivate191* Specifies whether the field is private.192* \param isFinal193* Specifies whether the field is final.194* \param name195* The name of the field.196* \param signature197* The signature of the field.198* \return199* Returns a symbol reference fabricated for the field.200*/201TR::SymbolReference * findOrFabricateShadowSymbol(TR_OpaqueClassBlock *containingClass, TR::DataType type, uint32_t offset, bool isVolatile, bool isPrivate, bool isFinal, const char *name, const char *signature);202203/** \brief204* Returns an array shadow symbol reference fabricated for the field of a flattened array element.205*206* \param arrayComponentClass207* The array component class that contains the field.208* \param type209* The data type of the field.210* \param fieldOffset211* The offset of the field.212* \param isPrivate213* Specifies whether the field is private.214* \param fieldName215* The name of the field.216* \param fieldSignature217* The signature of the field.218* \return219* Returns an array shadow symbol reference fabricated for the field of a flattened array element.220*/221TR::SymbolReference * findOrFabricateFlattenedArrayElementFieldShadowSymbol(TR_OpaqueClassBlock *arrayComponentClass, TR::DataType type, uint32_t fieldOffset, bool isPrivate, const char *fieldName, const char *fieldSignature);222223TR::SymbolReference * findOrCreateObjectNewInstanceImplSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol);224TR::SymbolReference * findOrCreateDLTBlockSymbolRef();225TR::SymbolReference * findDLTBlockSymbolRef();226TR::SymbolReference * findOrCreateMultiANewArraySymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);227TR::SymbolReference * findOrCreateInstanceShapeSymbolRef();228TR::SymbolReference * findOrCreateInstanceDescriptionSymbolRef();229TR::SymbolReference * findOrCreateDescriptionWordFromPtrSymbolRef();230TR::SymbolReference * findOrCreateClassFlagsSymbolRef();231TR::SymbolReference * findOrCreateClassAndDepthFlagsSymbolRef();232TR::SymbolReference * findOrCreateArrayComponentTypeAsPrimitiveSymbolRef();233TR::SymbolReference * findOrCreateMethodTypeCheckSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);234TR::SymbolReference * findOrCreateIncompatibleReceiverSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);235TR::SymbolReference * findOrCreateIncompatibleClassChangeErrorSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);236TR::SymbolReference * findOrCreateReportStaticMethodEnterSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);237TR::SymbolReference * findOrCreateReportMethodExitSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);238TR::SymbolReference * findOrCreateHeaderFlagsSymbolRef();239TR::SymbolReference * findOrCreateDiscontiguousArraySizeSymbolRef();240TR::SymbolReference * findOrCreateClassLoaderSymbolRef(TR_ResolvedMethod *);241TR::SymbolReference * findOrCreateCurrentThreadSymbolRef();242TR::SymbolReference * findOrCreateJ9MethodExtraFieldSymbolRef(intptr_t offset);243TR::SymbolReference * findOrCreateJ9MethodConstantPoolFieldSymbolRef(intptr_t offset);244TR::SymbolReference * findOrCreateStartPCLinkageInfoSymbolRef(intptr_t offset);245TR::SymbolReference * findOrCreatePerCodeCacheHelperSymbolRef(TR_CCPreLoadedCode helper, uintptr_t helperAddr);246TR::SymbolReference * findOrCreateANewArraySymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);247TR::SymbolReference * findOrCreateStringSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);248/** \brief249* Finds or creates a constant dynamic static symbol reference.250*251* \param owningMethodSymbol252* The owning resolved method symbol.253*254* \param cpIndex255* The constant pool index of the constant dynamic.256*257* \param symbolTypeSig258* The underlying class type signature string of the constant dynamic. For primitive this is the signature of the corresponding autobox class.259*260* \param symbolTypeSigLength261* Length of the underlying class type signature string.262*263* \param isCondyPrimitive264* Determines whether the constant dynamic is of primitive type.265*266* \return267* The static symbol reference of the constant dynamic.268*/269TR::SymbolReference * findOrCreateConstantDynamicSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, char* symbolTypeSig, int32_t symbolTypeSigLength, bool isCondyPrimitive);270TR::SymbolReference * findContiguousArraySizeSymbolRef() { return element(contiguousArraySizeSymbol); }271TR::SymbolReference * findOrCreateMethodMonitorEntrySymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);272TR::SymbolReference * findOrCreateMethodMonitorExitSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);273TR::SymbolReference * findOrCreateCompiledMethodSymbolRef();274TR::SymbolReference * findOrCreateMethodTypeSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);275TR::SymbolReference * findOrCreateMethodHandleSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);276TR::SymbolReference * findOrCreateClassStaticsSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex);277TR::SymbolReference * findOrCreateStaticSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t cpIndex, bool isStore);278279TR::SymbolReference * findOrCreateClassIsArraySymbolRef();280281TR::SymbolReference * findArrayClassRomPtrSymbolRef();282TR::SymbolReference * findClassRomPtrSymbolRef();283284TR::SymbolReference * findClassFromJavaLangClassAsPrimitiveSymbolRef();285TR::SymbolReference * findOrCreateClassFromJavaLangClassAsPrimitiveSymbolRef();286287TR::SymbolReference * findOrCreateJavaLangClassFromClassSymbolRef();288TR::SymbolReference * findOrCreateClassFromJavaLangClassSymbolRef();289TR::SymbolReference * findOrCreateInitializeStatusFromClassSymbolRef();290TR::SymbolReference * findInitializeStatusFromClassSymbolRef();291TR::SymbolReference * findOrCreateClassRomPtrSymbolRef();292TR::SymbolReference * findOrCreateArrayComponentTypeSymbolRef();293294TR::SymbolReference * findOrCreateProfilingBufferCursorSymbolRef();295TR::SymbolReference * findOrCreateProfilingBufferEndSymbolRef();296TR::SymbolReference * findOrCreateProfilingBufferSymbolRef(intptr_t offset = 0);297298// optimizer299TR::SymbolReference * findOrCreateRamStaticsFromClassSymbolRef();300TR::SymbolReference * findOrCreateGlobalFragmentSymbolRef();301TR::SymbolReference * findOrCreateThreadDebugEventData(int32_t index);302303// optimizer (loop versioner)304TR::SymbolReference * findOrCreateThreadLowTenureAddressSymbolRef();305TR::SymbolReference * findOrCreateThreadHighTenureAddressSymbolRef();306307TR::SymbolReference * findOrCreateFragmentParentSymbolRef();308309/** \brief310* Finds an unsafe symbol reference with given constraints if it exists.311*312* \param type313* The type of the unsafe symbol.314*315* \param javaObjectReference316* Determines whether this symbol reference is referencing a Java object field.317*318* \param javaStaticReference319* Determines whether this symbol reference is referencing a Java object static field.320*321* \param isVolatile322* Determines whether this symbol should be treated with volatile semantics.323*324* \return325* The unsafe symbol reference with given constraints if it exists; <c>NULL</c> otherwise.326*/327TR::SymbolReference* findUnsafeSymbolRef(TR::DataType type, bool javaObjectReference = false, bool javaStaticReference = false, bool isVolatile = false);328329/** \brief330* Finds an unsafe symbol reference with given constraints if it exists, or creates one if no such symbol331* reference already exists.332*333* \param type334* The type of the unsafe symbol.335*336* \param javaObjectReference337* Determines whether this symbol reference is referencing a Java object field.338*339* \param javaStaticReference340* Determines whether this symbol reference is referencing a Java object static field.341*342* \param isVolatile343* Determines whether this symbol should be treated with volatile semantics.344*345* \return346* The unsafe symbol reference with given constraints if it exists.347*/348TR::SymbolReference* findOrCreateUnsafeSymbolRef(TR::DataType type, bool javaObjectReference = false, bool javaStaticReference = false, bool isVolatile = false);349350TR::SymbolReference * findOrCreateImmutableGenericIntShadowSymbolReference(intptr_t offset); // "Immutable" means no aliasing issues; ie. reads from these shadows can be freely reordered wrt anything else351352TR::SymbolReference * findOrCreateCheckCastForArrayStoreSymbolRef(TR::ResolvedMethodSymbol *owningMethodSymbol);353354/** \brief355* Finds the <objectEqualityComparison> "nonhelper" symbol reference,356* creating it if necessary.357*358* \return359* The <objectEqualityComparison> symbol reference.360*/361TR::SymbolReference *findOrCreateObjectEqualityComparisonSymbolRef();362TR::SymbolReference *findOrCreateObjectInequalityComparisonSymbolRef();363364/**365* \brief366* Finds the <encodeASCII> symbol367* reference, creating it if necessary.368*369* \return370* The <encodeASCII> symbol reference.371*/372TR::SymbolReference *findOrCreateEncodeASCIISymbolRef();373374/**375* \brief376* Finds the <nonNullableArrayNullStoreCheck> "nonhelper" symbol377* reference, creating it if necessary.378*379* \return380* The <nonNullableArrayNullStoreCheck> symbol reference.381*/382TR::SymbolReference *findOrCreateNonNullableArrayNullStoreCheckSymbolRef();383384/**385* \brief386* Creates a new symbol for a parameter within the supplied owning method of the387* specified type and slot index.388*389* \param owningMethodSymbol390* Resolved method symbol for which this parameter is created.391*392* \param slot393* Slot index for this parameter.394*395* \param type396* TR::DataType of the parameter.397*398* \param knownObjectIndex399* known object index is needed if the parameter is a known object, like the receiver of a customer thunk400*401* \return402* The created TR::ParameterSymbol403*/404TR::ParameterSymbol * createParameterSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t slot, TR::DataType type, TR::KnownObjectTable::Index knownObjectIndex = TR::KnownObjectTable::UNKNOWN);405406void initShadowSymbol(TR_ResolvedMethod *, TR::SymbolReference *, bool, TR::DataType, uint32_t, bool);407408List<TR::SymbolReference> *dynamicMethodSymrefsByCallSiteIndex(int32_t index);409bool isFieldClassObject(TR::SymbolReference *symRef);410bool isFieldTypeBool(TR::SymbolReference *symRef);411bool isStaticTypeBool(TR::SymbolReference *symRef);412bool isReturnTypeBool(TR::SymbolReference *symRef);413414/*415* Creates symbol references for parameters in @param owningMethodSymbol416* and add them to the current symbol reference table which is usually different417* from the global symbol reference table. This API is used for peeking and418* optimizations where a local symbol reference table is needed.419*/420void addParameters(TR::ResolvedMethodSymbol * owningMethodSymbol);421422// NO LONGER NEEDED? Disabled since inception (2009)423void checkUserField(TR::SymbolReference *);424425// Immutability426void checkImmutable(TR::SymbolReference *);427TR_ImmutableInfo *findOrCreateImmutableInfo(TR_OpaqueClassBlock *);428bool isImmutable(TR::SymbolReference *);429int immutableConstructorId(TR::MethodSymbol *);430bool hasImmutable() { return _hasImmutable; }431void setHasImmutable(bool b) { _hasImmutable = b; }432List<TR_ImmutableInfo> &immutableInfo() { return _immutableInfo; }433TR_Array<TR_BitVector *> &immutableSymRefNumbers() { return _immutableSymRefNumbers; }434435int userFieldMethodId(TR::MethodSymbol *);436bool hasUserField() { return _hasUserField; }437void setHasUserField(bool b) { _hasUserField = b; }438439void performClassLookahead(TR_PersistentClassInfo *, TR_ResolvedMethod *);440441442TR::SymbolReference * findShadowSymbol(TR_ResolvedMethod * owningMethod, int32_t cpIndex, TR::DataType, TR::Symbol::RecognizedField *recognizedField = NULL);443444/**445* @brief Retrieve the textual name of the given NonHelperSymbol446*447* @param[in] nonHelper : the nonHelper symbol448*449* @return Textual name of the NonHelperSymbol450*/451static const char *getNonHelperSymbolName(CommonNonhelperSymbol nonHelper);452453protected:454455TR::Symbol *_currentThreadDebugEventDataSymbol;456List<TR::SymbolReference> _currentThreadDebugEventDataSymbolRefs;457List<TR::SymbolReference> _constantPoolAddressSymbolRefs;458459private:460461struct ResolvedFieldShadowKey462{463ResolvedFieldShadowKey(464TR_OpaqueClassBlock *containingClass,465uint32_t offset,466TR::DataType type)467: _containingClass(containingClass)468, _offset(offset)469, _type(type)470{}471472TR_OpaqueClassBlock * const _containingClass;473const uint32_t _offset;474const TR::DataType _type;475476bool operator<(const ResolvedFieldShadowKey &rhs) const477{478const ResolvedFieldShadowKey &lhs = *this;479std::less<void*> ptrLt;480481if (lhs._containingClass != rhs._containingClass)482return ptrLt(lhs._containingClass, rhs._containingClass);483else if (lhs._offset != rhs._offset)484return lhs._offset < rhs._offset;485else486return lhs._type.getDataType() < rhs._type.getDataType();487}488};489490typedef std::pair<const ResolvedFieldShadowKey, TR::SymbolReference*> ResolvedFieldShadowsEntry;491typedef TR::typed_allocator<ResolvedFieldShadowsEntry, TR::Allocator> ResolvedFieldShadowsAlloc;492typedef std::map<ResolvedFieldShadowKey, TR::SymbolReference*, std::less<ResolvedFieldShadowKey>, ResolvedFieldShadowsAlloc> ResolvedFieldShadows;493494typedef std::pair<const ResolvedFieldShadowKey, TR::SymbolReference*> FlattenedArrayElementFieldShadowsEntry;495typedef TR::typed_allocator<FlattenedArrayElementFieldShadowsEntry, TR::Allocator> FlattenedArrayElementFieldShadowsAlloc;496typedef std::map<ResolvedFieldShadowKey, TR::SymbolReference*, std::less<ResolvedFieldShadowKey>, FlattenedArrayElementFieldShadowsAlloc> FlattenedArrayElementFieldShadows;497498/**499* \brief Find if an existing resolved shadow exists matching the given key.500*501* The \p key is used to lookup the shadow symref. If a matching symref is found,502* the properties specified by the other boolean parameters are checked to make503* sure the properties of the symbol either match or have a more conservatively504* correct value. In other words, the properties need not match if the values505* set on the symbol would still be functionally correct. If they are not, an506* assert is fired.507*508* \param key is the key used to search for the symref509* \param isVolatile specifies whether the symbol found must be volatile.510* Expecting a non-volatile symbol but finding a volatile is functionally correct.511* However, expectinga a volatile symbol and finding a non-volatile one is incorrect,512* so an assert is fired.513* \param isPrivate specifies whether the symbol found must be private.514* Expecting a private symbol but finding a non-private one is functionally correct.515* However, expecting a non-private symbol and finding a private is incorrect,516* so an assert is fired.517* \param isFinal specifies whether the symbol found must be final.518* Expecting a final symbol but finding a non-final one is functionally correct.519* However, expecting a non-final field and finding a final one is incorrect,520* so an assert is fired.521* \return TR::SymbolReference* the shadow symref if found, NULL otherwise522*/523TR::SymbolReference * findResolvedFieldShadow(ResolvedFieldShadowKey key, bool isVolatile, bool isPrivate, bool isFinal);524/**525* \brief Find if an existing flattened array shadow exists matching the given key.526*527* \param key is the key used to search for the symref528* \param isPrivate specifies whether the symbol found must be private.529* \return TR::SymbolReference* the flattened array shadow symref if found, NULL otherwise530*/531TR::SymbolReference * findFlattenedArrayElementFieldShadow(ResolvedFieldShadowKey key, bool isPrivate);532533/**534* \brief Create a shadow symbol535*536* \param type is the type of the shadow537* \param isVolatile specifies whether the shadow corresponds to a vloatile field538* \param isPrivate specifies whether the shadow corresponds to a private field539* \param isFinal specifies whether the shadow corresponds to a final field540* \param name is the name of the corresponding field541* \param recognizedField sepcifies a recognized field the symbol corresponds to542* \return TR::Symbol* the pointer to the new symbol543*/544TR::Symbol * createShadowSymbol(TR::DataType type, bool isVolatile, bool isPrivate, bool isFinal, const char *name, TR::Symbol::RecognizedField recognizedField);545546TR::SymbolReference * createShadowSymbolWithoutCpIndex(TR::ResolvedMethodSymbol *, bool , TR::DataType, uint32_t, bool);547TR::SymbolReference * findJavaLangReferenceReferentShadowSymbol(TR_ResolvedMethod * owningMethod, TR::DataType, uint32_t);548549TR_Array<List<TR::SymbolReference>*> _dynamicMethodSymrefsByCallSiteIndex;550551List<TR_ImmutableInfo> _immutableInfo;552TR_Array<TR_BitVector *> _immutableSymRefNumbers;553554/** \brief555* Represents the set of symbol references to static fields of Java objects.556*/557TR_Array<TR::SymbolReference *> * _unsafeJavaStaticSymRefs;558559/** \brief560* Represents the set of symbol references to static volatile fields of Java objects.561*/562TR_Array<TR::SymbolReference *> * _unsafeJavaStaticVolatileSymRefs;563564ResolvedFieldShadows _resolvedFieldShadows;565566FlattenedArrayElementFieldShadows _flattenedArrayElementFieldShadows;567568static const char *_commonNonHelperSymbolNames[];569570};571572}573#define _numImmutableClasses (TR::java_lang_String_init - TR::java_lang_Boolean_init + 1)574575#endif576577578