Skip to content

Commit

Permalink
Prepare non-helper symbol printing for extensibility
Browse files Browse the repository at this point in the history
Introduce a new function `getNonHelperSymbolName()` to retrieve the
name of a non-helper symbol.

Signed-off-by: Daryl Maier <maier@ca.ibm.com>
  • Loading branch information
0xdaryl committed Feb 22, 2021
1 parent ce351d8 commit 6b54617
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 1 deletion.
100 changes: 100 additions & 0 deletions compiler/compile/OMRSymbolReferenceTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "omrformatconsts.h"
#include "codegen/CodeGenerator.hpp"
#include "env/FrontEnd.hpp"
#include "env/KnownObjectTable.hpp"
Expand Down Expand Up @@ -2093,3 +2094,102 @@ OMR::SymbolReferenceTable::rememberOriginalUnimprovedSymRef(
entryPreventingInsertion->second,
original->getReferenceNumber());
}


const char *OMR::SymbolReferenceTable::_commonNonHelperSymbolNames[] =
{
"<contiguousArraySize>",
"<discontiguousArraySize>",
"<arrayClassRomPtr>",
"<classRomPtr>",
"<javaLangClassFromClass>",
"<classFromJavaLangClass>",
"<addressOfClassOfMethod>",
"<ramStaticsFromClass>",
"<componentClass>",
"<componentClassAsPrimitive>",
"<isArray>",
"<isClassAndDepthFlags>",
"<initializeStatusFromClass>",
"<isClassFlags>",
"<vft>",
"<currentThread>",
"<recompilationCounter>",
"<excp>",
"<indexableSize>",
"<resolveCheck>",
"<arrayTranslate>",
"<arrayTranslateAndTest>",
"<long2String>",
"<bitOpMem>",
"<reverseLoad>",
"<reverseStore>",
"<currentTimeMaxPrecision>",
"<headerFlags>",
"<singlePrecisionSQRT>",
"<threadPrivateFlags>",
"<arrayletSpineFirstElement>",
"<dltBlock>",
"<countForRecompile>",
"<gcrPatchPoint>",
"<counterAddress>",
"<startPC>",
"<compiledMethod>",
"<thisRangeExtension>",
"<profilingBufferCursor>",
"<profilingBufferEnd>",
"<profilingBuffer>",
"<osrBuffer>",
"<osrScratchBuffer>",
"<osrFrameIndex>",
"<osrReturnAddress>",
"<potentialOSRPointHelper>",
"<osrFearPointHelper>",
"<eaEscapeHelper>",
"<lowTenureAddress>",
"<highTenureAddress>",
"<fragmentParent>",
"<globalFragment>",
"<instanceShape>",
"<instanceDescription>",
"<descriptionWordFromPtr>",
"<classFromJavaLangClassAsPrimitive>",
"<javaVM>",
"<heapBase>",
"<heapTop>",
"<j9methodExtraField>",
"<j9methodConstantPoolField>",
"<startPCLinkageInfo>",
"<instanceShapeFromROMClass>",
"<objectEqualityComparison>",
"<synchronizedFieldLoad>",
"<atomicAdd>",
"<atomicFetchAndAdd>",
"<atomicFetchAndAdd32Bit>",
"<atomicFetchAndAdd64Bit>",
"<atomicSwap>",
"<atomicSwap32Bit>",
"<atomicSwap64Bit>",
"<atomicCompareAndSwapReturnStatus>",
"<atomicCompareAndSwapReturnValue>",
"<jProfileValueSymbol>",
"<jProfileValueWithNullCHKSymbol>",
"<j9VMThreadTempSlotField>"
};


const char *
OMR::SymbolReferenceTable::getNonHelperSymbolName(CommonNonhelperSymbol nonHelper)
{
TR_ASSERT_FATAL(nonHelper >= OMRfirstPrintableCommonNonhelperSymbol &&
nonHelper <= OMRlastPrintableCommonNonhelperSymbol,
"unknown non helper %" OMR_PRId32, static_cast<int32_t>(nonHelper));

#if 0
static_assert(sizeof(_commonNonHelperSymbolNames)/sizeof(_commonNonHelperSymbolNames[0]) ==
static_cast<int32_t>(OMRlastPrintableCommonNonhelperSymbol - OMRfirstPrintableCommonNonhelperSymbol + 1),
"_commonNonHelperSymbolNames array must match CommonNonHelperSymbol enumeration");
#endif

return _commonNonHelperSymbolNames[static_cast<int32_t>(nonHelper - OMRfirstPrintableCommonNonhelperSymbol)];
}
19 changes: 18 additions & 1 deletion compiler/compile/OMRSymbolReferenceTable.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -101,6 +101,8 @@ class SymbolReferenceTable

firstCommonNonhelperNonArrayShadowSymbol = firstArrayletShadowSymbol + TR::NumTypes,

OMRfirstPrintableCommonNonhelperSymbol = firstCommonNonhelperNonArrayShadowSymbol,

contiguousArraySizeSymbol = firstCommonNonhelperNonArrayShadowSymbol,
discontiguousArraySizeSymbol,
arrayClassRomPtrSymbol,
Expand Down Expand Up @@ -388,6 +390,8 @@ class SymbolReferenceTable
*/
j9VMThreadTempSlotFieldSymbol,

OMRlastPrintableCommonNonhelperSymbol = j9VMThreadTempSlotFieldSymbol,

firstPerCodeCacheHelperSymbol,
lastPerCodeCacheHelperSymbol = firstPerCodeCacheHelperSymbol + TR_numCCPreLoadedCode - 1,

Expand Down Expand Up @@ -486,6 +490,15 @@ class SymbolReferenceTable
}
}

/**
* @brief Retrieve the textual name of the given NonHelperSymbol
*
* @param[in] nonHelper : the nonHelper symbol
*
* @return Textual name of the NonHelperSymbol
*/
static const char *getNonHelperSymbolName(CommonNonhelperSymbol nonHelper);

// --------------------------------------------------------------------------

TR::SymbolReference * & element(TR_RuntimeHelper s);
Expand Down Expand Up @@ -841,6 +854,10 @@ class SymbolReferenceTable
// J9
#define _numNonUserFieldClasses 4

private:

static const char *_commonNonHelperSymbolNames[];

};

}
Expand Down

0 comments on commit 6b54617

Please sign in to comment.