Actually though, what dexopt does for array initialization is not really a
peephole optimization (although they do apply pattern matching).
Peephole
optimizations involve scanning through a sequence of instructions, recognizing a
specific short sequence of instructions and replacing it with a better short
sequence or with a better individual instruction. It's largely used to
clean up artifacts from earlier code-generation passes (e.g. such as the same
constant being loaded into a register more than once). Peephole optimizations
are extremely local, usually affecting just the stream of instructions and
nothing else.
While Dalvik does recognize the pattern of a specific short
sequence of instructions that carry out an array initialization, it extracts the
data from those instructions and puts it in an initialized data segment. This
is transformative and not really a peephole optimization. [ Reply to This | Parent | # ]
|