From a9445ba134c2077f01a10e9073833209831d78c7 Mon Sep 17 00:00:00 2001 From: KONNO Kazuhiro Date: Tue, 12 Nov 2024 16:19:21 +0900 Subject: [PATCH] Stop recognizing UTF_16.encodeUTF16 methods This commit removes the code for encodeUTF16Big() and encodeUTF16Little() methods in sun.nio.cs.UTF_16$Encoder from method recognition, and removes related helper functions. --- compiler/optimizer/ValuePropagationCommon.cpp | 59 ++----------------- compiler/ras/Debug.cpp | 3 - compiler/runtime/Helpers.inc | 38 +++++------- 3 files changed, 22 insertions(+), 78 deletions(-) diff --git a/compiler/optimizer/ValuePropagationCommon.cpp b/compiler/optimizer/ValuePropagationCommon.cpp index 34b768c060c..d32b9ab91ad 100644 --- a/compiler/optimizer/ValuePropagationCommon.cpp +++ b/compiler/optimizer/ValuePropagationCommon.cpp @@ -2407,8 +2407,6 @@ void OMR::ValuePropagation::generateArrayTranslateNode(TR::TreeTop *callTree,TR: bool isISO88591Decoder = (rm == TR::sun_nio_cs_ISO_8859_1_Decoder_decodeISO8859_1); bool isSBCSEncoder = (rm == TR::sun_nio_cs_ext_SBCS_Encoder_encodeSBCS)? true:false; bool isSBCSDecoder = (rm == TR::sun_nio_cs_ext_SBCS_Decoder_decodeSBCS)? true:false; - bool isEncodeUtf16 = (rm == TR::sun_nio_cs_UTF_16_Encoder_encodeUTF16Big || rm == TR::sun_nio_cs_UTF_16_Encoder_encodeUTF16Little); - int32_t childId = callNode->getFirstArgumentIndex(); if (callNode->getChild(childId)->getType().isAddress() && callNode->getChild(childId+1)->getType().isAddress()) @@ -2471,7 +2469,7 @@ void OMR::ValuePropagation::generateArrayTranslateNode(TR::TreeTop *callTree,TR: else strideNode = TR::Node::create(callNode, TR::iconst, 0, 2); - if ( isISO88591Encoder || isAsciiEncoder || isSBCSEncoder || isEncodeUtf16 || + if ( isISO88591Encoder || isAsciiEncoder || isSBCSEncoder || (rm == TR::sun_nio_cs_US_ASCII_Encoder_encodeASCII) || (rm == TR::sun_nio_cs_UTF_8_Encoder_encodeUTF_8)) encode = true; @@ -2626,36 +2624,12 @@ void OMR::ValuePropagation::generateArrayTranslateNode(TR::TreeTop *callTree,TR: stoppingNode = TR::Node::create(callNode,TR::iconst, 0, stopIndex); - if (isEncodeUtf16) - { - TR::SymbolReference* transformedCallSymRef = - comp()->getSymRefTab()->methodSymRefFromName( - comp()->getMethodSymbol(), - "com/ibm/jit/JITHelpers", - TR::sun_nio_cs_UTF_16_Encoder_encodeUTF16Big == rm ? - "transformedEncodeUTF16Big" : - "transformedEncodeUTF16Little", - "(JJI)I", - TR::MethodSymbol::Static - ); - - arrayTranslateNode = TR::Node::createWithSymRef(callNode, callNode->getOpCodeValue(), 3, transformedCallSymRef); - } - arrayTranslateNode->setAndIncChild(0, src); arrayTranslateNode->setAndIncChild(1, dst); - - if (isEncodeUtf16) - { - arrayTranslateNode->setAndIncChild(2, len); - } - else - { - arrayTranslateNode->setAndIncChild(2, tableNode); - arrayTranslateNode->setAndIncChild(3, termCharNode); - arrayTranslateNode->setAndIncChild(4, len); - arrayTranslateNode->setAndIncChild(5, stoppingNode); - } + arrayTranslateNode->setAndIncChild(2, tableNode); + arrayTranslateNode->setAndIncChild(3, termCharNode); + arrayTranslateNode->setAndIncChild(4, len); + arrayTranslateNode->setAndIncChild(5, stoppingNode); //arrayTranslateNode->setChild(5, NULL);//* do I need this? what if there are more children?*/ @@ -3936,29 +3910,8 @@ slowBlock-> n39n BBStart (freq 0) (cold) cfg->addEdge(TR::CFGEdge::createEdge(prevBlock, slowBlock, trMemory())); cfg->addEdge(TR::CFGEdge::createEdge(slowBlock, nextBlock, trMemory())); } -#endif -static -const char* transformedTargetName (TR::RecognizedMethod rm) - { -#ifdef J9_PROJECT_SPECIFIC - switch ( rm ) - { - case TR::sun_nio_cs_UTF_16_Encoder_encodeUTF16Big: - return "icall com/ibm/jit/JITHelpers.transformedEncodeUTF16Big(JJI)I"; - - case TR::sun_nio_cs_UTF_16_Encoder_encodeUTF16Little: - return "icall com/ibm/jit/JITHelpers.transformedEncodeUTF16Little(JJI)I" ; - default: - return "arraytranslate"; - } -#else - return "arraytranslate"; -#endif - } - -#ifdef J9_PROJECT_SPECIFIC /** * Can be called from doDelayedTransformations when nodes may have been removed from the tree. Issue 6623 * https://github.com/eclipse-omr/omr/issues/6623 @@ -4243,7 +4196,7 @@ void OMR::ValuePropagation::transformConverterCall(TR::TreeTop *callTree) - if (!performTransformation(comp(), "%sChanging call %s [%p] to %s \n", OPT_DETAILS, callNode->getOpCode().getName(), callNode, transformedTargetName(rm))) + if (!performTransformation(comp(), "%sChanging call %s [%p] to %s \n", OPT_DETAILS, callNode->getOpCode().getName(), callNode, "arraytranslate")) return; TR::CFG *cfg = comp()->getFlowGraph(); diff --git a/compiler/ras/Debug.cpp b/compiler/ras/Debug.cpp index d2ac4f457b8..3236bd7ae26 100644 --- a/compiler/ras/Debug.cpp +++ b/compiler/ras/Debug.cpp @@ -3942,9 +3942,6 @@ TR_Debug::getRuntimeHelperName(int32_t index) case TR_PPCP256addNoMod: return "ECP256addNoMod_PPC"; case TR_PPCP256subNoMod: return "ECP256subNoMod_PPC"; - case TR_PPCencodeUTF16Big: return "__encodeUTF16Big"; - case TR_PPCencodeUTF16Little: return "__encodeUTF16Little"; - case TR_PPCreferenceArrayCopy: return "__referenceArrayCopy"; case TR_PPCgeneralArrayCopy: return "__generalArrayCopy"; case TR_PPCsamplingRecompileMethod: return "__samplingRecompileMethod"; diff --git a/compiler/runtime/Helpers.inc b/compiler/runtime/Helpers.inc index fae1b17c348..6e4ffdb899c 100644 --- a/compiler/runtime/Helpers.inc +++ b/compiler/runtime/Helpers.inc @@ -202,9 +202,7 @@ SETVAL(TR_IA32JitMethodMonitorExitReserved,TR_LXRH+28) SETVAL(TR_IA32arrayTranslateTRTO, TR_LXRH+29) SETVAL(TR_IA32arrayTranslateTROTNoBreak, TR_LXRH+30) SETVAL(TR_IA32arrayTranslateTROT, TR_LXRH+31) -SETVAL(TR_IA32encodeUTF16Big,TR_LXRH+32) -SETVAL(TR_IA32encodeUTF16Little,TR_LXRH+33) -SETVAL(TR_IA32numRuntimeHelpers,TR_LXRH+34) +SETVAL(TR_IA32numRuntimeHelpers,TR_LXRH+32) SETVAL(TR_AMD64floatRemainder,TR_LXRH+0) SETVAL(TR_AMD64doubleRemainder,TR_LXRH+1) @@ -236,12 +234,10 @@ SETVAL(TR_AMD64clockGetTime,TR_LXRH+26) SETVAL(TR_AMD64arrayTranslateTRTO, TR_LXRH+27) SETVAL(TR_AMD64arrayTranslateTROTNoBreak, TR_LXRH+28) SETVAL(TR_AMD64arrayTranslateTROT, TR_LXRH+29) -SETVAL(TR_AMD64encodeUTF16Big,TR_LXRH+30) -SETVAL(TR_AMD64encodeUTF16Little,TR_LXRH+31) -SETVAL(TR_AMD64doAESENCEncrypt,TR_LXRH+32) -SETVAL(TR_AMD64doAESENCDecrypt,TR_LXRH+33) -SETVAL(TR_AMD64java_util_zip_CRC32C_updateBytes,TR_LXRH+34) -SETVAL(TR_AMD64numRuntimeHelpers,TR_LXRH+35) +SETVAL(TR_AMD64doAESENCEncrypt,TR_LXRH+30) +SETVAL(TR_AMD64doAESENCDecrypt,TR_LXRH+31) +SETVAL(TR_AMD64java_util_zip_CRC32C_updateBytes,TR_LXRH+32) +SETVAL(TR_AMD64numRuntimeHelpers,TR_LXRH+33) SETVAL(TR_PPClongDivide,TR_FSRH) SETVAL(TR_PPCnativeStaticHelper,TR_FSRH+1) @@ -324,19 +320,17 @@ SETVAL(TR_PPCquadWordArrayCopy_vsx, TR_FSRH+77) SETVAL(TR_PPCforwardQuadWordArrayCopy_vsx, TR_FSRH+78) SETVAL(TR_PPCpostP10ForwardCopy, TR_FSRH+79) SETVAL(TR_PPCpostP10GenericCopy, TR_FSRH+80) -SETVAL(TR_PPCencodeUTF16Big, TR_FSRH+81) -SETVAL(TR_PPCencodeUTF16Little, TR_FSRH+82) -SETVAL(TR_PPCP256Multiply, TR_FSRH+83) -SETVAL(TR_PPCP256Mod, TR_FSRH+84) -SETVAL(TR_PPCP256addNoMod, TR_FSRH+85) -SETVAL(TR_PPCP256subNoMod, TR_FSRH+86) -SETVAL(TR_PPCAESCBCDecrypt, TR_FSRH+87) -SETVAL(TR_PPCAESCBCEncrypt, TR_FSRH+88) -SETVAL(TR_PPCinterpreterUnresolvedConstantDynamicGlue, TR_FSRH+89) -SETVAL(TR_PPCcrc32_vpmsum, TR_FSRH+90) -SETVAL(TR_PPCcrc32_no_vpmsum, TR_FSRH+91) -SETVAL(TR_PPCcrc32_oneByte, TR_FSRH+92) -SETVAL(TR_PPCnumRuntimeHelpers,TR_FSRH+93) +SETVAL(TR_PPCP256Multiply, TR_FSRH+81) +SETVAL(TR_PPCP256Mod, TR_FSRH+82) +SETVAL(TR_PPCP256addNoMod, TR_FSRH+83) +SETVAL(TR_PPCP256subNoMod, TR_FSRH+84) +SETVAL(TR_PPCAESCBCDecrypt, TR_FSRH+85) +SETVAL(TR_PPCAESCBCEncrypt, TR_FSRH+86) +SETVAL(TR_PPCinterpreterUnresolvedConstantDynamicGlue, TR_FSRH+87) +SETVAL(TR_PPCcrc32_vpmsum, TR_FSRH+88) +SETVAL(TR_PPCcrc32_no_vpmsum, TR_FSRH+89) +SETVAL(TR_PPCcrc32_oneByte, TR_FSRH+90) +SETVAL(TR_PPCnumRuntimeHelpers,TR_FSRH+91) SETVAL(TR_ARMdouble2Long,TR_FSRH) SETVAL(TR_ARMdoubleRemainder,TR_FSRH+1)