[Patch] Add option to reduce amount of reflection data to gcj...

David Daney ddaney@avtrex.com
Wed Mar 15 01:37:00 GMT 2006


Andrew Haley wrote:
> David Daney writes:
>  > Here is my patch to optionally reduce the amount of reflection data 
>  > generated by gcj.  When applied to libgcj on i686 I see about 5% 
>  > reduction in memory image size.
>  > 
>  >     text    data     bss     dec     hex filename
>  > 18937435        3615244  260644 22813323        15c1a8b 
>  > /home/daney/gccsvn/native_clean/i686-pc-linux-gnu/libjava/.libs/libgcj.so.7.0.0
>  > 18284867        3254316  260644 21799827        14ca393 libgcj.so.7.0.0
>  > 
>  > On my GCC-3.4.3/mipsel-linux port of the patch when used in conjunction 
>  > with static linking I am getting about 12-15% savings on a fairly large 
>  > (1000 classes) application.
>  > 
>  > There are of course several caveats:  By eliminating a lot of reflection 
>  > meta-data, a lot of reflection operations will fail.  No big surprize 
>  > there.  JNI and the binary compatibility ABI depend on complete 
>  > reflection meta-data, so they cannot be used in conjunction with reduced 
>  > reflection meta-data.  The byte code interpereter, and the gij program 
>  > work on some, but not all, programs with reduced reflection meta-data.
>  > 
>  > Tested on i686-pc-linux-gnu (FC3).
>  > 
>  > When -freflection-data= is not specified, no regressions with full 
>  > bootstrap of all default languages.  I generated assembly language for a 
>  > 122 class package with and without the patch and the *only* differences 
>  > were the movement of the vtables from after to before the reflection 
>  > data.  This is to be expected from the patch.  Adding 
>  > -freflection-data=reduced to my libgcj.spec.in, resulted in many (about 
>  > 180) failures in the libgcj testsuite.  These were in some, but not all, 
>  > gij compilation tests as well as JNI, BC and some specific reflection 
>  > tests.  I am considering this a pass as some things are not expected to 
>  > work with the -freflection-data=reduced option enabled.
>  > 
>  > OK to commit?
> 
> I don't think the -freflection-data=none option should be there in its
> current form, since it breaks so much.  Perhaps this option could be
> enhanced so that we don't silently generate incorrect code.  We should
> report an error instead.
> 
> If it's incompatible with -findirect-dispatch, it should error if
> these options are combined on the command line.

Both issues fixed with this new version of the patch.

The new option is '-freduced-reflection'.

Tested as before.  No regressions without new -freduced-reflection 
option. with %{fjni|findirect-dispatch:;:-freduced-reflection} added to 
libgcj.spec.in I get 125 new failures, but they are all expected as the 
patch makes this sacrifice to save space.

OK to commit?

2006-03-14  David Daney  <ddaney@avtrex.com>

         * lang.opt (-freduced-reflection): New option.
         * lang.c (java_post_options): Generate an error if
         -freduced-reflection used with -fjni or -findirect-dispatch.
         * java-tree.h (flag_reduced_reflection): Declare new variable.
         * boehm.c (get_boehm_type_descriptor): Indicate all pointers
         if bitmap overflows and flag_reduced_reflection set.
         * class.c (uses_jv_markobj_p): New function.
         (make_class_data): Moved generation of vtable to before
         reflection data, generate less reflection data if
         flag_reduced_reflection set.
         * gcj.texi: Document -freduced-reflection.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: reflect.d
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060315/36839f6c/attachment.ksh>


More information about the Gcc-patches mailing list