From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19914 invoked by alias); 9 Sep 2011 23:03:17 -0000 Received: (qmail 19903 invoked by uid 22791); 9 Sep 2011 23:03:15 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_GC X-Spam-Check-By: sourceware.org Received: from mail-gw0-f50.google.com (HELO mail-gw0-f50.google.com) (74.125.83.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Sep 2011 23:02:55 +0000 Received: by gwj16 with SMTP id 16so1914221gwj.9 for ; Fri, 09 Sep 2011 16:02:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.54.2 with SMTP id f2mr557333pbp.28.1315609374360; Fri, 09 Sep 2011 16:02:54 -0700 (PDT) Received: by 10.68.55.98 with HTTP; Fri, 9 Sep 2011 16:02:53 -0700 (PDT) In-Reply-To: References: Date: Fri, 09 Sep 2011 23:03:00 -0000 Message-ID: Subject: Re: Why GCJ won't load my plugin when compiling bytecode? From: Li junsong To: Bryce McKinlay Cc: java@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 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-09/txt/msg00004.txt.bz2 On Sat, Sep 10, 2011 at 12:24 AM, Bryce McKinlay wrote: > On Fri, Sep 9, 2011 at 10:57 PM, Li junsong wrote: > >> I chose gcj to write plugin to do optimization. So I need its .class >> files output, but not its binary code. > > Modern versions of gcj only compile .class files to object code. gcj > doesn't directly compile Java source code, nor generate bytecode. > (early versions of gcj did do these things, but it was changed years > ago) > > When you give it .java source files, gcj actually first calls out to > regular java compiler, then compiles the resulting .class files. You > can see the commands its running by adding -v to your command line. > >> If I do not get it wrong, it means that If I want to do such >> optimization and measure >> the outcome, I have to look for other compilers, ( since GCC plugins >> won't work ) right? > > That's right. A gcc plugin will never have a chance to run when using > "gcj -C" because the gcc compiler itself is not run. > > Bryce > Thank you so much! Now I know it. But I'm just wondering if others would make the same mistakes. Unless people put his questions in this mail list, he would get no chance to find out these informations. I mean, I have referred to the GNU java homepage ( which told me they had been merged with project GNU ClassPath), gcc internals(in which the chapter "Java Tree" is blank ! ), the "ecj stuff"( There're lots of error in gcj when the first time I compiled my new gcc 4.6), But I find few resources talking about gcj "internals". So, If there is any thing I can do, apart from putting the question I met on my blog to tell others "don't make the same mistake again", please just let me know. Thanks, J. Li