From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19703 invoked by alias); 9 Aug 2011 16:22:27 -0000 Received: (qmail 19695 invoked by uid 22791); 9 Aug 2011 16:22:26 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iy0-f175.google.com (HELO mail-iy0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Aug 2011 16:22:10 +0000 Received: by iyn15 with SMTP id 15so260456iyn.34 for ; Tue, 09 Aug 2011 09:22:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.73.4 with SMTP id q4mr1544445icj.284.1312906929411; Tue, 09 Aug 2011 09:22:09 -0700 (PDT) Received: by 10.42.224.194 with HTTP; Tue, 9 Aug 2011 09:22:09 -0700 (PDT) In-Reply-To: References: Date: Tue, 09 Aug 2011 16:22:00 -0000 Message-ID: Subject: Re: Why does a 'new' statement produce so many temporary variables From: Andrew Pinski To: Li junsong Cc: java@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg00002.txt.bz2 On Tue, Aug 9, 2011 at 12:18 AM, Li junsong wrote: > =C2=A03. I find that there is no document to describe the implementation = of > Java front end. > =C2=A0=C2=A0=C2=A0=C2=A0 I don't understand why we need so many temporary= variables: > > =C2=A0=C2=A0=C2=A0=C2=A0 #ref#2#4 =3D _Jv_AllocObjectNoFinalizer (&Number= .class$$); > =C2=A0=C2=A0=C2=A0=C2=A0 #ref#3#6 =3D #ref#2#4; > =C2=A0=C2=A0=C2=A0=C2=A0 #ref#2#4 =3D #ref#3#6; > > =C2=A0=C2=A0=C2=A0=C2=A0 Here, the #ref#3#6 and #ref#2#4 is a kind waste.= But each "new" statement > =C2=A0=C2=A0=C2=A0=C2=A0 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