Skip to content

Commit

Permalink
Merge pull request eclipse-openj9#20280 from knn-k/removeStringCompress
Browse files Browse the repository at this point in the history
Remove evaluators for String.compress() and some other methods
  • Loading branch information
hzongaro authored Oct 8, 2024
2 parents 4232598 + 7a9983f commit 8357d17
Show file tree
Hide file tree
Showing 20 changed files with 0 additions and 1,657 deletions.
1 change: 0 additions & 1 deletion runtime/compiler/build/files/host/amd64.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0

JIT_PRODUCT_SOURCE_FILES+=\
compiler/x/amd64/runtime/AMD64CompressString.nasm \
compiler/x/amd64/runtime/AMD64Recompilation.nasm
1 change: 0 additions & 1 deletion runtime/compiler/build/files/host/i386.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@

JIT_PRODUCT_SOURCE_FILES+=\
compiler/x/i386/runtime/IA32Recompilation.nasm \
compiler/x/i386/runtime/J9IA32CompressString.nasm \
compiler/x/i386/runtime/J9IA32Math64.nasm

1 change: 0 additions & 1 deletion runtime/compiler/build/files/host/p.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ JIT_PRODUCT_SOURCE_FILES+=\
compiler/p/runtime/J9PPCArrayTranslate.spp \
compiler/p/runtime/J9PPCCRC32.spp \
compiler/p/runtime/J9PPCCRC32_wrapper.c \
compiler/p/runtime/J9PPCCompressString.spp \
compiler/p/runtime/J9PPCEncodeUTF16.spp \
compiler/p/runtime/Math.spp \
compiler/p/runtime/PPCHWProfiler.cpp \
Expand Down
3 changes: 0 additions & 3 deletions runtime/compiler/codegen/J9RecognizedMethodsEnum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@
java_lang_String_equalsIgnoreCase,
java_lang_String_encodeASCII,
java_lang_String_compareToIgnoreCase,
java_lang_String_compress,
java_lang_String_andOR,
java_lang_String_compressNoCheck,
java_lang_String_unsafeCharAt,
java_lang_String_split_str_int,
java_lang_String_getChars_charArray,
Expand Down
3 changes: 0 additions & 3 deletions runtime/compiler/env/j9method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2781,9 +2781,6 @@ void TR_ResolvedJ9Method::construct()
{ TR::java_lang_String_regionMatchesInternal, 21, "regionMatchesInternal", (int16_t)-1, "*"},
{x(TR::java_lang_String_equalsIgnoreCase, "equalsIgnoreCase", "(Ljava/lang/String;)Z")},
{x(TR::java_lang_String_compareToIgnoreCase, "compareToIgnoreCase", "(Ljava/lang/String;)I")},
{x(TR::java_lang_String_compress, "compress", "([C[BII)I")},
{x(TR::java_lang_String_compressNoCheck, "compressNoCheck", "([C[BII)V")},
{x(TR::java_lang_String_andOR, "andOR", "([CII)I")},
{x(TR::java_lang_String_unsafeCharAt, "unsafeCharAt", "(I)C")},
{x(TR::java_lang_String_split_str_int, "split", "(Ljava/lang/String;I)[Ljava/lang/String;")},
{x(TR::java_lang_String_getChars_charArray, "getChars", "(II[CI)V")},
Expand Down
203 changes: 0 additions & 203 deletions runtime/compiler/p/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9678,195 +9678,6 @@ static TR::Register *inlineAtomicOperation(TR::Node *node, TR::CodeGenerator *cg
return resultReg;
}

static TR::Register *compressStringEvaluator(TR::Node *node, TR::CodeGenerator *cg, bool japaneseMethod)
{
TR_J9VMBase *fej9 = (TR_J9VMBase *) (cg->comp()->fe());
TR::Node *srcObjNode, *dstObjNode, *startNode, *lengthNode;
TR::Register *srcObjReg = NULL, *dstObjReg = NULL, *lengthReg = NULL, *startReg = NULL;

srcObjNode = node->getChild(0);
dstObjNode = node->getChild(1);
startNode = node->getChild(2);
lengthNode = node->getChild(3);

bool stopUsingCopyReg1, stopUsingCopyReg2, stopUsingCopyReg3, stopUsingCopyReg4;

stopUsingCopyReg1 = TR::TreeEvaluator::stopUsingCopyReg(srcObjNode, srcObjReg, cg);
stopUsingCopyReg2 = TR::TreeEvaluator::stopUsingCopyReg(dstObjNode, dstObjReg, cg);
stopUsingCopyReg3 = TR::TreeEvaluator::stopUsingCopyReg(startNode, startReg, cg);
stopUsingCopyReg4 = TR::TreeEvaluator::stopUsingCopyReg(lengthNode, lengthReg, cg);

uintptr_t hdrSize = TR::Compiler->om.contiguousArrayHeaderSizeInBytes();
generateTrg1Src1ImmInstruction(cg, TR::InstOpCode::addi, node, srcObjReg, srcObjReg, hdrSize);
generateTrg1Src1ImmInstruction(cg, TR::InstOpCode::addi, node, dstObjReg, dstObjReg, hdrSize);

TR::RegisterDependencyConditions *conditions = new (cg->trHeapMemory()) TR::RegisterDependencyConditions(12, 12, cg->trMemory());
TR::Register *cndRegister = cg->allocateRegister(TR_CCR);
TR::Register *resultReg = cg->allocateRegister(TR_GPR);
TR::addDependency(conditions, cndRegister, TR::RealRegister::cr0, TR_CCR, cg);
TR::addDependency(conditions, lengthReg, TR::RealRegister::gr8, TR_GPR, cg);
TR::addDependency(conditions, startReg, TR::RealRegister::gr7, TR_GPR, cg);
TR::addDependency(conditions, srcObjReg, TR::RealRegister::gr9, TR_GPR, cg);
TR::addDependency(conditions, dstObjReg, TR::RealRegister::gr10, TR_GPR, cg);

TR::addDependency(conditions, NULL, TR::RealRegister::gr0, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr11, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr6, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr4, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr5, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr12, TR_GPR, cg);
TR::addDependency(conditions, resultReg, TR::RealRegister::gr3, TR_GPR, cg);

if (japaneseMethod)
TR::TreeEvaluator::generateHelperBranchAndLinkInstruction(TR_PPCcompressStringJ, node, conditions, cg);
else
TR::TreeEvaluator::generateHelperBranchAndLinkInstruction(TR_PPCcompressString, node, conditions, cg);

TR::Register* regs[5] =
{
lengthReg, startReg, srcObjReg, dstObjReg, resultReg
};
conditions->stopUsingDepRegs(cg, 5, regs);
for (uint16_t i = 0; i < node->getNumChildren(); i++)
cg->decReferenceCount(node->getChild(i));
if (stopUsingCopyReg1)
cg->stopUsingRegister(srcObjReg);
if (stopUsingCopyReg2)
cg->stopUsingRegister(dstObjReg);
if (stopUsingCopyReg3)
cg->stopUsingRegister(startReg);
if (stopUsingCopyReg4)
cg->stopUsingRegister(lengthReg);

node->setRegister(resultReg);

cg->machine()->setLinkRegisterKilled(true);
cg->setHasCall();
return (resultReg);
}

static TR::Register *compressStringNoCheckEvaluator(TR::Node *node, TR::CodeGenerator *cg, bool japaneseMethod)
{
TR_J9VMBase *fej9 = (TR_J9VMBase *) (cg->comp()->fe());
TR::Node *srcObjNode, *dstObjNode, *startNode, *lengthNode;
TR::Register *srcObjReg = NULL, *dstObjReg = NULL, *lengthReg = NULL, *startReg = NULL;

srcObjNode = node->getChild(0);
dstObjNode = node->getChild(1);
startNode = node->getChild(2);
lengthNode = node->getChild(3);

bool stopUsingCopyReg1, stopUsingCopyReg2, stopUsingCopyReg3, stopUsingCopyReg4;

stopUsingCopyReg1 = TR::TreeEvaluator::stopUsingCopyReg(srcObjNode, srcObjReg, cg);
stopUsingCopyReg2 = TR::TreeEvaluator::stopUsingCopyReg(dstObjNode, dstObjReg, cg);
stopUsingCopyReg3 = TR::TreeEvaluator::stopUsingCopyReg(startNode, startReg, cg);
stopUsingCopyReg4 = TR::TreeEvaluator::stopUsingCopyReg(lengthNode, lengthReg, cg);

uintptr_t hdrSize = TR::Compiler->om.contiguousArrayHeaderSizeInBytes();
generateTrg1Src1ImmInstruction(cg, TR::InstOpCode::addi, node, srcObjReg, srcObjReg, hdrSize);
generateTrg1Src1ImmInstruction(cg, TR::InstOpCode::addi, node, dstObjReg, dstObjReg, hdrSize);

int numOfRegs = japaneseMethod ? 11 : 12;
TR::RegisterDependencyConditions *conditions = new (cg->trHeapMemory()) TR::RegisterDependencyConditions(numOfRegs, numOfRegs, cg->trMemory());
TR::Register *cndRegister = cg->allocateRegister(TR_CCR);
TR::addDependency(conditions, cndRegister, TR::RealRegister::cr0, TR_CCR, cg);
TR::addDependency(conditions, lengthReg, TR::RealRegister::gr8, TR_GPR, cg);
TR::addDependency(conditions, startReg, TR::RealRegister::gr7, TR_GPR, cg);
TR::addDependency(conditions, srcObjReg, TR::RealRegister::gr9, TR_GPR, cg);
TR::addDependency(conditions, dstObjReg, TR::RealRegister::gr10, TR_GPR, cg);

TR::addDependency(conditions, NULL, TR::RealRegister::gr0, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr11, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr6, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr4, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr5, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr3, TR_GPR, cg);
if (!japaneseMethod)
TR::addDependency(conditions, NULL, TR::RealRegister::gr12, TR_GPR, cg);

if (japaneseMethod)
TR::TreeEvaluator::generateHelperBranchAndLinkInstruction(TR_PPCcompressStringNoCheckJ, node, conditions, cg);
else
TR::TreeEvaluator::generateHelperBranchAndLinkInstruction(TR_PPCcompressStringNoCheck, node, conditions, cg);

TR::Register* regs[4] =
{
lengthReg, startReg, srcObjReg, dstObjReg
};
conditions->stopUsingDepRegs(cg, 4, regs);
for (uint16_t i = 0; i < node->getNumChildren(); i++)
cg->decReferenceCount(node->getChild(i));
if (stopUsingCopyReg1)
cg->stopUsingRegister(srcObjReg);
if (stopUsingCopyReg2)
cg->stopUsingRegister(dstObjReg);
if (stopUsingCopyReg3)
cg->stopUsingRegister(startReg);
if (stopUsingCopyReg4)
cg->stopUsingRegister(lengthReg);

cg->machine()->setLinkRegisterKilled(true);
cg->setHasCall();
return NULL;
}

static TR::Register *andORStringEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
TR_J9VMBase *fej9 = (TR_J9VMBase *) (cg->comp()->fe());
TR::Node *srcObjNode, *startNode, *lengthNode;
TR::Register *srcObjReg = NULL, *lengthReg = NULL, *startReg = NULL;

srcObjNode = node->getChild(0);
startNode = node->getChild(1);
lengthNode = node->getChild(2);

bool stopUsingCopyReg1, stopUsingCopyReg2, stopUsingCopyReg3;

stopUsingCopyReg1 = TR::TreeEvaluator::stopUsingCopyReg(srcObjNode, srcObjReg, cg);
stopUsingCopyReg2 = TR::TreeEvaluator::stopUsingCopyReg(startNode, startReg, cg);
stopUsingCopyReg3 = TR::TreeEvaluator::stopUsingCopyReg(lengthNode, lengthReg, cg);

uintptr_t hdrSize = TR::Compiler->om.contiguousArrayHeaderSizeInBytes();
generateTrg1Src1ImmInstruction(cg, TR::InstOpCode::addi, node, srcObjReg, srcObjReg, hdrSize);

TR::RegisterDependencyConditions *conditions = new (cg->trHeapMemory()) TR::RegisterDependencyConditions(8, 8, cg->trMemory());
TR::Register *cndRegister = cg->allocateRegister(TR_CCR);
TR::Register *resultReg = cg->allocateRegister(TR_GPR);
TR::addDependency(conditions, cndRegister, TR::RealRegister::cr0, TR_CCR, cg);
TR::addDependency(conditions, lengthReg, TR::RealRegister::gr8, TR_GPR, cg);
TR::addDependency(conditions, startReg, TR::RealRegister::gr7, TR_GPR, cg);
TR::addDependency(conditions, srcObjReg, TR::RealRegister::gr9, TR_GPR, cg);

TR::addDependency(conditions, NULL, TR::RealRegister::gr0, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr4, TR_GPR, cg);
TR::addDependency(conditions, NULL, TR::RealRegister::gr5, TR_GPR, cg);
TR::addDependency(conditions, resultReg, TR::RealRegister::gr3, TR_GPR, cg);

TR::TreeEvaluator::generateHelperBranchAndLinkInstruction(TR_PPCandORString, node, conditions, cg);

TR::Register* regs[4] =
{
lengthReg, startReg, srcObjReg, resultReg
};
conditions->stopUsingDepRegs(cg, 4, regs);

for (uint16_t i = 0; i < node->getNumChildren(); i++)
cg->decReferenceCount(node->getChild(i));
if (stopUsingCopyReg1)
cg->stopUsingRegister(srcObjReg);
if (stopUsingCopyReg2)
cg->stopUsingRegister(startReg);
if (stopUsingCopyReg3)
cg->stopUsingRegister(lengthReg);

node->setRegister(resultReg);

cg->machine()->setLinkRegisterKilled(true);
cg->setHasCall();
return (resultReg);
}

static TR::Register *inlineConcurrentLinkedQueueTMOffer(TR::Node *node, TR::CodeGenerator *cg)
{
TR::Compilation *comp = cg->comp();
Expand Down Expand Up @@ -12133,20 +11944,6 @@ J9::Power::CodeGenerator::inlineDirectCall(TR::Node *node, TR::Register *&result
}
break;

case TR::java_lang_String_compress:
resultReg = compressStringEvaluator(node, cg, useJapaneseCompression);
return true;
break;

case TR::java_lang_String_compressNoCheck:
resultReg = compressStringNoCheckEvaluator(node, cg, useJapaneseCompression);
return true;

case TR::java_lang_String_andOR:
resultReg = andORStringEvaluator(node, cg);
return true;
break;

case TR::java_util_concurrent_atomic_AtomicBoolean_getAndSet:
case TR::java_util_concurrent_atomic_AtomicInteger_getAndAdd:
case TR::java_util_concurrent_atomic_AtomicInteger_getAndIncrement:
Expand Down
1 change: 0 additions & 1 deletion runtime/compiler/p/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ j9jit_files(
p/runtime/J9PPCArrayCopy.spp
p/runtime/J9PPCArrayTranslate.spp
p/runtime/J9PPCEncodeUTF16.spp
p/runtime/J9PPCCompressString.spp
p/runtime/J9PPCCRC32.spp
p/runtime/J9PPCCRC32_wrapper.c
p/runtime/CodeSync.cpp
Expand Down
78 changes: 0 additions & 78 deletions runtime/compiler/p/runtime/J9PPCCompressString.spp

This file was deleted.

Loading

0 comments on commit 8357d17

Please sign in to comment.