Skip to content

Commit

Permalink
AArch64: Fix String.hashCode() implementation
Browse files Browse the repository at this point in the history
This commit fixes `inlineStringHashCode` so that `savedLengthReg` is
copied to `lengthReg` when the reference count of`lengthNode` is > 1.

Signed-off-by: Akira Saitoh <[email protected]>
  • Loading branch information
Akira Saitoh committed Nov 22, 2023
1 parent d5e17dd commit 38f5e41
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6097,6 +6097,12 @@ static TR::Register *inlineStringHashCode(TR::Node *node, bool isCompressed, TR:
TR_ARM64ScratchRegisterManager *srm = cg->generateScratchRegisterManager(12);
TR::Register *dataAddrReg = (arrayNode->getReferenceCount() > 1) ? srm->findOrCreateScratchRegister() : arrayReg;
TR::Register *lengthReg = (lengthNode->getReferenceCount() > 1) ? srm->findOrCreateScratchRegister() : savedLengthReg;

if (lengthNode->getReferenceCount() > 1)
{
generateMovInstruction(cg, node, lengthReg, savedLengthReg, false);
}

TR::Compilation *comp = cg->comp();
if (comp->getOptions()->enableDebugCounters())
{
Expand Down

0 comments on commit 38f5e41

Please sign in to comment.