Skip to content

Commit 1fd1fc0

Browse files
committed
Fast-Path String and Vector Hash Code Methods on Power
Fast-path ArraysSupport.vectorizedHashCode and String.hashCodeImplCompressed methods on Power. The String.hashCodeImplDecompressed method has already been fast-pathed. Since the other methods use the same logic, the existing code can be modified to recognise and accomodate them. Signed-off-by: Luke Li <[email protected]>
1 parent cd6a33d commit 1fd1fc0

File tree

3 files changed

+789
-245
lines changed

3 files changed

+789
-245
lines changed

runtime/compiler/optimizer/InlinerTempForJ9.cpp

+4-14
Original file line numberDiff line numberDiff line change
@@ -5592,26 +5592,16 @@ TR_J9InlinerPolicy::supressInliningRecognizedInitialCallee(TR_CallSite* callsite
55925592
return false;
55935593
}
55945594
case TR::java_lang_String_hashCodeImplDecompressed:
5595-
/*
5596-
* X86 and z want to avoid inlining both java_lang_String_hashCodeImplDecompressed and java_lang_String_hashCodeImplCompressed
5597-
* so they can be recognized and replaced with a custom fast implementation.
5598-
* Power currently only has the custom fast implementation for java_lang_String_hashCodeImplDecompressed.
5599-
* As a result, Power only wants to prevent inlining of java_lang_String_hashCodeImplDecompressed.
5600-
* When Power gets a fast implementation of TR::java_lang_String_hashCodeImplCompressed, this case can be merged into the case
5601-
* for java_lang_String_hashCodeImplCompressed instead of using a fallthrough.
5602-
*/
5603-
if (!TR::Compiler->om.canGenerateArraylets() && !TR::Compiler->om.isOffHeapAllocationEnabled() &&
5604-
comp->target().cpu.isPower() && comp->target().cpu.isAtLeast(OMR_PROCESSOR_PPC_P8) && comp->target().cpu.supportsFeature(OMR_FEATURE_PPC_HAS_VSX) && !comp->compileRelocatableCode())
5605-
{
5606-
return true;
5607-
}
5608-
// Intentional fallthrough here.
56095595
case TR::java_lang_String_hashCodeImplCompressed:
5596+
// X86, Z and Power have custom fast implementations for these 2 methods
5597+
// so their inlining should be avoided.
5598+
{
56105599
if (comp->cg()->getSupportsInlineStringHashCode())
56115600
{
56125601
return true;
56135602
}
56145603
break;
5604+
}
56155605
case TR::jdk_internal_util_ArraysSupport_vectorizedHashCode:
56165606
{
56175607
if (comp->cg()->getSupportsInlineVectorizedHashCode())

runtime/compiler/p/codegen/J9CodeGenerator.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ J9::Power::CodeGenerator::initialize()
123123
if (!comp->getOption(TR_DisableReadMonitors))
124124
cg->setSupportsReadOnlyLocks();
125125

126+
if (!TR::Compiler->om.canGenerateArraylets()
127+
&& !TR::Compiler->om.isOffHeapAllocationEnabled()
128+
&& comp->target().cpu.isAtLeast(OMR_PROCESSOR_PPC_P8)
129+
&& comp->target().cpu.supportsFeature(OMR_FEATURE_PPC_HAS_VSX)
130+
)
131+
{
132+
cg->setSupportsInlineStringHashCode();
133+
cg->setSupportsInlineVectorizedHashCode();
134+
}
135+
126136
static bool disableTLHPrefetch = (feGetEnv("TR_DisableTLHPrefetch") != NULL);
127137

128138
// Enable software prefetch of the TLH and configure the TLH prefetching

0 commit comments

Comments
 (0)