'copy' LIR transformation translates CopyPseudoInsts to corresponding native copying instructions.
Besides replacing of CopyPseudoInsts this optimization calls to SimpleStackOpndCoalescer to remove unnecessary copying.
SimpleStackOpndCoalescer removes redundant stack operands and translates redundant stack-stack CopyPseudoInsts to copies of the same operand. The latter is not expanded by the copy expansion pass and thus is not emitted.
SimpleStackOpndCoalescer "removes" copies if:
- both operands are StackAutoLayout - both are of the same size - live-ranges of the operands do not overlap
Live-ranges are approximated by sets of spans like in the bin-packing register allocation. SimpleStackOpndCoalescer uses the same structures (Interval, Span) as the Jitrino bin-packing reg allocator.
It is important that for non-static synchronized methods the method argument containing "this" is not changed as it is used in getAddressOfThis. This is taken into account by making live-ranges of "this" for such methods "eternal" (living till the end of the method)