This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[Patch, Java]: Add --enable-reduced-reflection configure option.
- From: David Daney <ddaney at avtrex dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 25 Aug 2008 14:51:10 -0700
- Subject: [Patch, Java]: Add --enable-reduced-reflection configure option.
This patch adds a new configure option to easily allow libgcj to be
built with the -freduced-reflection option. This reduces the size (as
reported by the size command) of libgcj by about 5% on i686-pc-linux.
Although the resulting library has reduced functionality (as
serialization, RMI and CORBA don't work with -freduced-reflection), the
size savings can be important in some circumstances (embedded devices).
The name of the option is --enable-reduced-reflection, although I
considered and rejected --with-reduced-reflection.
Tested on i686-pc-linux. Where as expected most -findirect-dispatch
execution tests failed as well as the interpreter tests and several
other random tests that rely on accurate reflection meta-data.
OK to commit?
gcc/
2008-08-25 David Daney <ddaney@avtrex.com>
* doc/install.texi (--enable-reduced-reflection): Document new option.
libjava/
2008-08-25 David Daney <ddaney@avtrex.com>
* configure.ac (reduced-reflection): New AC_ARG_ENABLE.
(build_libgcj_reduced_reflection): New variable.
(BUILD_LIBGCJ_REDUCED_REFLECTION): New AM_CONDITIONAL.
* Makefile.am (LIBGCJ_REDUCED_REFLECTION_FLAGS): New variable.
(%.lo: %.list): Add LIBGCJ_REDUCED_REFLECTION_FLAGS to compile
command.
(java/util/concurrent.lo, java/util/concurrent/atomic.lo,
java/util/concurrent/locks.lo): Override
LIBGCJ_REDUCED_REFLECTION_FLAGS.
* include/Makefile.in, testsuite/Makefile.in, gcj/Makefile.in,
configure: Regenerate.
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi (revision 139335)
+++ gcc/doc/install.texi (working copy)
@@ -1582,6 +1582,13 @@ these options. This allows the compile-
dependencies when statically linking to libgcj. However it makes it
impossible to override the affected portions of libgcj at run-time.
+@item --enable-reduced-reflection
+Build most of libgcj with @option{-freduced-reflection}. This reduces
+the size of libgcj at the expense of not being able to do accurate
+reflection on the classes it contains. This option is safe if you
+know that code using libgcj will never use reflection on the standard
+runtime classes in libgcj (including using serialization, RMI or CORBA).
+
@item --with-ecos
Enable runtime eCos target support.
Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac (revision 139335)
+++ libjava/configure.ac (working copy)
@@ -526,6 +526,15 @@ AC_ARG_ENABLE(libgcj-bc,
fi])
AM_CONDITIONAL(SUPPRESS_LIBGCJ_BC, test "$suppress_libgcj_bc" = "yes")
+build_libgcj_reduced_reflection=no
+AC_ARG_ENABLE(reduced-reflection,
+ AS_HELP_STRING([--enable-reduced-reflection],
+ [enable or disable(default) -freduced-reflection when building portions of libgcj]),
+ [if test "$enable_reduced_reflection" = "yes"; then
+ build_libgcj_reduced_reflection=yes
+ fi])
+AM_CONDITIONAL(BUILD_LIBGCJ_REDUCED_REFLECTION, test "$build_libgcj_reduced_reflection" = "yes")
+
# What is the native OS API for MinGW?
AC_ARG_WITH(win32-nlsapi,
AS_HELP_STRING([--with-win32-nlsapi=ansi or unicows or unicode],
Index: libjava/Makefile.am
===================================================================
--- libjava/Makefile.am (revision 139335)
+++ libjava/Makefile.am (working copy)
@@ -173,6 +173,12 @@ else
LIBGCJ_BC_FLAGS = -findirect-dispatch -fno-indirect-classes
endif
+if BUILD_LIBGCJ_REDUCED_REFLECTION
+LIBGCJ_REDUCED_REFLECTION_FLAGS = -freduced-reflection
+else
+LIBGCJ_REDUCED_REFLECTION_FLAGS =
+endif
+
## Extra CFLAGS used for JNI C sources shared with GNU Classpath.
PEDANTIC_CFLAGS = -ansi -pedantic -Wall -Wno-long-long
@@ -401,8 +407,13 @@ lib-gnu-awt-xlib.la: $(lib_gnu_awt_xlib_
## Compiling a list of java sources to a single .o.
+# Concurrent things use reflection internally.
+java/util/concurrent.lo \
+java/util/concurrent/atomic.lo \
+java/util/concurrent/locks.lo: LIBGCJ_REDUCED_REFLECTION_FLAGS =
+
%.lo: %.list
- $(LTGCJCOMPILE) -c -o $@ -fsource-filename=$(here)/classpath/lib/classes -MT $@ -MD -MP -MF $(basename $@).deps @$<
+ $(LTGCJCOMPILE) $(LIBGCJ_REDUCED_REFLECTION_FLAGS) -c -o $@ -fsource-filename=$(here)/classpath/lib/classes -MT $@ -MD -MP -MF $(basename $@).deps @$<
java/lang/Object.lo: classpath/lib/java/lang/Object.class
$(LTGCJCOMPILE) -c -o $@ -fsource-filename=$(srcdir)/$(basename $@).java $<