Skip to content

Commit 47fd184

Browse files
committed
Disable TLH prefetching for portable AOT code
Current code for x86 disables TLH prefething globally for Intel CPUs newer than Broadwell architecture and enables it globally for Broadwell or older CPUs. If a container image is generated on a newer architecture, then TLH prefetch will be off and this information is written into the AOT header for the shared class cache embedded in the container. If that container image is run on an older architecture, the JVM will set TLH prefetch off, and the AOT compatibility check will fail, rendering the embedded AOT code useless. This commit disables TLH prefething for portable AOT code. Signed-off-by: Marius Pirvu <[email protected]>
1 parent fb38bda commit 47fd184

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

runtime/compiler/control/J9Options.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,15 +2179,21 @@ void J9::Options::preProcessTLHPrefetch(J9JavaVM *vm)
21792179
#elif defined(TR_HOST_ARM64)
21802180
preferTLHPrefetch = true;
21812181
#else // TR_HOST_X86
2182-
preferTLHPrefetch =
2183-
(TR::Compiler->target.cpu.isGenuineIntel() &&
2184-
TR::Compiler->target.cpu.isAtMost(OMR_PROCESSOR_X86_INTEL_BROADWELL)) ||
2185-
!TR::Compiler->target.cpu.isGenuineIntel();
2182+
preferTLHPrefetch = !TR::Compiler->target.cpu.isGenuineIntel() ||
2183+
TR::Compiler->target.cpu.isAtMost(OMR_PROCESSOR_X86_INTEL_BROADWELL);
21862184

21872185
// Disable TM on x86 because we cannot tell whether a Haswell chip supports
21882186
// TM or not, plus it's killing the performance on dayTrader3
21892187
self()->setOption(TR_DisableTM);
21902188
#endif
2189+
// For portable AOT code we want to disable TLH prefetch
2190+
if (preferTLHPrefetch &&
2191+
J9_ARE_ANY_BITS_SET(vm->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_ENABLE_PORTABLE_SHARED_CACHE) &&
2192+
self() == TR::Options::getAOTCmdLineOptions()
2193+
)
2194+
{
2195+
preferTLHPrefetch = false;
2196+
}
21912197

21922198
IDATA notlhPrefetch = FIND_ARG_IN_VMARGS(EXACT_MATCH, J9::Options::_externalOptionStrings[J9::ExternalOptions::XnotlhPrefetch], 0);
21932199
IDATA tlhPrefetch = FIND_ARG_IN_VMARGS(EXACT_MATCH, J9::Options::_externalOptionStrings[J9::ExternalOptions::XtlhPrefetch], 0);

runtime/compiler/runtime/RelocationRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ TR_RelocationRuntime::generateFeatureFlags(TR_FrontEnd *fe)
938938
if (TR::Options::getCmdLineOptions()->getOption(TR_DisableTraps))
939939
featureFlags |= TR_FeatureFlag_DisableTraps;
940940

941-
if (TR::Options::getCmdLineOptions()->getOption(TR_TLHPrefetch))
941+
if (TR::Options::getAOTCmdLineOptions()->getOption(TR_TLHPrefetch))
942942
featureFlags |= TR_FeatureFlag_TLHPrefetch;
943943

944944
if (TR::CodeCacheManager::instance()->codeCacheConfig().needsMethodTrampolines())

0 commit comments

Comments
 (0)