Z: Short circuit variable length array cmp helper - #7229
Conversation
|
Instruction selection for this path: |
| if (!isFoldedIf && needResultReg) | ||
| { | ||
| branchDeps->addPostCondition(retValReg, TR::RealRegister::AssignAny); | ||
| generateRRInstruction(cg, TR::InstOpCode::getXORRegOpCode(), node, retValReg, retValReg); |
There was a problem hiding this comment.
in all code paths we need to init result register with zero
| generateRRInstruction(cg, TR::InstOpCode::getXORRegOpCode(), node, retValReg, retValReg); | ||
| } | ||
|
|
||
| generateS390LabelInstruction(cg, TR::InstOpCode::label, node, cFlowRegionStart); |
There was a problem hiding this comment.
The short circuit branch would always be the start of control flow.
|
|
||
| if (maxLenIn256) | ||
| { | ||
| if (!isFoldedIf && needResultReg) |
There was a problem hiding this comment.
we init result before short circuit. this code no longer needed.
| { | ||
| if (isIfxcmpBrCondContainEqual) | ||
| setStartInternalControlFlow(cg, node, generateS390BranchInstruction(cg, TR::InstOpCode::BRC, TR::InstOpCode::COND_BL, node, compareTarget), | ||
| isStartInternalControlFlowSet); |
There was a problem hiding this comment.
control flow always start before short circuit branch. This is no longer necessary.
|
@r30shah Please review and let me know if it looks good to you. |
|
Tested for JDK8 (LoZ and zOS) Axxon 64179, test level.sanity, all tests pass |
| source1Reg, | ||
| source2Reg, | ||
| TR::InstOpCode::COND_BE, | ||
| isIfxcmpBrCondContainEqual ? compareTarget : cFlowRegionEnd); |
There was a problem hiding this comment.
set needCC to false.
a535d71 to
0b82978
Compare
|
After fixing jump instruction: |
|
Jenkins build zos,zlinux |
|
@hzongaro Can I request you to merge this change if you are ok with it? |
hzongaro
left a comment
There was a problem hiding this comment.
I think the changes look good. Thanks!
|
x86-64 macOS failure is unrelated, of course, while relevant platform-specific testing passed. Merging. |
Actually, may I ask you to adjust the wording of the commit message to describe the change that's being applied? Maybe something like the following? |
0b82978 to
1f57d12
Compare
|
Thanks @hzongaro for your help. I modified the commit message as you suggested. Please let me know if it looks good now. |
|
@ehsankianifar, thanks for updating the commit message. I don't know whether you've seen the Commit guidelines, but one thing they recommend is that lines in the body of the commit message shouldn't be longer than 72 characters, if possible. May I ask you to adjust the spacing so that each line is no longer than 72 characters? |
86feda1 to
049a571
Compare
Add short circuit test of whether two array addresses are equal for arraycmp. This particular case handles unsigned result and variable length or length greater than 4K. Short circuit branching is added to the start of instruction sequence. Signed-off-by: Ehsan Kiani Far <ehsan.kianifar@gmail.com>
049a571 to
47bc735
Compare
|
Thanks @hzongaro for reminding me of that. I fixed the commit message. |
If the addresses of two arrays are equal, those two arrays are considered equal and we do not need to actually compare those arrays. In this PR, we modified the instructions for x86 and there was a discussion to do the same for other architectures. On Z, it is more complicated and depending on the conditions and expected response, several methods implement array compare.
This PR targets array cmp helper implementation when the length is variable. the arraycmpEvaluator calls arraycmpHelper when the length is variable or larger than 4k and requested response is unsigned.