Filed for tracking purpose.
Changes to CR6986046 (C1 valuestack cleanup) introduce a ~3-4% regression on x86 Linux (and perhaps some other platforms) when running specjvm98.mpegaudio benchmark.
Comments
EVALUATION
Fixing this problem would require adding to c1 some form of scheduling of instructions in a way that works ok on different architectures. It goes beyond a simple bug fix.
13-07-2011
EVALUATION
The value stack clean-up introduced an optimization when the compiled method doesn't have exception handlers: the state is trimmed at instructions that can trigger an exception because it's useless on a deopt.
The JVM before the change performs better by chance: a reference in a ValueStack at an exception forces code generation for a piece of computation earlier and then puts less pressure on registers and so better register allocation.
Note that sparc has a 3% perf improvement on mpegaudio with this change.
I tried better scheduling IR instructions. When iterating through the instructions of a block, if I detect that emitting an IR instruction right away decreases the number of live values (by checking the use counts), I force the instruction to be emitted right away. That fixed the performance issue on x86 for mpegaudio but that leads to a 5% perf regression on mpegaudio on sparc probably because sparc has plenty of registers and emitting the instructions earlier doesn't help the register allocator but the latency of memory accesses shows.