Path: blob/master/runtime/compiler/il/J9StaticSymbol.hpp
6000 views
/*******************************************************************************1* Copyright (c) 2000, 2019 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_STATICSYMBOL_INCL23#define J9_STATICSYMBOL_INCL2425/*26* The following #define and typedef must appear before any #includes in this file27*/28#ifndef J9_STATICSYMBOL_CONNECTOR29#define J9_STATICSYMBOL_CONNECTOR30namespace J9 { class StaticSymbol; }31namespace J9 { typedef J9::StaticSymbol StaticSymbolConnector; }32#endif3334#include <stdint.h>35#include "il/DataTypes.hpp"36#include "il/OMRStaticSymbol.hpp"37#include "il/Symbol.hpp"3839namespace TR { class StaticSymbol; }4041namespace J942{4344/**45* A symbol with an address46*/47class OMR_EXTENSIBLE StaticSymbol : public OMR::StaticSymbolConnector48{4950protected:5152StaticSymbol(TR::DataType d) :53OMR::StaticSymbolConnector(d) { }5455StaticSymbol(TR::DataType d, void * address) :56OMR::StaticSymbolConnector(d, address) { }5758StaticSymbol(TR::DataType d, uint32_t s) :59OMR::StaticSymbolConnector(d, s) { }6061/* ------- TR_CallSiteTableEntrySymbol --------- */62public:6364void makeCallSiteTableEntry(int32_t callSiteIndex);65int32_t getCallSiteIndex();6667private:6869int32_t _callSiteIndex;7071/* ------- TR_ConstantDynamicSymbol --------- */72public:7374/** \brief75* Populate the class signature fields and primitive flag of this constant dynamic symbol.76*77* \param classSignature78* The class signature string of the constant dynamic. For primitive this is the signature of the corresponding autobox class.79*80* \param classSignatureLength81* The length of the class signature string of the constant dynamic.82*83* \param isPrimitive84* Determines whether the constant dynamic is primitive type.85*86* \return87* Fields of this static symbol are populated.88*/89void makeConstantDynamic(char * classSignature, int32_t classSignatureLength, bool isPrimitive);9091/** \brief92* Retrieves the class signature string for this constant dynamic static symbol.93*94* \param classSignatureLength95* The length of the class signature string of the constant dynamic. Modified in place.96*97* \return98* The class signature string for this constant dynamic static symbol.99*/100char * getConstantDynamicClassSignature(int32_t & classSignatureLength);101102/** \brief103* Retrieves whether the underlying constant dynamic is of primitive type.104*105* \return106* <c>true</c> if the underlying constant dynamic is primitive; <c>false</c> otherwise.107*/108bool isConstantDynamicPrimitive();109110private:111112char * _classSignature;113int32_t _classSignatureLength;114bool _isPrimitive;115116/* ------ TR_RecognizedStaticSymbol ---------- */117public:118119template <typename AllocatorType>120static TR::StaticSymbol * createRecognized(AllocatorType m, TR::DataType d, TR::Symbol::RecognizedField f);121122/**123* If this symbol has a valid recognized field, return it. Otherwise, return124* TR::Symbol::UnknownField125*/126TR::Symbol::RecognizedField getRecognizedField();127128private:129130void makeRecognized(TR::Symbol::RecognizedField f)131{132_recognizedField = f;133_flags.set(RecognizedStatic);134}135136TR::Symbol::RecognizedField _recognizedField;137138/* ------- TR_MethodTypeTableEntrySymbol ------ */139public:140template <typename AllocatorType>141static TR::StaticSymbol * createMethodTypeTableEntry(AllocatorType m, int32_t methodTypeIndex);142143int32_t getMethodTypeIndex();144145private:146void makeMethodTypeTableEntry(int32_t methodTypeIndex);147148149int32_t _methodTypeIndex;150151};152153}154155#endif156157158159