Skip to content

Commit

Permalink
Merge pull request #4054 from 0xdaryl/trmethod
Browse files Browse the repository at this point in the history
Create TR::Method typedef and modify TR_Method references
  • Loading branch information
Leonardo2718 authored Jun 20, 2019
2 parents 5d3a389 + f5064a7 commit 7c87422
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 71 deletions.
48 changes: 24 additions & 24 deletions compiler/compile/Method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,61 +297,61 @@ bool TR_ResolvedMethod::isDAAIntrinsicMethod()
#endif
}

uint32_t TR_Method::numberOfExplicitParameters() { TR_UNIMPLEMENTED(); return 0; }
TR::DataType TR_Method::parmType(uint32_t) { TR_UNIMPLEMENTED(); return TR::NoType; }
TR::ILOpCodes TR_Method::directCallOpCode() { TR_UNIMPLEMENTED(); return TR::BadILOp; }
TR::ILOpCodes TR_Method::indirectCallOpCode() { TR_UNIMPLEMENTED(); return TR::BadILOp; }
TR::DataType TR_Method::returnType() { TR_UNIMPLEMENTED(); return TR::NoType; }
bool TR_Method::returnTypeIsUnsigned() { TR_UNIMPLEMENTED(); return TR::NoType;}
uint32_t TR_Method::returnTypeWidth() { TR_UNIMPLEMENTED(); return 0; }
TR::ILOpCodes TR_Method::returnOpCode() { TR_UNIMPLEMENTED(); return TR::BadILOp; }
uint16_t TR_Method::classNameLength() { TR_UNIMPLEMENTED(); return 0; }
uint16_t TR_Method::nameLength() { TR_UNIMPLEMENTED(); return 0; }
uint16_t TR_Method::signatureLength() { TR_UNIMPLEMENTED(); return 0; }
char * TR_Method::classNameChars() { TR_UNIMPLEMENTED(); return 0; }
char * TR_Method::nameChars() { TR_UNIMPLEMENTED(); return 0; }
char * TR_Method::signatureChars() { TR_UNIMPLEMENTED(); return 0; }
bool TR_Method::isConstructor() { TR_UNIMPLEMENTED(); return false; }
bool TR_Method::isFinalInObject() { TR_UNIMPLEMENTED(); return false; }
const char * TR_Method::signature(TR_Memory *, TR_AllocationKind) { TR_UNIMPLEMENTED(); return 0; }
void TR_Method::setArchetypeSpecimen(bool b) { TR_UNIMPLEMENTED(); }
uint32_t TR::Method::numberOfExplicitParameters() { TR_UNIMPLEMENTED(); return 0; }
TR::DataType TR::Method::parmType(uint32_t) { TR_UNIMPLEMENTED(); return TR::NoType; }
TR::ILOpCodes TR::Method::directCallOpCode() { TR_UNIMPLEMENTED(); return TR::BadILOp; }
TR::ILOpCodes TR::Method::indirectCallOpCode() { TR_UNIMPLEMENTED(); return TR::BadILOp; }
TR::DataType TR::Method::returnType() { TR_UNIMPLEMENTED(); return TR::NoType; }
bool TR::Method::returnTypeIsUnsigned() { TR_UNIMPLEMENTED(); return TR::NoType;}
uint32_t TR::Method::returnTypeWidth() { TR_UNIMPLEMENTED(); return 0; }
TR::ILOpCodes TR::Method::returnOpCode() { TR_UNIMPLEMENTED(); return TR::BadILOp; }
uint16_t TR::Method::classNameLength() { TR_UNIMPLEMENTED(); return 0; }
uint16_t TR::Method::nameLength() { TR_UNIMPLEMENTED(); return 0; }
uint16_t TR::Method::signatureLength() { TR_UNIMPLEMENTED(); return 0; }
char * TR::Method::classNameChars() { TR_UNIMPLEMENTED(); return 0; }
char * TR::Method::nameChars() { TR_UNIMPLEMENTED(); return 0; }
char * TR::Method::signatureChars() { TR_UNIMPLEMENTED(); return 0; }
bool TR::Method::isConstructor() { TR_UNIMPLEMENTED(); return false; }
bool TR::Method::isFinalInObject() { TR_UNIMPLEMENTED(); return false; }
const char * TR::Method::signature(TR_Memory *, TR_AllocationKind) { TR_UNIMPLEMENTED(); return 0; }
void TR::Method::setArchetypeSpecimen(bool b) { TR_UNIMPLEMENTED(); }

TR_MethodParameterIterator *
TR_Method::getParameterIterator(TR::Compilation&, TR_ResolvedMethod *)
TR::Method::getParameterIterator(TR::Compilation&, TR_ResolvedMethod *)
{
TR_UNIMPLEMENTED();
return 0;
}

bool
TR_Method::isBigDecimalMethod(TR::Compilation * comp)
TR::Method::isBigDecimalMethod(TR::Compilation * comp)
{
TR_UNIMPLEMENTED();
return false;
}

bool
TR_Method::isUnsafeCAS(TR::Compilation * comp)
TR::Method::isUnsafeCAS(TR::Compilation * comp)
{
TR_UNIMPLEMENTED();
return false;
}

bool
TR_Method::isUnsafeWithObjectArg(TR::Compilation * comp)
TR::Method::isUnsafeWithObjectArg(TR::Compilation * comp)
{
TR_UNIMPLEMENTED();
return false;
}

bool
TR_Method::isBigDecimalConvertersMethod(TR::Compilation * comp)
TR::Method::isBigDecimalConvertersMethod(TR::Compilation * comp)
{
TR_UNIMPLEMENTED();
return false;
}

TR_Method * TR_ResolvedMethod::convertToMethod() { TR_UNIMPLEMENTED(); return 0; }
TR::Method *TR_ResolvedMethod::convertToMethod() { TR_UNIMPLEMENTED(); return 0; }
uint32_t TR_ResolvedMethod::numberOfParameters() { TR_UNIMPLEMENTED(); return 0; }
uint32_t TR_ResolvedMethod::numberOfExplicitParameters() { TR_UNIMPLEMENTED(); return 0; }
TR::DataType TR_ResolvedMethod::parmType(uint32_t) { TR_UNIMPLEMENTED(); return TR::NoType; }
Expand Down
2 changes: 1 addition & 1 deletion compiler/compile/OMRCompilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ int32_t OMR::Compilation::compile()
TR::Node*node = tt->getNode()->getFirstChild();
if (node->getOpCode().isCall())
{
TR_Method *method = node->getSymbol()->getMethodSymbol()->getMethod();
TR::Method *method = node->getSymbol()->getMethodSymbol()->getMethod();
if (method)
{
TR_ByteCodeInfo &bcInfo = node->getByteCodeInfo();
Expand Down
3 changes: 3 additions & 0 deletions compiler/compile/OMRMethod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,7 @@ typedef struct TR_AOTMethodInfo
int32_t cpIndex;
} TR_AOTMethodInfo;


namespace TR { typedef ::TR_Method Method; }

#endif
2 changes: 1 addition & 1 deletion compiler/compile/ResolvedMethod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TR_ResolvedMethod
{
public:
TR::RecognizedMethod getRecognizedMethod() { return convertToMethod()->getRecognizedMethod(); }
virtual TR_Method *convertToMethod();
virtual TR::Method *convertToMethod();

virtual uint32_t numberOfParameters();
virtual uint32_t numberOfExplicitParameters(); // excludes receiver if any
Expand Down
2 changes: 1 addition & 1 deletion compiler/il/symbol/MethodSymbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OMR_EXTENSIBLE MethodSymbol : public OMR::MethodSymbolConnector

protected:

MethodSymbol(TR_LinkageConventions lc = TR_Private, TR_Method* m = NULL) :
MethodSymbol(TR_LinkageConventions lc = TR_Private, TR::Method *m = NULL) :
OMR::MethodSymbolConnector(lc, m) { }

private:
Expand Down
10 changes: 5 additions & 5 deletions compiler/il/symbol/OMRMethodSymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "il/symbol/MethodSymbol.hpp"
#include "infra/Flags.hpp"

OMR::MethodSymbol::MethodSymbol(TR_LinkageConventions lc, TR_Method * m) :
OMR::MethodSymbol::MethodSymbol(TR_LinkageConventions lc, TR::Method *m) :
TR::Symbol(),
_methodAddress(NULL),
_method(m),
Expand Down Expand Up @@ -61,12 +61,12 @@ OMR::MethodSymbol::isComputed()
* Method Symbol Factory.
*/
template <typename AllocatorType>
TR::MethodSymbol * OMR::MethodSymbol::create(AllocatorType t, TR_LinkageConventions lc, TR_Method * m)
TR::MethodSymbol * OMR::MethodSymbol::create(AllocatorType t, TR_LinkageConventions lc, TR::Method *m)
{
return new (t) TR::MethodSymbol(lc, m);
}

//Explicit instantiations
template TR::MethodSymbol * OMR::MethodSymbol::create(TR_HeapMemory t, TR_LinkageConventions lc, TR_Method * m);
template TR::MethodSymbol * OMR::MethodSymbol::create(TR_StackMemory t, TR_LinkageConventions lc, TR_Method * m);
template TR::MethodSymbol * OMR::MethodSymbol::create(PERSISTENT_NEW_DECLARE t, TR_LinkageConventions lc, TR_Method * m);
template TR::MethodSymbol * OMR::MethodSymbol::create(TR_HeapMemory t, TR_LinkageConventions lc, TR::Method *m);
template TR::MethodSymbol * OMR::MethodSymbol::create(TR_StackMemory t, TR_LinkageConventions lc, TR::Method *m);
template TR::MethodSymbol * OMR::MethodSymbol::create(PERSISTENT_NEW_DECLARE t, TR_LinkageConventions lc, TR::Method *m);
10 changes: 5 additions & 5 deletions compiler/il/symbol/OMRMethodSymbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ class OMR_EXTENSIBLE MethodSymbol : public TR::Symbol

protected:

MethodSymbol(TR_LinkageConventions lc = TR_Private, TR_Method * m = 0);
MethodSymbol(TR_LinkageConventions lc = TR_Private, TR::Method *m = 0);

public:

template <typename AllocatorType>
static TR::MethodSymbol * create(AllocatorType t, TR_LinkageConventions lc = TR_Private, TR_Method * m = 0);
static TR::MethodSymbol * create(AllocatorType t, TR_LinkageConventions lc = TR_Private, TR::Method *m = 0);

TR::MethodSymbol *self();

Expand All @@ -73,8 +73,8 @@ class OMR_EXTENSIBLE MethodSymbol : public TR::Symbol
TR_LinkageConventions getLinkageConvention() { return _linkageConvention; }
void setLinkage(TR_LinkageConventions lc) { _linkageConvention = lc; }

TR_Method * getMethod() { return _method; }
void setMethod(TR_Method * m) { _method = m; }
TR::Method *getMethod() { return _method; }
void setMethod(TR::Method *m) { _method = m; }

enum Kinds
{
Expand Down Expand Up @@ -200,7 +200,7 @@ class OMR_EXTENSIBLE MethodSymbol : public TR::Symbol

void * _methodAddress;

TR_Method * _method;
TR::Method * _method;

flags32_t _methodFlags;

Expand Down
6 changes: 3 additions & 3 deletions compiler/optimizer/CallInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ struct TR_CallTarget : public TR_Link<TR_CallTarget>
TR::TreeTop *callNodeTreeTop, \
TR::Node *parent, \
TR::Node *callNode, \
TR_Method * interfaceMethod, \
TR::Method * interfaceMethod, \
TR_OpaqueClassBlock *receiverClass, \
int32_t vftSlot, \
int32_t cpIndex, \
Expand Down Expand Up @@ -251,7 +251,7 @@ struct TR_CallSite : public TR_Link<TR_CallSite>
TR::TreeTop *callNodeTreeTop,
TR::Node *parent,
TR::Node *callNode,
TR_Method * interfaceMethod,
TR::Method * interfaceMethod,
TR_OpaqueClassBlock *receiverClass,
int32_t vftSlot,
int32_t cpIndex,
Expand Down Expand Up @@ -356,7 +356,7 @@ struct TR_CallSite : public TR_Link<TR_CallSite>
TR::Node * _callNode;

// Initial Information We Need to Calculate a CallTarget
TR_Method * _interfaceMethod; // If we have an interface, we'll only have a TR_Method until we determine others
TR::Method * _interfaceMethod; // If we have an interface, we'll only have a TR::Method until we determine others
TR_OpaqueClassBlock * _receiverClass; // for interface calls, we might know this?
int32_t _vftSlot; //
int32_t _cpIndex; //
Expand Down
3 changes: 2 additions & 1 deletion compiler/optimizer/DebuggingCounters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <stdint.h>
#include <stdio.h>
#include "compile/Method.hpp"
#include "env/TRMemory.hpp"
#include "env/jittypes.h"

Expand All @@ -47,7 +48,7 @@ struct CountedCallSite
int32_t frequency;
int32_t numLocals;
TR_OpaqueMethodBlock *opaque_method;
TR_Method *method;
TR::Method *method;
TR_ByteCodeInfo bcInfo;
CountedCallSite * _next;
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/Inliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5619,7 +5619,7 @@ TR_CallSite::TR_CallSite(TR_ResolvedMethod *callerResolvedMethod,
TR::TreeTop *callNodeTreeTop,
TR::Node *parent,
TR::Node *callNode,
TR_Method * interfaceMethod,
TR::Method *interfaceMethod,
TR_OpaqueClassBlock *receiverClass,
int32_t vftSlot,
int32_t cpIndex,
Expand Down
4 changes: 2 additions & 2 deletions compiler/optimizer/OMROptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ static const OptimizationStrategy ilgenStrategyOpts[] =
{ unsafeFastPath },
{ recognizedCallTransformer },
{ coldBlockMarker },
{ CFGSimplification },
{ CFGSimplification },
{ allocationSinking, IfNews },
{ invariantArgumentPreexistence, IfNotClassLoadPhaseAndNotProfiling }, // Should not run if a recompilation is possible
#endif
Expand Down Expand Up @@ -1172,7 +1172,7 @@ void OMR::Optimizer::dumpPostOptTrees()
// do nothing for IlGen optimizer
if (isIlGenOpt()) return;

TR_Method *method = comp()->getMethodSymbol()->getMethod();
TR::Method *method = comp()->getMethodSymbol()->getMethod();
if ((debug("dumpPostLocalOptTrees") || comp()->getOption(TR_TraceTrees)))
comp()->dumpMethodTrees("Post Optimization Trees");
}
Expand Down
10 changes: 5 additions & 5 deletions compiler/optimizer/UseDefInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ void TR_UseDefInfo::insertData(TR::Block *block, TR::Node *node,TR::Node *parent
}
TR::GlobalSparseBitVector *mustKill = NULL;
TR::Symbol *callSym = NULL;
TR_Method *callMethod = NULL;
TR::Method *callMethod = NULL;

TR::SparseBitVector::Cursor aliasesCursor(aliases);
for (aliasesCursor.SetToFirstOne(); aliasesCursor.Valid(); aliasesCursor.SetToNextOne())
Expand Down Expand Up @@ -1825,7 +1825,7 @@ void TR_UseDefInfo::processReachingDefinition(void* vblockInfo, AuxiliaryData &a

void TR_UseDefInfo::buildUseDefs(void *vblockInfo, AuxiliaryData &aux)
{
TR_Method *method = comp()->getMethodSymbol()->getMethod();
TR::Method *method = comp()->getMethodSymbol()->getMethod();
TR::Block *block;
TR::TreeTop *treeTop;
TR_ReachingDefinitions::ContainerType *analysisInfo = NULL;
Expand Down Expand Up @@ -1876,7 +1876,7 @@ void TR_UseDefInfo::buildUseDefs(void *vblockInfo, AuxiliaryData &aux)
}

int32_t i, ii;
TR_Method *method = comp()->getMethodSymbol()->getMethod();
TR::Method *method = comp()->getMethodSymbol()->getMethod();
TR_BitVectorIterator bvi(*analysisInfo);
while (bvi.hasMoreElements())
{
Expand Down Expand Up @@ -2272,7 +2272,7 @@ void TR_UseDefInfo::buildUseDefs(TR::Node *node, void *vanalysisInfo, TR_BitVect
buildUseDefs(node->getChild(i), analysisInfo, nodesToBeDereferenced, node, aux);
}

TR_Method *method = comp()->getMethodSymbol()->getMethod();
TR::Method *method = comp()->getMethodSymbol()->getMethod();
uint32_t nodeIndex = node->getUseDefIndex();
if (node->getOpCode().hasSymbolReference() &&
isTrivialUseDefNode(node, aux) )
Expand Down Expand Up @@ -2432,7 +2432,7 @@ void TR_UseDefInfo::buildUseDefs(TR::Node *node, void *vanalysisInfo, TR_BitVect
}
#endif

TR_Method *method = comp()->getMethodSymbol()->getMethod();
TR::Method *method = comp()->getMethodSymbol()->getMethod();

TR_BitVectorIterator cursor(*defs);
while (cursor.hasMoreElements())
Expand Down
8 changes: 4 additions & 4 deletions compiler/optimizer/VPHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5086,7 +5086,7 @@ static void devirtualizeCall(OMR::ValuePropagation *vp, TR::Node *node)

int32_t cpIndex = symRef->getCPIndex();

TR_Method * originalMethod = methodSymbol->getMethod();
TR::Method * originalMethod = methodSymbol->getMethod();
len = originalMethod->classNameLength();
s = classNameToSignature(originalMethod->classNameChars(), len, vp->comp());
originalMethodClass = vp->fe()->getClassFromSignature(s, len, owningMethod);
Expand Down Expand Up @@ -5361,7 +5361,7 @@ TR::Node *constrainCall(OMR::ValuePropagation *vp, TR::Node *node)
// some value in parsing the return type of the method
// being invoked to obtain better info about byte/bool/char/short
//
TR_Method *method = node->getSymbol()->castToMethodSymbol()->getMethod();
TR::Method *method = node->getSymbol()->castToMethodSymbol()->getMethod();
if (method)
{
TR::DataType dataType = method->returnType();
Expand Down Expand Up @@ -5583,7 +5583,7 @@ TR::Node *constrainCall(OMR::ValuePropagation *vp, TR::Node *node)
{
//FIXME: add me to the list of calls to be inlined
//
TR_Method *method = getHelpersSymRef->getSymbol()->castToMethodSymbol()->getMethod();
TR::Method *method = getHelpersSymRef->getSymbol()->castToMethodSymbol()->getMethod();
TR::Node *helpersCallNode = TR::Node::createWithSymRef( node, method->directCallOpCode(), 0, getHelpersSymRef);
TR::TreeTop *helpersCallTT = TR::TreeTop::create(vp->comp(), TR::Node::create(TR::treetop, 1, helpersCallNode));
vp->_curTree->insertBefore(helpersCallTT);
Expand Down Expand Up @@ -9788,7 +9788,7 @@ static TR::Node *constrainIfcmpeqne(OMR::ValuePropagation *vp, TR::Node *node, b
//The object's class can sometimes be less specific than the class of the call
//if we ask for a rammethod in such a class we would trigger an assert ("no ram method in the vft slot")
//to avoid this we would to insert another isInstanceOf (objectClass, callClass)
TR_Method* interfaceMethod = interfaceMethodSymbol->getMethod();
TR::Method *interfaceMethod = interfaceMethodSymbol->getMethod();
//re-using len and sig for getting a class of a call
len = interfaceMethod->classNameLength();
sig = classNameToSignature(interfaceMethod->classNameChars(), len, vp->comp());
Expand Down
4 changes: 2 additions & 2 deletions compiler/ras/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ TR_Debug::signature(TR::ResolvedMethodSymbol *s)
TR_OpaqueClassBlock *
TR_Debug::containingClass(TR::SymbolReference *symRef)
{
TR_Method *method = symRef->getSymbol()->castToMethodSymbol()->getMethod();
TR::Method *method = symRef->getSymbol()->castToMethodSymbol()->getMethod();

if (method)
{
Expand Down Expand Up @@ -1856,7 +1856,7 @@ TR_Debug::getParmName(TR::SymbolReference * symRef)
const char *
TR_Debug::getMethodName(TR::SymbolReference * symRef)
{
TR_Method * method = symRef->getSymbol()->castToMethodSymbol()->getMethod();
TR::Method *method = symRef->getSymbol()->castToMethodSymbol()->getMethod();

if (method==NULL)
{
Expand Down
6 changes: 3 additions & 3 deletions compiler/ras/Debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,11 @@ class TR_Debug
virtual int32_t * loadCustomStrategy(char *optFileName);
virtual bool methodCanBeCompiled(TR_Memory *mem, TR_ResolvedMethod *, TR_FilterBST * &);
virtual bool methodCanBeRelocated(TR_Memory *mem, TR_ResolvedMethod *, TR_FilterBST * &);
virtual bool methodSigCanBeCompiled(const char *, TR_FilterBST * & , TR_Method::Type methodType);
virtual bool methodSigCanBeCompiled(const char *, TR_FilterBST * & , TR::Method::Type methodType);
virtual bool methodSigCanBeRelocated(const char *, TR_FilterBST * & );
virtual bool methodSigCanBeCompiledOrRelocated(const char *, TR_FilterBST * &, bool isRelocation, TR_Method::Type methodType);
virtual bool methodSigCanBeCompiledOrRelocated(const char *, TR_FilterBST * &, bool isRelocation, TR::Method::Type methodType);
virtual bool methodCanBeFound(TR_Memory *, TR_ResolvedMethod *, TR::CompilationFilters *, TR_FilterBST * &);
virtual bool methodSigCanBeFound(const char *, TR::CompilationFilters *, TR_FilterBST * &, TR_Method::Type methodType);
virtual bool methodSigCanBeFound(const char *, TR::CompilationFilters *, TR_FilterBST * &, TR::Method::Type methodType);
virtual TR::CompilationFilters * getCompilationFilters() { return _compilationFilters; }
virtual TR::CompilationFilters * getRelocationFilters() { return _relocationFilters; }
virtual void clearFilters(TR::CompilationFilters *);
Expand Down
Loading

0 comments on commit 7c87422

Please sign in to comment.