C
Chris Uppal
Chris said:With a few exceptions, though, optimizers don't optimize native machine
code. They optimize intermediate representations.
Agreed.
2. Convert all local variables AND the operand stack into SSA form with
temporary variables.
My reason for suspecting that overuse of the stack might impede optimisation is
that the semantics of stack operations are richer than just register moves --
for instance an /ordering/ of data items on the stack is implied, even when the
algorithm itself doesn't make use of that ordering. If the optimisation phase
attempts to preserve that layout, then it'll have more work to do than if the
same algorithm had been expressed as movements between (unordered) "registers".
I assume that you are right in thinking that an SSA analysis is capable of
removing "stackness" from bytecode which passes verification (I know very
little about SSA). I would be just a little hesitant in going from that to
assuming that <some unknown JVM> does do so in practise -- especially for
non-idiomatic bytecode.
-- chris