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

Add AOT Feature Flag for Transactional Memory #5748

Merged
merged 2 commits into from
May 16, 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
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