Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify processor detection on Z #3956

Merged
merged 5 commits into from
Jan 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
241 changes: 94 additions & 147 deletions runtime/compiler/env/ProcessorDetection.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corp. and others
* Copyright (c) 2000, 2019 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 @@ -448,114 +448,6 @@ portLibCall_getARMProcessorType()
return tp;
}

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


#if defined(TR_TARGET_S390)
int32_t TR_J9VMBase::getS390MachineName(TR_S390MachineType machineType, char* processorName, int32_t stringLength)
{
int32_t returnValue = -1;
switch(machineType)
{
case TR_FREEWAY:
returnValue = snprintf(processorName, stringLength, "z900 (%d)", machineType);
break;

case TR_Z800:
returnValue = snprintf(processorName, stringLength, "z800 (%d)", machineType);
break;

// zPDT
case TR_MIRAGE:
case TR_MIRAGE2:
returnValue = snprintf(processorName, stringLength, "zPDT (%d)", machineType);
break;

case TR_TREX:
returnValue = snprintf(processorName, stringLength, "z990 (%d)", machineType);
break;

case TR_Z890:
returnValue = snprintf(processorName, stringLength, "z890 (%d)", machineType);
break;

case TR_GOLDEN_EAGLE:
//case TR_DANU_GA2: // TR_DANU_GA2 has same model code as TR_GOLDEN_EAGLE
returnValue = snprintf(processorName, stringLength, "z9 (%d)", machineType);
break;

case TR_Z9BC:
returnValue = snprintf(processorName, stringLength, "z9BC (%d)", machineType);
break;

case TR_Z10:
returnValue = snprintf(processorName, stringLength, "z10 (%d)", machineType);
break;

case TR_Z10BC:
returnValue = snprintf(processorName, stringLength, "z10BC (%d)", machineType);
break;

case TR_ZG:
returnValue = snprintf(processorName, stringLength, "z196 (%d)", machineType);
break;

case TR_ZGMR:
returnValue = snprintf(processorName, stringLength, "z114 (%d)", machineType);
break;

case TR_ZEC12:
returnValue = snprintf(processorName, stringLength, "zEC12 (%d)", machineType);
break;

case TR_ZEC12MR:
returnValue = snprintf(processorName, stringLength, "zBC12 (%d)", machineType);
break;

case TR_Z13:
returnValue = snprintf(processorName, stringLength, "z13 (%d)", machineType);
break;

case TR_Z13s:
returnValue = snprintf(processorName, stringLength, "z13s (%d)", machineType);
break;

case TR_Z14:
returnValue = snprintf(processorName, stringLength, "z14 (%d)", machineType);
break;

case TR_Z14s:
returnValue = snprintf(processorName, stringLength, "z14s (%d)", machineType);
break;

case TR_ZNEXT:
returnValue = snprintf(processorName, stringLength, "zNext (%d)", machineType);
break;

case TR_ZNEXTs:
returnValue = snprintf(processorName, stringLength, "zNexts (%d)", machineType);
break;

// Miscellaneous machine codes we were given. Simply print out the model number.
case TR_ZG_RESERVE:
case TR_ZEC12_RESERVE:
case TR_ZH:
case TR_DATAPOWER:
case TR_ZH_RESERVE1:
case TR_ZH_RESERVE2:
default:
returnValue = snprintf(processorName, stringLength, "(%d)", machineType);
break;
}

return returnValue;
}

#endif // TR_TARGET_S390


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

TR_Processor
TR_J9VMBase::getPPCProcessorType()
{
Expand Down Expand Up @@ -771,14 +663,94 @@ int32_t TR_J9VM::getCompInfo(char *processorName, int32_t stringLength)
#if defined(TR_TARGET_S390)
joransiu marked this conversation as resolved.
Show resolved Hide resolved
if (TR::Compiler->target.cpu.isZ())
{
if(TR::Compiler->target.isZOS())
{
returnValue = getS390MachineName(TR::Compiler->target.cpu.TO_PORTLIB_get390zOSMachineType(), processorName, stringLength);
}
else
int32_t machineId = TR::Compiler->target.cpu.TO_PORTLIB_get390MachineId();

switch (machineId)
{
returnValue = getS390MachineName(TR::Compiler->target.cpu.TO_PORTLIB_get390zLinuxMachineType(), processorName, stringLength);
case TR_FREEWAY:
returnValue = snprintf(processorName, stringLength, "z900 (%d)", machineId);
break;

case TR_Z800:
returnValue = snprintf(processorName, stringLength, "z800 (%d)", machineId);
break;

// zPDT
case TR_MIRAGE:
case TR_MIRAGE2:
returnValue = snprintf(processorName, stringLength, "zPDT (%d)", machineId);
break;

case TR_TREX:
returnValue = snprintf(processorName, stringLength, "z990 (%d)", machineId);
break;

case TR_Z890:
returnValue = snprintf(processorName, stringLength, "z890 (%d)", machineId);
break;

case TR_GOLDEN_EAGLE:
returnValue = snprintf(processorName, stringLength, "z9 (%d)", machineId);
break;

case TR_Z9BC:
returnValue = snprintf(processorName, stringLength, "z9BC (%d)", machineId);
break;

case TR_Z10:
returnValue = snprintf(processorName, stringLength, "z10 (%d)", machineId);
break;

case TR_Z10BC:
returnValue = snprintf(processorName, stringLength, "z10BC (%d)", machineId);
break;

case TR_ZG:
returnValue = snprintf(processorName, stringLength, "z196 (%d)", machineId);
break;

case TR_ZGMR:
returnValue = snprintf(processorName, stringLength, "z114 (%d)", machineId);
break;

case TR_ZEC12:
returnValue = snprintf(processorName, stringLength, "zEC12 (%d)", machineId);
break;

case TR_ZEC12MR:
returnValue = snprintf(processorName, stringLength, "zBC12 (%d)", machineId);
break;

case TR_Z13:
returnValue = snprintf(processorName, stringLength, "z13 (%d)", machineId);
break;

case TR_Z13s:
returnValue = snprintf(processorName, stringLength, "z13s (%d)", machineId);
break;

case TR_Z14:
returnValue = snprintf(processorName, stringLength, "z14 (%d)", machineId);
break;

case TR_Z14s:
returnValue = snprintf(processorName, stringLength, "z14s (%d)", machineId);
fjeremic marked this conversation as resolved.
Show resolved Hide resolved
break;

case TR_ZNEXT:
returnValue = snprintf(processorName, stringLength, "zNext (%d)", machineId);
break;

case TR_ZNEXTs:
returnValue = snprintf(processorName, stringLength, "zNexts (%d)", machineId);
break;

default:
// Unknown machine id, simply print out the machine model number
returnValue = snprintf(processorName, stringLength, "(%d)", machineId);
break;
}

return returnValue;
}
#endif
Expand Down Expand Up @@ -842,23 +814,15 @@ TR_J9VM::initializeProcessorType()

if (TR::Compiler->target.cpu.isZ())
{
#if defined(TR_HOST_S390)
if (TR::Compiler->target.isLinux())
{
TR::Compiler->target.cpu.setS390MachineType(TR::Compiler->target.cpu.TO_PORTLIB_get390zLinuxMachineType());
initializeS390zLinuxProcessorFeatures();
}
else
{
TR::Compiler->target.cpu.setS390MachineType(TR::Compiler->target.cpu.TO_PORTLIB_get390zOSMachineType());
initializeS390zOSProcessorFeatures();
#if defined(TR_HOST_S390)
initializeS390ProcessorFeatures();

#if defined(J9ZOS390)
// Cache whether current process is running in Supervisor State (i.e. Control Region of WAS).
if (!_isPSWInProblemState())
_compInfo->setIsInZOSSupervisorState();
#endif
}
#endif
#endif

#ifdef TR_TARGET_S390
// For AOT shared classes cache processor compatibility purposes, the following
Expand Down Expand Up @@ -955,30 +919,13 @@ TR_J9VM::initializeProcessorType()

#if defined(TR_TARGET_S390)
void
TR_J9VMBase::initializeS390zLinuxProcessorFeatures()
{
TR_ASSERT(TR::Compiler->target.cpu.isZ() && TR::Compiler->target.isLinux(), "Only valid for s390/zLinux\n");
TR::Compiler->target.cpu.initializeS390zLinuxProcessorFeatures();
}


void
TR_J9VMBase::initializeS390zOSProcessorFeatures()
{
TR_ASSERT(TR::Compiler->target.cpu.isZ() && TR::Compiler->target.isZOS(), "Only valid for s390/zOS\n");
TR::Compiler->target.cpu.initializeS390zOSProcessorFeatures();
}


void
TR_J9SharedCacheVM::initializeS390zLinuxProcessorFeatures()
TR_J9VMBase::initializeS390ProcessorFeatures()
{
return;
TR::Compiler->target.cpu.initializeS390ProcessorFeatures();
}


void
TR_J9SharedCacheVM::initializeS390zOSProcessorFeatures()
TR_J9SharedCacheVM::initializeS390ProcessorFeatures()
{
return;
}
Expand Down
11 changes: 2 additions & 9 deletions runtime/compiler/env/VMJ9.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ class TR_J9VMBase : public TR_FrontEnd
virtual bool canUseSymbolValidationManager() { return false; }

#if defined(TR_TARGET_S390)
virtual void initializeS390zLinuxProcessorFeatures();
virtual void initializeS390zOSProcessorFeatures();
virtual void initializeS390ProcessorFeatures();
#endif

/////
Expand Down Expand Up @@ -1005,11 +1004,6 @@ class TR_J9VMBase : public TR_FrontEnd
virtual void *getLocationOfClassLoaderObjectPointer(TR_OpaqueClassBlock *classPointer);
virtual bool isMethodBreakpointed(TR_OpaqueMethodBlock *method);

protected:
#if defined(TR_TARGET_S390)
int32_t getS390MachineName(TR_S390MachineType machine, char* processorName, int32_t stringLength);
#endif

private:
#if !defined(HINTS_IN_SHAREDCACHE_OBJECT)
uint32_t getSharedCacheHint(J9VMThread * vmThread, J9Method *romMethod, J9SharedClassConfig * scConfig);
Expand Down Expand Up @@ -1149,8 +1143,7 @@ class TR_J9SharedCacheVM : public TR_J9VM
virtual TR_OpaqueMethodBlock *getResolvedInterfaceMethod(TR_OpaqueMethodBlock *ownerMethod, TR_OpaqueClassBlock * classObject, int32_t cpIndex);

#if defined(TR_TARGET_S390)
virtual void initializeS390zLinuxProcessorFeatures();
virtual void initializeS390zOSProcessorFeatures();
virtual void initializeS390ProcessorFeatures();
#endif

virtual int32_t getJavaLangClassHashCode(TR::Compilation * comp, TR_OpaqueClassBlock * clazzPointer, bool &hashCodeComputed);
Expand Down
3 changes: 0 additions & 3 deletions runtime/compiler/ras/DebugExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2289,9 +2289,6 @@ void TR_DebugExt::dxPrintCompilationInfo(TR::CompilationInfo *remoteCompInfo)
_dbgPrintf("bool _compBudgetSupport = %s\n", localCompInfo->_compBudgetSupport ? "true" : "false");
_dbgPrintf("bool _rampDownMCT = %s\n", localCompInfo->_rampDownMCT ? "true" : "false");
_dbgPrintf("flags32_t _flags = %u\n", localCompInfo->_flags.getValue());
#ifdef TR_TARGET_S390
_dbgPrintf("TR_S390MachineType _s390MachineType = %d\n", TR::Compiler->target.cpu.getS390MachineType());
joransiu marked this conversation as resolved.
Show resolved Hide resolved
#endif
#ifdef DEBUG
_dbgPrintf("bool _traceCompiling = %s\n", localCompInfo->_traceCompiling ? "true" : "false");
#endif
Expand Down
Loading