What's the state of efforts to reduce GCJ's footprint?

Marco Trudel mtrudel@gmx.ch
Thu Feb 1 09:30:00 GMT 2007


Tom Tromey wrote:
>>>>>> "Jim" == Jim Mayer <jim@pentastich.org> writes:
> 
> Jim> a few years ago people were complaining about the size of
> Jim> minimal gcj compiled applications that seem downright tiny now.
> 
> That's progress!
> 
> :)

I just sent a mail to the list about the topic. With the current trunk, 
a simple HelloWorld will produce this binaries:
- stripped: 12.6mb
- stripped, JCE excluded: 11mb
- stripped, JCE and GUI excluded: 5.86mb
- stripped, JCE and GUI excluded, upx packed: 1.8mb

With JCE I mean the javax.crypto and javax.net.ssl classes.
With GUI I mean the java.applet, java.awt, java.text, javax.imageio, 
javax.print and javax.swing classes.

By excluding, I mean this:
http://gcc.gnu.org/ml/java/2006-11/msg00096.html


> Jim> Since there's so much stuff out there I'm hoping that someone will point
> Jim> me to some good information on the topic.  I can see that a lot of
> Jim> internal compiler work has been going on (the new ABI stuff, major gcc
> Jim> changes, a new byte code compiler, etc.) and I'm having trouble figuring
> Jim> out how much of the stuff Google turns up is still relevant.
> 
> Off the top of my head:
> 
> * Many people doing static linking make a custom libcj, removing
>   things they don't like.

I compile GCJ as usual and create afterwards stubs that prevent certain 
objects of being pulled in. See the mentioned thread above.
Recently I managed to write an application that automatically creates 
stubs for all objects in libgcj.a. So you don't even have to manually do 
some mindless tasks... But it's not yet completely ready for the public.


> * -freduced-reflection might help somewhat, but of course it affects
>   what kinds of programs you can run.  I'm not sure whether you can
>   build all of libgcj this way or not; David Daney would know.  Or
>   perhaps Google.

I wondered about that a long time ago. How to use this?
Can it be used while normal compilation of an application, I always get:
cc1.exe: warning: command line option "-freduced-reflection" is valid 
for Java but not for C


Marco



More information about the Java mailing list