This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for Review: Compile each classfile individually unless --enable-libgcj-multifile


Hi People,

Due to memory exhaustion issues on low-memory machines:

http://gcc.gnu.org/ml/java/2003-09/threads.html#00067

...introduced by this patch:

http://gcc.gnu.org/ml/java-patches/2003-q3/msg00427.html

...I was asked to either back out the patch or conditionalize
it on --enable-intermodule, reverting to the old behavior
of compiling each classfile individually in the absence of
this flag.

http://gcc.gnu.org/ml/java/2003-09/msg00205.html

This patch aims to do the latter, but uses the libjava-local
configure switch --enable-libgcj-multifile instead of --enable-intermodule
for reasons described here:

http://gcc.gnu.org/ml/java/2003-09/msg00212.html

Tested on (i686-pc-linux-gnu,i686-pc-linux-gnu,i686-pc-linux-gnu).

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

ChangeLog
2003-09-17  Mohan Embar  <gnustuff@thisiscool.com>

	* configure.in: Standardized help text case of
	--enable-hash-synchronization
	New configure switch --enable-libgcj-multifile and corresponding
	automake conditional ONESTEP.
	* configure: Rebuilt.
	* Makefile.am: Use automake conditional ONESTEP to determine
	whether classfiles should be compiled individually or all
	at once.
	* Makefile.in: Rebuilt.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.170
diff -u -2 -r1.170 configure.in
--- configure.in	11 Sep 2003 17:25:47 -0000	1.170
+++ configure.in	17 Sep 2003 12:13:32 -0000
@@ -81,9 +81,20 @@
 AC_ARG_ENABLE(hash-synchronization,
 [  --enable-hash-synchronization
-                          Use global hash table for monitor locks])
+                          use global hash table for monitor locks])
 
 if test -z "$enable_hash_synchronization"; then
    enable_hash_synchronization=$enable_hash_synchronization_default
 fi
+
+# Do we allow intermodule optimizations (i.e. compiling many files at once)?
+AC_ARG_ENABLE(libgcj-multifile,
+[  --enable-libgcj-multifile
+                          allow compilation of several files at once],
+[case "${enableval}" in
+  yes) enable_libgcj_multifile=yes ;;
+  no)  enable_libgcj_multifile=no ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-libgcj-multifile) ;;
+esac],[enable_libgcj_multifile=no])
+AM_CONDITIONAL(ONESTEP, test "$enable_libgcj_multifile" = yes)
 
 dnl configure.host sets slow_pthread_self if the synchronization code should 
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.321
diff -u -2 -r1.321 Makefile.am
--- Makefile.am	17 Sep 2003 02:44:42 -0000	1.321
+++ Makefile.am	17 Sep 2003 12:13:00 -0000
@@ -340,4 +340,8 @@
 all_java_class_files = $(all_java_source_files:.java=.class)
 
+if ONESTEP
+
+# Compile all classfiles in one go.
+
 libgcj-@gcc_version@.jar: $(all_java_source_files)
 	-@rm -f libgcj-@gcc_version@.jar
@@ -356,4 +360,20 @@
 # is built.
 $(all_java_class_files): libgcj-@gcc_version@.jar
+
+else # !ONESTEP
+
+# Compile each classfile individually.
+
+.java.class:
+	$(JAVAC) $(JCFLAGS) -classpath '' -bootclasspath $(here):$(srcdir) -d $(here) $<
+
+libgcj-@gcc_version@.jar: $(all_java_class_files)
+	-@rm -f libgcj-@gcc_version@.jar
+## Note that we explicitly want to include directory information.
+	find java gnu javax org -type d -o -type f -name '*.class' | \
+	  sed -e '/\/\./d' -e '/\/xlib/d' | \
+	  $(ZIP) cfM0E@ $@
+
+endif
 
 # Note: The libtool objects are removed by mostlyclean-local




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]