public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Java]: Add --enable-reduced-reflection configure option.
@ 2008-08-26  9:56 David Daney
  2008-08-28 16:43 ` Andrew Haley
  0 siblings, 1 reply; 5+ messages in thread
From: David Daney @ 2008-08-26  9:56 UTC (permalink / raw)
  To: Java Patch List, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1464 bytes --]

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.


[-- Attachment #2: enable-reduced-reflection.patch --]
[-- Type: text/x-patch, Size: 2963 bytes --]

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 $<

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-09-05 17:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-26  9:56 [Patch, Java]: Add --enable-reduced-reflection configure option David Daney
2008-08-28 16:43 ` Andrew Haley
2008-09-03  9:15   ` David Daney
2008-09-04 15:52     ` Andrew Haley
2008-09-05 17:41       ` David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).