Skip to content

Commit

Permalink
Simplify field names and remove unnecessary routine
Browse files Browse the repository at this point in the history
Perform the following cleanup:
- Rename explicitLinkageType to linkageType
- Add enum entries in OMR and remove magic constant
- Remove isOSLinkageType routine

Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
  • Loading branch information
dchopra001 committed Jan 13, 2021
1 parent d876abd commit 9a287b7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
8 changes: 8 additions & 0 deletions compiler/codegen/OMRLinkageConventions.enum
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@
TR_System,
TR_Helper,
TR_J9JNILinkage,
TR_SystemXPLink, // zOS XPLink convention

// zOS Type 1 linkages - all have bit 0x40 set
// zOS Type 1 linkage - C++ Fastlink
TR_SystemFastLink, // zOS (C++) FastLink convention

// Linux Platform Linkages
TR_SystemLinux,// = 60 // zLinux convention
20 changes: 6 additions & 14 deletions compiler/z/codegen/OMRLinkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extern bool storeHelperImmediateInstruction(TR::Node * valueChild, TR::CodeGener

OMR::Z::Linkage::Linkage(TR::CodeGenerator * codeGen)
: OMR::Linkage(codeGen),
_explicitLinkageType(TR_None), _stackSizeCheckNeeded(true), _raContextSaveNeeded(true),
_linkageType(TR_None), _stackSizeCheckNeeded(true), _raContextSaveNeeded(true),
_integerReturnRegister(TR::RealRegister::NoReg),
_floatReturnRegister(TR::RealRegister::NoReg),
_doubleReturnRegister(TR::RealRegister::NoReg),
Expand Down Expand Up @@ -135,9 +135,9 @@ OMR::Z::Linkage::Linkage(TR::CodeGenerator * codeGen)
* convention.
* Even though this method is common, its implementation is machine-specific.
*/
OMR::Z::Linkage::Linkage(TR::CodeGenerator * codeGen,TR_LinkageConventions elc)
OMR::Z::Linkage::Linkage(TR::CodeGenerator * codeGen,TR_LinkageConventions lc)
: OMR::Linkage(codeGen),
_explicitLinkageType(elc), _stackSizeCheckNeeded(true), _raContextSaveNeeded(true),
_linkageType(lc), _stackSizeCheckNeeded(true), _raContextSaveNeeded(true),
_integerReturnRegister(TR::RealRegister::NoReg),
_floatReturnRegister(TR::RealRegister::NoReg),
_doubleReturnRegister(TR::RealRegister::NoReg),
Expand Down Expand Up @@ -2837,30 +2837,22 @@ OMR::Z::Linkage::getLastMaskedBit(int16_t mask)
return TR::Linkage::getLastMaskedBit(mask , 0, 15);
}

bool
OMR::Z::Linkage::isOSLinkageType()
{
// #define TR_SystemOS_MASK 0x40
// zOS Type 1 linkages (non-Java) - all have bit 0x40 set
return (self()->getExplicitLinkageType() & 0x40) != 0;
}

bool
OMR::Z::Linkage::isXPLinkLinkageType()
{
return self()->getExplicitLinkageType() == TR_SystemXPLink;
return self()->getLinkageType() == TR_SystemXPLink;
}

bool
OMR::Z::Linkage::isFastLinkLinkageType()
{
return self()->getExplicitLinkageType() == TR_SystemFastLink;
return self()->getLinkageType() == TR_SystemFastLink;
}

bool
OMR::Z::Linkage::isZLinuxLinkageType()
{
return self()->getExplicitLinkageType() == TR_SystemLinux;
return self()->getLinkageType() == TR_SystemLinux;
}

TR::Register *
Expand Down
7 changes: 3 additions & 4 deletions compiler/z/codegen/OMRLinkage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ namespace Z
class OMR_EXTENSIBLE Linkage : public OMR::Linkage
{
private:
TR_LinkageConventions _explicitLinkageType;
TR_LinkageConventions _linkageType;
uint32_t _properties;
uint32_t _registerFlags[TR::RealRegister::NumRegisters];
uint8_t _numIntegerArgumentRegisters;
Expand Down Expand Up @@ -235,10 +235,9 @@ enum TR_DispatchType

Linkage(TR::CodeGenerator *, TR_LinkageConventions);

TR_LinkageConventions getExplicitLinkageType() { return _explicitLinkageType; }
void setExplicitLinkageType(TR_LinkageConventions lc ) { _explicitLinkageType = lc; }
TR_LinkageConventions getLinkageType() { return _linkageType; }
void setLinkageType(TR_LinkageConventions lc ) { _linkageType = lc; }

bool isOSLinkageType();
bool isXPLinkLinkageType();
bool isFastLinkLinkageType();

Expand Down
2 changes: 1 addition & 1 deletion compiler/z/codegen/SystemLinkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ TR::SystemLinkage::mapStack(TR::ResolvedMethodSymbol * method, uint32_t stackInd

setFPRSaveMask(FPRSaveMask);

if (FPRSaveMask != 0 && isOSLinkageType())
if (FPRSaveMask != 0)
{
#define DELTA_ALIGN(x, align) ((x & (align-1)) ? (align -((x)&(align-1))) : 0)
stackIndex -= DELTA_ALIGN(stackIndex, 16);
Expand Down

0 comments on commit 9a287b7

Please sign in to comment.