Skip to content

Commit

Permalink
Add AOT Feature Flag for Transactional Memory (#5748)
Browse files Browse the repository at this point in the history
Add AOT Feature Flag for Transactional Memory
  • Loading branch information
fjeremic authored May 16, 2019
2 parents bf1ab69 + 4b442e6 commit 17f8c89
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions runtime/compiler/control/CompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,7 @@ bool TR::CompilationInfo::shouldRetryCompilation(TR_MethodToBeCompiled *entry, T
case compilationAotValidateStringCompressionFailure:
case compilationSymbolValidationManagerFailure:
case compilationAOTNoSupportForAOTFailure:
case compilationAOTValidateTMFailure:
// switch to JIT for these cases (we don't want to relocate again)
entry->_doNotUseAotCodeFromSharedCache = true;
tryCompilingAgain = true;
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/control/rossa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ char *compilationErrorNames[]={
"compilationEnforceProfiling", //49
"compilationSymbolValidationManagerFailure", //50
"compilationAOTNoSupportForAOTFailure", //51
"compilationAOTValidateTMFailure", //52
"compilationMaxError"
};

Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/control/rossa.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ typedef enum {
compilationEnforceProfiling = 49,
compilationSymbolValidationManagerFailure = 50,
compilationAOTNoSupportForAOTFailure = 51,
compilationAOTValidateTMFailure = 52,
/* please insert new codes before compilationMaxError which is used in jar2jxe to test the error codes range */
/* If new codes are added then add the corresponding names in compilationErrorNames table in rossa.cpp */
compilationMaxError /* must be the last one */
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/runtime/J9Runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ typedef struct TR_AOTMethodHeader {
#define TR_AOTMethodHeader_UsesEnableStringCompressionFolding 0x00000008
#define TR_AOTMethodHeader_StringCompressionEnabled 0x00000010
#define TR_AOTMethodHeader_UsesSymbolValidationManager 0x00000020
#define TR_AOTMethodHeader_TMDisabled 0x00000040



Expand Down
5 changes: 5 additions & 0 deletions runtime/compiler/runtime/MetaData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1523,6 +1523,11 @@ createMethodMetaData(
aotMethodHeaderEntry->flags |= TR_AOTMethodHeader_IsNotCapableOfMethodEnterTracing;
}

if (comp->getOption(TR_DisableTM))
{
aotMethodHeaderEntry->flags |= TR_AOTMethodHeader_TMDisabled;
}

// totalAllocated space is in comp object
TR_ASSERT(comp->getTotalNeededDataCacheSpace() == aotMethodHeaderEntry->compileMethodDataSize, "Size missmatach");
}
Expand Down
18 changes: 18 additions & 0 deletions runtime/compiler/runtime/RelocationRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ TR_RelocationRuntime::prepareRelocateAOTCodeAndData(J9VMThread* vmThread,
comp->setOption(TR_UseSymbolValidationManager);
}

if ((_aotMethodHeaderEntry->flags & TR_AOTMethodHeader_TMDisabled) && !comp->getOption(TR_DisableTM))
{
setReturnCode(compilationAOTValidateTMFailure);
return NULL;
}

_exceptionTableCacheEntry = (J9JITDataCacheHeader *)((uint8_t *)cacheEntry + _aotMethodHeaderEntry->offsetToExceptionTable);

if (_exceptionTableCacheEntry->type == J9_JIT_DCE_EXCEPTION_INFO)
Expand Down Expand Up @@ -936,6 +942,8 @@ TR_SharedCacheRelocationRuntime::checkAOTHeaderFlags(TR_FrontEnd *fe, TR_AOTHead
defaultMessage = generateError("AOT header validation failed: Concurrent Scavenge feature mismatch.");
if ((featureFlags & TR_FeatureFlag_SoftwareReadBarrier) != (hdrInCache->featureFlags & TR_FeatureFlag_SoftwareReadBarrier))
defaultMessage = generateError("AOT header validation failed: Software Read Barrier feature mismatch.");
if ((featureFlags & TR_FeatureFlag_UsesTM) != (hdrInCache->featureFlags & TR_FeatureFlag_UsesTM))
defaultMessage = generateError("AOT header validation failed: TM feature mismatch.");

if ((featureFlags & TR_FeatureFlag_SanityCheckEnd) != (hdrInCache->featureFlags & TR_FeatureFlag_SanityCheckEnd))
defaultMessage = generateError("AOT header validation failed: Trailing sanity bit mismatch.");
Expand Down Expand Up @@ -1283,6 +1291,16 @@ TR_SharedCacheRelocationRuntime::generateFeatureFlags(TR_FrontEnd *fe)
if (fej9->isAsyncCompilation())
featureFlags |= TR_FeatureFlag_AsyncCompilation;


if (!TR::Options::getCmdLineOptions()->getOption(TR_DisableTM) &&
!TR::Options::getAOTCmdLineOptions()->getOption(TR_DisableTM))
{
if (TR::Compiler->target.cpu.supportsTransactionalMemoryInstructions())
{
featureFlags |= TR_FeatureFlag_UsesTM;
}
}

return featureFlags;
}

Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/runtime/RelocationRuntime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ typedef enum TR_AOTFeatureFlags
TR_FeatureFlag_AsyncCompilation = 0x00000400, //async compilation - switch to interpreter code NOT generated
TR_FeatureFlag_ConcurrentScavenge = 0x00000800,
TR_FeatureFlag_SoftwareReadBarrier = 0x00001000,
TR_FeatureFlag_UsesTM = 0x00002000,
TR_FeatureFlag_SanityCheckEnd = 0x80000000
} TR_AOTFeatureFlags;

Expand Down

0 comments on commit 17f8c89

Please sign in to comment.