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]

3.4 PATCH: Support POSIX threads in libjava on Tru64 UNIX


This patch is a followup to Rogers initial fix for bootstrap failures on
Tru64 UNIX with --enable-threads=posix:

	http://gcc.gnu.org/ml/java-patches/2003-q2/msg00541.html
	http://gcc.gnu.org/ml/java-patches/2003-q3/msg00013.html

I had asked him to hold up on them: even though they fixed the bootstrap
failures, there were tons of new testsuite regressions, as is well known
and documented in install.texi.  After I had determined that a large part
of libjava testsuite failures are due to missing pthread support in
boehm-gc and fixed that/backported the necessary changes

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

here are the remaining bits to allow libjava to work on Tru64 UNIX with
pthreads:

* It introduces THREADCXXFLAGS to pass -pthreads to the compilations
  (Rogers patch).  This merely defines _REENTRANT and may not be really
  necessary, given that comment in configure.in:

    # If we're using the Boehm GC, then we happen to know that it
    # defines _REENTRANT, so we don't bother.  Eww.
    if test "$GC" != boehm; then
       AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
    fi

  but it's a nice generalization and useful on its own.

* Since boehm-gc with pthreads enabled uses some functions from librt, both
  -lpthread and -lrt need to go into THREADLIBS/THREADSPEC to avoid
  link/runtime failures.

Besides, the patch doesn't only handle alpha*-dec-osf5*, as Roger did, but
alpha*-dec-osf* in general: gcc only supports osf[45]* anyway, and I tested
on both V4.0F and V5.1, so this should be safe.

With those patches (boehm-gc and this one), testsuite results with
--enable-threds=posix are now reasonable on alpha-dec-osf4.0f and
alpha-dec-osf5.1.

Here are the testsuite differences between an unmodified tree without
--enable-threads=posix and my patch sets:

--- 5.1-gcc/mail-report.log	Fri Jun 27 22:41:21 2003
+++ 5.1-gcc-pthread/mail-report.log	Wed Jul  9 20:59:09 2003
@@ -24,10 +24,24 @@
 FAIL: Class_1 compilation from bytecode
 FAIL: Class_1 -O compilation from source
 FAIL: Class_1 -O compilation from bytecode
+FAIL: FileHandleGcTest execution - gij test
+FAIL: FileHandleGcTest execution - gij test
 FAIL: PR218 execution - gij test
 FAIL: PR218 execution - gij test
 FAIL: StringBuffer_1 execution - gij test
 FAIL: StringBuffer_1 execution - gij test
+FAIL: SyncTest output - gij test
+FAIL: SyncTest output - bytecode->native test
+FAIL: SyncTest output - gij test
+FAIL: SyncTest -O output - bytecode->native test
+FAIL: Thread_Alive execution - gij test
+FAIL: Thread_Alive execution - gij test
+FAIL: Thread_Interrupt execution - gij test
+FAIL: Thread_Interrupt execution - gij test
+FAIL: Thread_Wait_2 execution - gij test
+FAIL: Thread_Wait_2 execution - gij test
+FAIL: Thread_Wait_Interrupt execution - gij test
+FAIL: Thread_Wait_Interrupt execution - gij test
 FAIL: Throw_2 execution - source compiled test
 FAIL: Throw_2 execution - gij test
 FAIL: Throw_2 execution - bytecode->native test
@@ -56,10 +70,10 @@
 
 		=== libjava Summary ===
 
-# of expected passes		2827
-# of unexpected failures	46
+# of expected passes		2923
+# of unexpected failures	60
 # of expected failures		16
-# of untested testcases		180
+# of untested testcases		70
 		=== libstdc++-v3 tests ===
 
Except for the FileHandleGcTest execution tests with gij, the other tests
aren't run with pthreads, thus those failures aren't regressions.  I'll
have to investigate what's going on there.  Any hints?

Bootstrapped and regtested on those two platforms.  Since --enable-threads
isn't the default there yet (and install.texi still warns about it being
unsupported), this shouldn't hurt for now.

Ok for mainline?

Before checkin, one issue needs clarification: if I regenerate Makefile.in
with the recommended automake-gcj-1.4.tar.gz, I get several additional
changes.  What is the correct version of automake for libjava work?

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University



Fri Jul 11 20:50:10 2003  Roger Sayle  <roger@eyesopen.com>
			  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* configure.in: Add new THREADCXXFLAGS variable.
  	Handle POSIX threads on alpha*-dec-osf*.
	* configure: Regenerate.
	* Makefile.am: Add THREADCXXFLAGS to AM_CXXFLAGS.
	* Makefile.in: Regenerate.

Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.303
diff -u -p -r1.303 Makefile.am
--- Makefile.am	25 Jun 2003 12:41:55 -0000	1.303
+++ Makefile.am	11 Jul 2003 19:31:01 -0000
@@ -91,7 +91,7 @@ GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE
 WARNINGS = -W -Wall
 ## We need _GNU_SOURCE defined for some Linux builds.  It doesn't hurt
 ## to always define it.
-AM_CXXFLAGS = -fno-rtti -fnon-call-exceptions \
+AM_CXXFLAGS = -fno-rtti -fnon-call-exceptions $(THREADCXXFLAGS) \
 ## Some systems don't allow `$' in identifiers by default, so we force it.
 	-fdollars-in-identifiers \
 ## Detect bugs in the verifier implementation, and maybe other places.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.159
diff -u -p -r1.159 configure.in
--- configure.in	7 Jul 2003 14:11:08 -0000	1.159
+++ configure.in	11 Jul 2003 19:31:08 -0000
@@ -432,6 +432,7 @@ case "$THREADS" in
     ;;
 esac
 
+THREADCXXFLAGS=
 THREADLDFLAGS=
 THREADLIBS=
 THREADINCS=
@@ -466,6 +467,12 @@ changequote([,])   
 	THREADLDFLAGS=-pthread
 	THREADSPEC=-lc_r
 	;;
+     alpha*-dec-osf*)
+	THREADCXXFLAGS=-pthread
+	# boehm-gc needs some functions from librt, so link that too.
+	THREADLIBS='-lpthread -lrt'
+	THREADSPEC='-lpthread -lrt'
+	;;
      *)
 	THREADLIBS=-lpthread
 	THREADSPEC=-lpthread
@@ -503,6 +510,7 @@ AC_SUBST(THREADDEPS)
 AC_SUBST(THREADOBJS)
 AC_SUBST(THREADSPEC)
 AC_SUBST(THREADLDFLAGS)
+AC_SUBST(THREADCXXFLAGS)
 
 if test -d sysdep; then true; else mkdir sysdep; fi
 AC_LINK_FILES(sysdep/$sysdeps_dir/locks.h, sysdep/locks.h)


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