Why does a 'new' statement produce so many temporary variables
Andrew Pinski
pinskia@gmail.com
Tue Aug 9 16:22:00 GMT 2011
On Tue, Aug 9, 2011 at 12:18 AM, Li junsong <ljs.darkfish@gmail.com> wrote:
> 3. I find that there is no document to describe the implementation of
> Java front end.
> I don't understand why we need so many temporary variables:
>> #ref#2#4 = _Jv_AllocObjectNoFinalizer (&Number.class$$);
> #ref#3#6 = #ref#2#4;
> #ref#2#4 = #ref#3#6;
>> Here, the #ref#3#6 and #ref#2#4 is a kind waste. But each "new" statement
> does the same thing.
The reason is because this is an exact translation of the java
byte-code. Most source to java byte-code compilers don't do any
optimizations which is why we get a lot of temporary variables here
(this includes the one included with Eclipse which is what GCJ uses as
the source compiler).
Thanks,
Andrew Pinski
More information about the Java
mailing list