Boxed types and constat propagation
oehrstroem at gmail.com
Wed Apr 25 10:23:46 PDT 2012
>> That's a lot of optimization that I otherwise wouldn't have to do, if
>> only boxed types and constant propagation worked well, but yeah, I see
>> how it can work now.
Clearly the C1/C2 compiler needs to be improved. In the meantime
you have to work around their limitations.
> BTW, I've patched the JIT to consider all final fields of a class of
> java/lang as truly final
> but that not enough for having the escape analysis to work with integers.
> It seems that because of the cache used in Integer.valueOf(), the JIT
> that the Integers are not escapable.
I think System.out and System.err are final, but they are in fact
set during the start of the jvm. Just so that you take that into
account, in case any optimizations would happen that early.
(There are probably more examples of this.)
The escape analysis in C2 is broken, combining that with
the limited amount of boxing removal support, and the cache
of Integer.valueOf, you get a bad optimizations.
At least we have an intern right now in Stockholm who is
working on porting the JRockit autoboxing removal optimizations
to C2. Yay!
More information about the mlvm-dev