From 3610e0d548721082f8b57cf3944cefc6b7605c49 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 24 May 2001 05:40:37 +0000 Subject: [PATCH] [multiple changes] 2001-05-23 Tom Tromey * posix-threads.cc (_Jv_self_cache): Renamed from self_cache. * gcj/Makefile.in: Rebuilt. * gcj/Makefile.am (gcj_HEADERS): Added libgcj-config.h. * gcj/javaprims.h: Include gcj/libgcj-config.h. * gcj/libgcj-config.h.in: New file. * libgcj.spec.in (*jc1): Added @HASH_SYNC_SPEC@. * configure: Rebuilt. * configure.in: Enable hash synchronization by default on some platforms. (HASH_SYNC_SPEC): New subst. (AC_CONFIG_HEADER): Added gcj/libgcj-config.h. Correctly use `test -z' instead of `test -n' in a couple places. (JV_HASH_SYNCHRONIZATION): Use AC_DEFINE; don't add to LIBGCJ_CXXFLAGS. * configure.host (enable_java_net_default): Initialize. (enable_hash_synchronization_default): New variable. 2001-05-23 Hans Boehm * boehm.cc (_Jv_MarkObj): Don't mark sync_info when hash synchronization in use. (_Jv_MarkArray): Likewise. (_Jv_AllocBytes): Don't check return result. (handle_out_of_memory): New function. (_Jv_InitGC): Set GC_oom_fn. (trace_one_vtable): New global. (_Jv_AllocTraceOne): New function. * configure.in: Added --enable-hash-synchronization. * defineclass.cc, prims.cc, resolve.cc, java/lang/natString.cc, java/net/natInetAddress.cc: Remove _Jv_AllocBytesChecked. * nogc.cc (_Jv_AllocObj): Throw out-of-memory. (_Jv_AllocArray): Likewise. (_Jv_AllocBytes): Likewise. (_Jv_AllocPtrFreeObject): New function. (_Jv_AllocTraceOne): Likewise. * posix-threads.cc (_Jv_ThreadRegister): Handle slow pthread_self(). (self_cache): New global. (_Jv_ThreadSelf_out_of_line): New function. * prims.cc (_Jv_AllocBytesChecked): Removed. (_Jv_ThrowNoMemory): New function. (_Jv_AllocObject): Don't check for null return from allocator. (_Jv_NewObjectArray): Likewise. (_Jv_AllocPtrFreeObject): New function. (_Jv_NewPrimArray): Allocate pointer-free object if possible. * include/javaprims.h (_Jv_AllocPtrFreeObject): Declare. (_Jv_MonitorEnter, _Jv_MonitorExit): Don't return value. * include/boehm-gc.h (_Jv_AllocObj): Define. (_Jv_AllocPtrFreeObj): Define. * include/jvm.h (_Jv_AllocPtrFreeObj): Declare. (_Jv_ThrowNoMemory): Declare. (_Jv_AllocTraceOne): Declare. (_Jv_AllocBytesChecked): Removed. * include/posix-threads.h (_Jv_MutexInit, _Jv_MutexLock, _Jv_MutexUnlock): Handle LOCK_DEBUG. (_Jv_ThreadSelf): Handle case where system pthread_self() is slow. * java/lang/Class.h (Class): Declare _Jv_AllocPtrFreeObj as friend. * java/lang/Object.h (sync_info): Conditional upon presence of hash synchronization. * java/lang/natObject.cc: Much new code to handle thin locks and hash synchronization. * java/lang/natString.cc (_Jv_AllocString): Allocate pointer-free object if possible. From-SVN: r42519 --- libjava/ChangeLog | 68 +++ libjava/boehm.cc | 79 ++- libjava/configure | 625 ++++++++++--------- libjava/configure.host | 4 + libjava/configure.in | 25 +- libjava/defineclass.cc | 24 +- libjava/gcj/Makefile.am | 2 +- libjava/gcj/Makefile.in | 65 +- libjava/gcj/javaprims.h | 19 +- libjava/gcj/libgcj-config.h.in | 5 + libjava/include/Makefile.in | 25 +- libjava/include/boehm-gc.h | 31 + libjava/include/jvm.h | 11 +- libjava/include/posix-threads.h | 163 ++++- libjava/java/lang/Class.h | 1 + libjava/java/lang/Object.h | 12 +- libjava/java/lang/natObject.cc | 952 ++++++++++++++++++++++++++++- libjava/java/lang/natString.cc | 20 +- libjava/java/net/natInetAddress.cc | 8 +- libjava/libgcj.spec.in | 2 +- libjava/nogc.cc | 28 +- libjava/posix-threads.cc | 42 +- libjava/prims.cc | 82 ++- libjava/resolve.cc | 14 +- libjava/testsuite/Makefile.in | 11 +- 25 files changed, 1890 insertions(+), 428 deletions(-) create mode 100644 libjava/gcj/libgcj-config.h.in diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3f098c22c02..0dbf84653ed 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,71 @@ +2001-05-23 Tom Tromey + + * posix-threads.cc (_Jv_self_cache): Renamed from self_cache. + * gcj/Makefile.in: Rebuilt. + * gcj/Makefile.am (gcj_HEADERS): Added libgcj-config.h. + * gcj/javaprims.h: Include gcj/libgcj-config.h. + * gcj/libgcj-config.h.in: New file. + * libgcj.spec.in (*jc1): Added @HASH_SYNC_SPEC@. + * configure: Rebuilt. + * configure.in: Enable hash synchronization by default on some + platforms. + (HASH_SYNC_SPEC): New subst. + (AC_CONFIG_HEADER): Added gcj/libgcj-config.h. + Correctly use `test -z' instead of `test -n' in a couple places. + (JV_HASH_SYNCHRONIZATION): Use AC_DEFINE; don't add to + LIBGCJ_CXXFLAGS. + * configure.host (enable_java_net_default): Initialize. + (enable_hash_synchronization_default): New variable. + +2001-05-23 Hans Boehm + + * boehm.cc (_Jv_MarkObj): Don't mark sync_info when hash + synchronization in use. + (_Jv_MarkArray): Likewise. + (_Jv_AllocBytes): Don't check return result. + (handle_out_of_memory): New function. + (_Jv_InitGC): Set GC_oom_fn. + (trace_one_vtable): New global. + (_Jv_AllocTraceOne): New function. + * configure.in: Added --enable-hash-synchronization. + * defineclass.cc, prims.cc, resolve.cc, java/lang/natString.cc, + java/net/natInetAddress.cc: Remove _Jv_AllocBytesChecked. + * nogc.cc (_Jv_AllocObj): Throw out-of-memory. + (_Jv_AllocArray): Likewise. + (_Jv_AllocBytes): Likewise. + (_Jv_AllocPtrFreeObject): New function. + (_Jv_AllocTraceOne): Likewise. + * posix-threads.cc (_Jv_ThreadRegister): Handle slow + pthread_self(). + (self_cache): New global. + (_Jv_ThreadSelf_out_of_line): New function. + * prims.cc (_Jv_AllocBytesChecked): Removed. + (_Jv_ThrowNoMemory): New function. + (_Jv_AllocObject): Don't check for null return from allocator. + (_Jv_NewObjectArray): Likewise. + (_Jv_AllocPtrFreeObject): New function. + (_Jv_NewPrimArray): Allocate pointer-free object if possible. + * include/javaprims.h (_Jv_AllocPtrFreeObject): Declare. + (_Jv_MonitorEnter, _Jv_MonitorExit): Don't return value. + * include/boehm-gc.h (_Jv_AllocObj): Define. + (_Jv_AllocPtrFreeObj): Define. + * include/jvm.h (_Jv_AllocPtrFreeObj): Declare. + (_Jv_ThrowNoMemory): Declare. + (_Jv_AllocTraceOne): Declare. + (_Jv_AllocBytesChecked): Removed. + * include/posix-threads.h (_Jv_MutexInit, _Jv_MutexLock, + _Jv_MutexUnlock): Handle LOCK_DEBUG. + (_Jv_ThreadSelf): Handle case where system pthread_self() is + slow. + * java/lang/Class.h (Class): Declare _Jv_AllocPtrFreeObj as + friend. + * java/lang/Object.h (sync_info): Conditional upon presence of + hash synchronization. + * java/lang/natObject.cc: Much new code to handle thin locks and + hash synchronization. + * java/lang/natString.cc (_Jv_AllocString): Allocate pointer-free + object if possible. + 2001-05-23 Joseph S. Myers * gij.cc (version): Update copyright year. diff --git a/libjava/boehm.cc b/libjava/boehm.cc index bec0b6fc91f..dcf99507b80 100644 --- a/libjava/boehm.cc +++ b/libjava/boehm.cc @@ -1,6 +1,6 @@ // boehm.cc - interface between libjava and Boehm GC. -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation This file is part of libgcj. @@ -97,10 +97,13 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */) if (__builtin_expect (! dt || !(dt -> get_finalizer()), false)) return mark_stack_ptr; jclass klass = dt->clas; + ptr_t p; - // Every object has a sync_info pointer. - ptr_t p = (ptr_t) obj->sync_info; - MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, obj, o1label); +# ifndef JV_HASH_SYNCHRONIZATION + // Every object has a sync_info pointer. + p = (ptr_t) obj->sync_info; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, obj, o1label); +# endif // Mark the object's class. p = (ptr_t) klass; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, obj, o2label); @@ -300,10 +303,13 @@ _Jv_MarkArray (void *addr, void *msp, void *msl, void * /*env*/) if (__builtin_expect (! dt || !(dt -> get_finalizer()), false)) return mark_stack_ptr; jclass klass = dt->clas; + ptr_t p; - // Every object has a sync_info pointer. - ptr_t p = (ptr_t) array->sync_info; - MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, array, e1label); +# ifndef JV_HASH_SYNCHRONIZATION + // Every object has a sync_info pointer. + p = (ptr_t) array->sync_info; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, array, e1label); +# endif // Mark the object's class. p = (ptr_t) klass; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, obj, o2label); @@ -326,18 +332,24 @@ _Jv_MarkArray (void *addr, void *msp, void *msl, void * /*env*/) // knows this, so in that case everything else will break, too. #define GCJ_DEFAULT_DESCR GC_MAKE_PROC(GC_GCJ_RESERVED_MARK_PROC_INDEX,0) void * -_Jv_BuildGCDescr(jclass klass) +_Jv_BuildGCDescr(jclass) { /* FIXME: We should really look at the class and build the descriptor. */ return (void *)(GCJ_DEFAULT_DESCR); } #endif -// Allocate space for a new Java object. +// Allocate some space that is known to be pointer-free. void * -_Jv_AllocObj (jsize size, jclass klass) +_Jv_AllocBytes (jsize size) { - return GC_GCJ_MALLOC (size, klass->vtable); + void *r = GC_MALLOC_ATOMIC (size); + // We have to explicitly zero memory here, as the GC doesn't + // guarantee that PTRFREE allocations are zeroed. Note that we + // don't have to do this for other allocation types because we set + // the `ok_init' flag in the type descriptor. + memset (r, 0, size); + return r; } // Allocate space for a new Java array. @@ -368,20 +380,6 @@ _Jv_AllocArray (jsize size, jclass klass) return obj; } -// Allocate some space that is known to be pointer-free. -void * -_Jv_AllocBytes (jsize size) -{ - void *r = GC_MALLOC_ATOMIC (size); - // We have to explicitly zero memory here, as the GC doesn't - // guarantee that PTRFREE allocations are zeroed. Note that we - // don't have to do this for other allocation types because we set - // the `ok_init' flag in the type descriptor. - if (__builtin_expect (r != NULL, !NULL)) - memset (r, 0, size); - return r; -} - static void call_finalizer (GC_PTR obj, GC_PTR client_data) { @@ -462,6 +460,11 @@ _Jv_EnableGC (void) _Jv_MutexUnlock (&disable_gc_mutex); } +static void * handle_out_of_memory(size_t) +{ + _Jv_ThrowNoMemory(); +} + void _Jv_InitGC (void) { @@ -484,6 +487,10 @@ _Jv_InitGC (void) // stash in the class vtable. GC_init_gcj_malloc (0, (void *) _Jv_MarkObj); + // Cause an out of memory error to be thrown from the allocators, + // instead of returning 0. This is cheaper than checking on allocation. + GC_oom_fn = handle_out_of_memory; + LOCK (); GC_java_finalization = 1; @@ -511,6 +518,28 @@ _Jv_InitGC (void) ENABLE_SIGNALS (); } +#ifdef JV_HASH_SYNCHRONIZATION +// Allocate an object with a fake vtable pointer, which causes only +// the first field (beyond the fake vtable pointer) to be traced. +// Eventually this should probably be generalized. + +static _Jv_VTable trace_one_vtable = { + 0, // class pointer + (void *)(2 * sizeof(void *)), + // descriptor; scan 2 words incl. vtable ptr. + // Least significant bits must be zero to + // identify this as a lenght descriptor + {0} // First method +}; + +void * +_Jv_AllocTraceOne (jsize size /* includes vtable slot */) +{ + return GC_GCJ_MALLOC (size, &trace_one_vtable); +} + +#endif /* JV_HASH_SYNCHRONIZATION */ + #if 0 void _Jv_InitGC (void) diff --git a/libjava/configure b/libjava/configure index b2375be8ddf..a01c5c1ea51 100755 --- a/libjava/configure +++ b/libjava/configure @@ -38,6 +38,9 @@ ac_help="$ac_help ac_help="$ac_help --disable-getenv-properties don't set system properties from GCJ_PROPERTIES" +ac_help="$ac_help + --enable-hash-synchronization + Use global hash table for monitor locks" ac_help="$ac_help --enable-libgcj-debug enable runtime debugging code" ac_help="$ac_help @@ -75,6 +78,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -189,6 +193,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -359,6 +364,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -524,12 +534,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -617,7 +631,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:621: checking host system type" >&5 +echo "configure:635: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -638,7 +652,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:642: checking target system type" >&5 +echo "configure:656: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -656,7 +670,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:660: checking build system type" >&5 +echo "configure:674: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -679,7 +693,7 @@ test "$host_alias" != "$target_alias" && program_prefix=${target_alias}- echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:683: checking whether ln -s works" >&5 +echo "configure:697: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -725,7 +739,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:729: checking for a BSD compatible install" >&5 +echo "configure:743: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -778,7 +792,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:782: checking whether build environment is sane" >&5 +echo "configure:796: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -835,7 +849,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:839: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:853: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -868,12 +882,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:872: checking for Cygwin environment" >&5 +echo "configure:886: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -901,19 +915,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:905: checking for mingw32 environment" >&5 +echo "configure:919: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -961,7 +975,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:965: checking host system type" >&5 +echo "configure:979: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -988,7 +1002,7 @@ echo "$ac_t""$host" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:992: checking for $ac_word" >&5 +echo "configure:1006: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1018,7 +1032,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1022: checking for $ac_word" >&5 +echo "configure:1036: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1069,7 +1083,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1073: checking for $ac_word" >&5 +echo "configure:1087: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1102,7 +1116,7 @@ fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1106: checking whether we are using GNU C" >&5 +echo "configure:1120: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1111,7 +1125,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1115: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1129: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1130,7 +1144,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1134: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1148: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1166,7 +1180,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1170: checking for $ac_word" >&5 +echo "configure:1184: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1199,7 +1213,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1203: checking whether we are using GNU C++" >&5 +echo "configure:1217: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1208,7 +1222,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1227,7 +1241,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1231: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1245: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1280,7 +1294,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1284: checking for working aclocal" >&5 +echo "configure:1298: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1293,7 +1307,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1297: checking for working autoconf" >&5 +echo "configure:1311: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1306,7 +1320,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1310: checking for working automake" >&5 +echo "configure:1324: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1319,7 +1333,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1323: checking for working autoheader" >&5 +echo "configure:1337: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1332,7 +1346,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1336: checking for working makeinfo" >&5 +echo "configure:1350: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1351,7 +1365,7 @@ fi # LIBGCJ_CONFIGURE, which doesn't work because that means that it will # be run before AC_CANONICAL_HOST. echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1355: checking build system type" >&5 +echo "configure:1369: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1372,7 +1386,7 @@ echo "$ac_t""$build" 1>&6 # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1376: checking for $ac_word" >&5 +echo "configure:1390: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1404,7 +1418,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1408: checking for $ac_word" >&5 +echo "configure:1422: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1436,7 +1450,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1440: checking for $ac_word" >&5 +echo "configure:1454: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1468,7 +1482,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1472: checking for $ac_word" >&5 +echo "configure:1486: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1513,7 +1527,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1517: checking for a BSD compatible install" >&5 +echo "configure:1531: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1567,7 +1581,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:1571: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:1585: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -1601,7 +1615,7 @@ if false; then echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1605: checking for executable suffix" >&5 +echo "configure:1619: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1611,10 +1625,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -1764,7 +1778,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1768: checking for ld used by GCC" >&5 +echo "configure:1782: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1794,10 +1808,10 @@ echo "configure:1768: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1798: checking for GNU ld" >&5 +echo "configure:1812: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1801: checking for non-GNU ld" >&5 +echo "configure:1815: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1832,7 +1846,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1836: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1850: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1849,7 +1863,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1853: checking for $LD option to reload object files" >&5 +echo "configure:1867: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1861,7 +1875,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1865: checking for BSD-compatible nm" >&5 +echo "configure:1879: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1899,7 +1913,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1903: checking how to recognise dependant libraries" >&5 +echo "configure:1917: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2000,7 +2014,7 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) case $host_cpu in - alpha* | i*86 | powerpc* | sparc* | ia64* ) + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM @@ -2039,6 +2053,10 @@ solaris*) lt_cv_file_magic_test_file=/lib/libc.so ;; +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in ncr) @@ -2059,13 +2077,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:2063: checking for object suffix" >&5 +echo "configure:2081: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:2069: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -2089,7 +2107,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:2093: checking for ${ac_tool_prefix}file" >&5 +echo "configure:2111: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2151,7 +2169,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:2155: checking for file" >&5 +echo "configure:2173: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2222,7 +2240,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2226: checking for $ac_word" >&5 +echo "configure:2244: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2254,7 +2272,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2258: checking for $ac_word" >&5 +echo "configure:2276: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2289,7 +2307,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2293: checking for $ac_word" >&5 +echo "configure:2311: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2321,7 +2339,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2325: checking for $ac_word" >&5 +echo "configure:2343: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2388,8 +2406,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2392 "configure"' > conftest.$ac_ext - if { (eval echo configure:2393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2410 "configure"' > conftest.$ac_ext + if { (eval echo configure:2411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2410,7 +2428,7 @@ case $host in SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2414: checking whether the C compiler needs -belf" >&5 +echo "configure:2432: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2423,14 +2441,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2460,7 +2478,7 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 esac echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:2464: checking how to run the C++ preprocessor" >&5 +echo "configure:2482: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2473,12 +2491,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2650,7 +2668,7 @@ if test "${enable_getenv_properties+set}" = set; then fi -if test -n "$enable_getenv_properties"; then +if test -z "$enable_getenv_properties"; then enable_getenv_properties=${enable_getenv_properties_default-yes} fi if test "$enable_getenv_properties" = no; then @@ -2660,6 +2678,28 @@ EOF fi + +# Check whether --enable-hash-synchronization or --disable-hash-synchronization was given. +if test "${enable_hash_synchronization+set}" = set; then + enableval="$enable_hash_synchronization" + : +fi + + +if test -z "$enable_hash_synchronization"; then + enable_hash_synchronization=$enable_hash_synchronization_default +fi +HASH_SYNC_SPEC= +if test "$enable_hash_synchronization" = yes; then + HASH_SYNC_SPEC=-fhash-synchronization + cat >> confdefs.h <<\EOF +#define JV_HASH_SYNCHRONIZATION 1 +EOF + +fi + + + LIBGCJDEBUG="false" # Check whether --enable-libgcj-debug or --disable-libgcj-debug was given. @@ -2695,7 +2735,7 @@ EOF fi echo $ac_n "checking for exception model to use""... $ac_c" 1>&6 -echo "configure:2699: checking for exception model to use" >&5 +echo "configure:2739: checking for exception model to use" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2710,7 +2750,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then : else cat > conftest.$ac_ext << EOF -#line 2714 "configure" +#line 2754 "configure" struct S { ~S(); }; void bar(); void foo() @@ -2721,7 +2761,7 @@ void foo() EOF old_CXXFLAGS="$CXXFLAGS" CXXFLAGS=-S -if { (eval echo configure:2725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then enable_sjlj_exceptions=yes elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then @@ -2753,18 +2793,18 @@ cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_exception_model_name" 1>&6 echo $ac_n "checking for data_start""... $ac_c" 1>&6 -echo "configure:2757: checking for data_start" >&5 +echo "configure:2797: checking for data_start" >&5 LIBDATASTARTSPEC= NEEDS_DATA_START= cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""found it" 1>&6 else @@ -2785,7 +2825,7 @@ if test "${enable_java_net+set}" = set; then fi -if test -n "$enable_java_net"; then +if test -z "$enable_java_net"; then enable_java_net=${enable_java_net_default-yes} fi if test "$enable_java_net" = no; then @@ -2834,7 +2874,7 @@ EOF esac echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2838: checking how to run the C preprocessor" >&5 +echo "configure:2878: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2849,13 +2889,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2899: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2866,13 +2906,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2883,13 +2923,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2914,7 +2954,7 @@ fi echo "$ac_t""$CPP" 1>&6 cat > conftest.$ac_ext < EOF @@ -2929,7 +2969,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -2944,7 +2984,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -2959,7 +2999,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -2976,7 +3016,7 @@ rm -f conftest* cat > conftest.$ac_ext < EOF @@ -2991,7 +3031,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -3035,7 +3075,7 @@ ZLIBTESTSPEC= libsubdir=.libs echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6 -echo "configure:3039: checking for garbage collector to use" >&5 +echo "configure:3079: checking for garbage collector to use" >&5 # Check whether --enable-java-gc or --disable-java-gc was given. if test "${enable_java_gc+set}" = set; then enableval="$enable_java_gc" @@ -3091,7 +3131,7 @@ esac echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6 -echo "configure:3095: checking for thread model used by GCC" >&5 +echo "configure:3135: checking for thread model used by GCC" >&5 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` echo "$ac_t""$THREADS" 1>&6 @@ -3237,12 +3277,12 @@ else for ac_func in strerror ioctl select fstat open fsync sleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3241: checking for $ac_func" >&5 +echo "configure:3281: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3292,12 +3332,12 @@ done for ac_func in gmtime_r localtime_r readdir_r getpwuid_r getcwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3296: checking for $ac_func" >&5 +echo "configure:3336: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3347,12 +3387,12 @@ done for ac_func in access stat mkdir rename rmdir unlink realpath utime chmod do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3351: checking for $ac_func" >&5 +echo "configure:3391: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3402,12 +3442,12 @@ done for ac_func in iconv nl_langinfo setlocale do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3406: checking for $ac_func" >&5 +echo "configure:3446: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3457,12 +3497,12 @@ done for ac_func in inet_aton inet_addr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3461: checking for $ac_func" >&5 +echo "configure:3501: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3512,12 +3552,12 @@ done for ac_func in inet_pton uname inet_ntoa do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3516: checking for $ac_func" >&5 +echo "configure:3556: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3567,12 +3607,12 @@ done for ac_func in backtrace fork execvp pipe do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3571: checking for $ac_func" >&5 +echo "configure:3611: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3623,17 +3663,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3627: checking for $ac_hdr" >&5 +echo "configure:3667: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3637: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3677: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3660,7 +3700,7 @@ fi done echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6 -echo "configure:3664: checking for dladdr in -ldl" >&5 +echo "configure:3704: checking for dladdr in -ldl" >&5 ac_lib_var=`echo dl'_'dladdr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3668,7 +3708,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3708,7 +3748,7 @@ do ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_file""... $ac_c" 1>&6 -echo "configure:3712: checking for $ac_file" >&5 +echo "configure:3752: checking for $ac_file" >&5 if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3743,12 +3783,12 @@ done for ac_func in gethostbyname_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3747: checking for $ac_func" >&5 +echo "configure:3787: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3798,7 +3838,7 @@ EOF # We look for the one that returns `int'. # Hopefully this check is robust enough. cat > conftest.$ac_ext < EOF @@ -3818,7 +3858,7 @@ rm -f conftest* *" -D_REENTRANT "*) ;; *) echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6 -echo "configure:3822: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5 +echo "configure:3862: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5 if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3831,14 +3871,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext < int main() { gethostbyname_r("", 0, 0); ; return 0; } EOF -if { (eval echo configure:3842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_gethostbyname_r_needs_reentrant=no else @@ -3848,14 +3888,14 @@ else CPPFLAGS_SAVE="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_REENTRANT" cat > conftest.$ac_ext < int main() { gethostbyname_r("", 0, 0); ; return 0; } EOF -if { (eval echo configure:3859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_gethostbyname_r_needs_reentrant=yes else @@ -3890,12 +3930,12 @@ EOF esac echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6 -echo "configure:3894: checking for struct hostent_data" >&5 +echo "configure:3934: checking for struct hostent_data" >&5 if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_struct_hostent_data=yes else @@ -3935,12 +3975,12 @@ done for ac_func in gethostbyaddr_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3939: checking for $ac_func" >&5 +echo "configure:3979: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3990,7 +4030,7 @@ EOF # We look for the one that returns `int'. # Hopefully this check is robust enough. cat > conftest.$ac_ext < EOF @@ -4014,12 +4054,12 @@ done for ac_func in gethostname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4018: checking for $ac_func" >&5 +echo "configure:4058: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4066,7 +4106,7 @@ EOF EOF cat > conftest.$ac_ext < EOF @@ -4097,12 +4137,12 @@ done for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4101: checking for $ac_func" >&5 +echo "configure:4141: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4155,12 +4195,12 @@ done for ac_func in sched_yield do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4159: checking for $ac_func" >&5 +echo "configure:4199: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4205,7 +4245,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6 -echo "configure:4209: checking for sched_yield in -lrt" >&5 +echo "configure:4249: checking for sched_yield in -lrt" >&5 ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4213,7 +4253,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lrt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4250,7 +4290,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6 -echo "configure:4254: checking for sched_yield in -lposix4" >&5 +echo "configure:4294: checking for sched_yield in -lposix4" >&5 ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4258,7 +4298,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4305,7 +4345,7 @@ done # We can save a little space at runtime if the mutex has m_count # or __m_count. This is a nice hack for Linux. cat > conftest.$ac_ext < int main() { @@ -4314,7 +4354,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define PTHREAD_MUTEX_HAVE_M_COUNT 1 @@ -4326,7 +4366,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < int main() { @@ -4335,7 +4375,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4339: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define PTHREAD_MUTEX_HAVE___M_COUNT 1 @@ -4355,12 +4395,12 @@ rm -f conftest* for ac_func in gettimeofday time ftime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4359: checking for $ac_func" >&5 +echo "configure:4399: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4414,12 +4454,12 @@ done for ac_func in memmove do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4418: checking for $ac_func" >&5 +echo "configure:4458: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4472,12 +4512,12 @@ done for ac_func in memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4476: checking for $ac_func" >&5 +echo "configure:4516: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4548,7 +4588,7 @@ done #-------------------------------------------------------------------- echo $ac_n "checking for socket libraries""... $ac_c" 1>&6 -echo "configure:4552: checking for socket libraries" >&5 +echo "configure:4592: checking for socket libraries" >&5 if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4556,12 +4596,12 @@ else gcj_checkBoth=0 unset ac_cv_func_connect echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:4560: checking for connect" >&5 +echo "configure:4600: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -4607,7 +4647,7 @@ fi if test "$gcj_checkSocket" = 1; then unset ac_cv_func_connect echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6 -echo "configure:4611: checking for main in -lsocket" >&5 +echo "configure:4651: checking for main in -lsocket" >&5 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4615,14 +4655,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4649,12 +4689,12 @@ fi LIBS="$LIBS -lsocket -lnsl" unset ac_cv_func_accept echo $ac_n "checking for accept""... $ac_c" 1>&6 -echo "configure:4653: checking for accept" >&5 +echo "configure:4693: checking for accept" >&5 if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_accept=yes" else @@ -4704,12 +4744,12 @@ fi gcj_oldLibs=$LIBS LIBS="$LIBS $gcj_cv_lib_sockets" echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:4708: checking for gethostbyname" >&5 +echo "configure:4748: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -4750,7 +4790,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 -echo "configure:4754: checking for main in -lnsl" >&5 +echo "configure:4794: checking for main in -lnsl" >&5 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4758,14 +4798,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4797,7 +4837,7 @@ echo "$ac_t""$gcj_cv_lib_sockets" 1>&6 if test "$with_system_zlib" = yes; then echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6 -echo "configure:4801: checking for deflate in -lz" >&5 +echo "configure:4841: checking for deflate in -lz" >&5 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4805,7 +4845,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4846,7 +4886,7 @@ fi # requires -ldl. if test "$GC" = boehm; then echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6 -echo "configure:4850: checking for main in -ldl" >&5 +echo "configure:4890: checking for main in -ldl" >&5 ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4854,14 +4894,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4927,7 +4967,7 @@ fi # Extract the first word of "${ac_tool_prefix}gcj", so it can be a program name with args. set dummy ${ac_tool_prefix}gcj; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4931: checking for $ac_word" >&5 +echo "configure:4971: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4959,7 +4999,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "gcj", so it can be a program name with args. set dummy gcj; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4963: checking for $ac_word" >&5 +echo "configure:5003: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5021,7 +5061,7 @@ exec 5>>./config.log CPPFLAGS=$GCJ_SAVE_CPPFLAGS echo $ac_n "checking size of void *""... $ac_c" 1>&6 -echo "configure:5025: checking size of void *" >&5 +echo "configure:5065: checking size of void *" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5029,7 +5069,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -5040,7 +5080,7 @@ main() exit(0); } EOF -if { (eval echo configure:5044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_void_p=`cat conftestval` else @@ -5138,18 +5178,18 @@ EOF echo $ac_n "checking for g++ -ffloat-store bug""... $ac_c" 1>&6 -echo "configure:5142: checking for g++ -ffloat-store bug" >&5 +echo "configure:5182: checking for g++ -ffloat-store bug" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-x c++ -O2 -ffloat-store" cat > conftest.$ac_ext < int main() { ; return 0; } EOF -if { (eval echo configure:5153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""no" 1>&6 else @@ -5169,17 +5209,17 @@ for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5173: checking for $ac_hdr" >&5 +echo "configure:5213: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5209,17 +5249,17 @@ for ac_hdr in dirent.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5213: checking for $ac_hdr" >&5 +echo "configure:5253: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5247,12 +5287,12 @@ done echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:5251: checking for ANSI C header files" >&5 +echo "configure:5291: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5260,7 +5300,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5264: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5277,7 +5317,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -5295,7 +5335,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -5316,7 +5356,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -5327,7 +5367,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:5331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -5351,12 +5391,12 @@ EOF fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:5355: checking for ssize_t" >&5 +echo "configure:5395: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5385,9 +5425,9 @@ fi echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6 -echo "configure:5389: checking for in_addr_t" >&5 +echo "configure:5429: checking for in_addr_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5401,7 +5441,7 @@ int main() { in_addr_t foo; ; return 0; } EOF -if { (eval echo configure:5405: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_IN_ADDR_T 1 @@ -5417,16 +5457,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:5421: checking whether struct ip_mreq is in netinet/in.h" >&5 +echo "configure:5461: checking whether struct ip_mreq is in netinet/in.h" >&5 cat > conftest.$ac_ext < int main() { struct ip_mreq mreq; ; return 0; } EOF -if { (eval echo configure:5430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STRUCT_IP_MREQ 1 @@ -5442,16 +5482,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:5446: checking whether struct sockaddr_in6 is in netinet/in.h" >&5 +echo "configure:5486: checking whether struct sockaddr_in6 is in netinet/in.h" >&5 cat > conftest.$ac_ext < int main() { struct sockaddr_in6 addr6; ; return 0; } EOF -if { (eval echo configure:5455: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5495: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_INET6 1 @@ -5467,9 +5507,9 @@ fi rm -f conftest* echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6 -echo "configure:5471: checking for socklen_t in sys/socket.h" >&5 +echo "configure:5511: checking for socklen_t in sys/socket.h" >&5 cat > conftest.$ac_ext < #include @@ -5477,7 +5517,7 @@ int main() { socklen_t x = 5; ; return 0; } EOF -if { (eval echo configure:5481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5521: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_SOCKLEN_T 1 @@ -5493,16 +5533,16 @@ fi rm -f conftest* echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:5497: checking for tm_gmtoff in struct tm" >&5 +echo "configure:5537: checking for tm_gmtoff in struct tm" >&5 cat > conftest.$ac_ext < int main() { struct tm tim; tim.tm_gmtoff = 0; ; return 0; } EOF -if { (eval echo configure:5506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5546: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define STRUCT_TM_HAS_GMTOFF 1 @@ -5515,16 +5555,16 @@ else rm -rf conftest* echo "$ac_t""no" 1>&6 echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6 -echo "configure:5519: checking for global timezone variable" >&5 +echo "configure:5559: checking for global timezone variable" >&5 cat > conftest.$ac_ext < int main() { long z2 = timezone; ; return 0; } EOF -if { (eval echo configure:5528: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TIMEZONE 1 @@ -5544,19 +5584,19 @@ rm -f conftest* # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:5548: checking for working alloca.h" >&5 +echo "configure:5588: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:5560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -5577,12 +5617,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:5581: checking for alloca" >&5 +echo "configure:5621: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -5642,12 +5682,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:5646: checking whether alloca needs Cray hooks" >&5 +echo "configure:5686: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5676: checking for $ac_func" >&5 +echo "configure:5716: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5727,7 +5767,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:5731: checking stack direction for C alloca" >&5 +echo "configure:5771: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5735,7 +5775,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -5781,7 +5821,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5785: checking for $ac_word" >&5 +echo "configure:5825: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5853,7 +5893,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:5857: checking for X" >&5 +echo "configure:5897: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -5915,12 +5955,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5989,14 +6029,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -6102,17 +6142,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:6106: checking whether -R must be followed by a space" >&5 +echo "configure:6146: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -6128,14 +6168,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -6167,7 +6207,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:6171: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:6211: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6175,7 +6215,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6208,7 +6248,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:6212: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:6252: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6216,7 +6256,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6256,12 +6296,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:6260: checking for gethostbyname" >&5 +echo "configure:6300: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -6305,7 +6345,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:6309: checking for gethostbyname in -lnsl" >&5 +echo "configure:6349: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6313,7 +6353,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6354,12 +6394,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:6358: checking for connect" >&5 +echo "configure:6398: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -6403,7 +6443,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:6407: checking for connect in -lsocket" >&5 +echo "configure:6447: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6411,7 +6451,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6446,12 +6486,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:6450: checking for remove" >&5 +echo "configure:6490: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -6495,7 +6535,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:6499: checking for remove in -lposix" >&5 +echo "configure:6539: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6503,7 +6543,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6538,12 +6578,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:6542: checking for shmat" >&5 +echo "configure:6582: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -6587,7 +6627,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:6591: checking for shmat in -lipc" >&5 +echo "configure:6631: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6595,7 +6635,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6639,7 +6679,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:6643: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:6683: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6647,7 +6687,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6840,7 +6880,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile libgcj.spec libgcj-test.spec gnu/classpath/Configuration.java gcj/Makefile include/Makefile testsuite/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile libgcj.spec libgcj-test.spec gnu/classpath/Configuration.java gcj/Makefile include/Makefile testsuite/Makefile include/config.h gcj/libgcj-config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi @@ -7243,7 +7284,15 @@ CXX="${CXX}" EOF cat >> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > include/stamp-h +am_indx=1 +for am_file in include/config.h gcj/libgcj-config.h; do + case " $CONFIG_HEADERS " in + *" $am_file "*) + echo timestamp > `echo $am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "$am_indx" + 1` +done if test -n "$CONFIG_FILES"; then ac_file=Makefile . ${libgcj_basedir}/../config-ml.in fi diff --git a/libjava/configure.host b/libjava/configure.host index f4f673f61f3..079cccebad2 100644 --- a/libjava/configure.host +++ b/libjava/configure.host @@ -24,6 +24,8 @@ libgcj_cflags= libgcj_cxxflags= libgcj_javaflags= libgcj_interpreter= +enable_java_net_default=yes +enable_hash_synchronization_default=no case "${target_optspace}:${host}" in yes:*) @@ -63,6 +65,7 @@ case "${host}" in libgcj_cxxflags="-D__NO_MATH_INLINES" libgcj_cflags="-D__NO_MATH_INLINES" DIVIDESPEC=-fno-use-divide-subroutine + enable_hash_synchronization_default=yes ;; alpha*-*) libgcj_flags="${libgcj_flags} -mieee" @@ -76,6 +79,7 @@ case "${host}" in ia64-*) libgcj_flags="${libgcj_flags} -funwind-tables" libgcj_interpreter=yes + enable_hash_synchronization_default=yes ;; esac diff --git a/libjava/configure.in b/libjava/configure.in index b6b9baf8e7e..90837b3056f 100644 --- a/libjava/configure.in +++ b/libjava/configure.in @@ -16,7 +16,7 @@ AC_ARG_WITH(cross-host, LIBGCJ_CONFIGURE(.) -AM_CONFIG_HEADER(include/config.h) +AM_CONFIG_HEADER(include/config.h gcj/libgcj-config.h) # Only use libltdl for native builds. if test -z "${with_cross_host}"; then @@ -57,13 +57,32 @@ AC_ARG_ENABLE(getenv-properties, don't set system properties from GCJ_PROPERTIES]) dnl Whether GCJ_PROPERTIES is used depends on the target. -if test -n "$enable_getenv_properties"; then +if test -z "$enable_getenv_properties"; then enable_getenv_properties=${enable_getenv_properties_default-yes} fi if test "$enable_getenv_properties" = no; then AC_DEFINE(DISABLE_GETENV_PROPERTIES) fi + +dnl Should we use hashtable-based synchronization? +dnl Currently works only for Linux X86/ia64 +dnl Typically faster and more space-efficient +AC_ARG_ENABLE(hash-synchronization, +[ --enable-hash-synchronization + Use global hash table for monitor locks]) + +if test -z "$enable_hash_synchronization"; then + enable_hash_synchronization=$enable_hash_synchronization_default +fi +HASH_SYNC_SPEC= +if test "$enable_hash_synchronization" = yes; then + HASH_SYNC_SPEC=-fhash-synchronization + AC_DEFINE(JV_HASH_SYNCHRONIZATION) +fi +AC_SUBST(HASH_SYNC_SPEC) + + dnl See if the user has requested runtime debugging. LIBGCJDEBUG="false" AC_SUBST(LIBGCJDEBUG) @@ -150,7 +169,7 @@ AC_ARG_ENABLE(java-net, [ --disable-java-net disable java.net]) dnl Whether java.net is built by default can depend on the target. -if test -n "$enable_java_net"; then +if test -z "$enable_java_net"; then enable_java_net=${enable_java_net_default-yes} fi if test "$enable_java_net" = no; then diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc index c309394212e..edf14cb098e 100644 --- a/libjava/defineclass.cc +++ b/libjava/defineclass.cc @@ -360,8 +360,8 @@ _Jv_ClassReader::parse () void _Jv_ClassReader::read_constpool () { - tags = (unsigned char*) _Jv_AllocBytesChecked (pool_count); - offsets = (unsigned int *) _Jv_AllocBytesChecked (sizeof (int) + tags = (unsigned char*) _Jv_AllocBytes (pool_count); + offsets = (unsigned int *) _Jv_AllocBytes (sizeof (int) * pool_count) ; /** first, we scan the constant pool, collecting tags and offsets */ @@ -625,9 +625,9 @@ void _Jv_ClassReader::handleConstantPool () /** now, we actually define the class' constant pool */ // the pool is scanned explicitly by the collector - jbyte *pool_tags = (jbyte*) _Jv_AllocBytesChecked (pool_count); + jbyte *pool_tags = (jbyte*) _Jv_AllocBytes (pool_count); _Jv_word *pool_data - = (_Jv_word*) _Jv_AllocBytesChecked (pool_count * sizeof (_Jv_word)); + = (_Jv_word*) _Jv_AllocBytes (pool_count * sizeof (_Jv_word)); def->constants.tags = pool_tags; def->constants.data = pool_data; @@ -965,7 +965,7 @@ _Jv_ClassReader::checkExtends (jclass sub, jclass super) void _Jv_ClassReader::handleInterfacesBegin (int count) { - def->interfaces = (jclass*) _Jv_AllocBytesChecked (count*sizeof (jclass)); + def->interfaces = (jclass*) _Jv_AllocBytes (count*sizeof (jclass)); def->interface_count = count; } @@ -1032,10 +1032,10 @@ _Jv_ClassReader::checkImplements (jclass sub, jclass super) void _Jv_ClassReader::handleFieldsBegin (int count) { def->fields = (_Jv_Field*) - _Jv_AllocBytesChecked (count * sizeof (_Jv_Field)); + _Jv_AllocBytes (count * sizeof (_Jv_Field)); def->field_count = count; def->field_initializers = (_Jv_ushort*) - _Jv_AllocBytesChecked (count * sizeof (_Jv_ushort)); + _Jv_AllocBytes (count * sizeof (_Jv_ushort)); for (int i = 0; i < count; i++) def->field_initializers[i] = (_Jv_ushort) 0; } @@ -1172,11 +1172,11 @@ void _Jv_ClassReader::handleMethodsBegin (int count) { def->methods = (_Jv_Method*) - _Jv_AllocBytesChecked (sizeof (_Jv_Method)*count); + _Jv_AllocBytes (sizeof (_Jv_Method)*count); def->interpreted_methods - = (_Jv_MethodBase **) _Jv_AllocBytesChecked (sizeof (_Jv_MethodBase *) - * count); + = (_Jv_MethodBase **) _Jv_AllocBytes (sizeof (_Jv_MethodBase *) + * count); for (int i = 0; i < count; i++) def->interpreted_methods[i] = 0; @@ -1235,7 +1235,7 @@ void _Jv_ClassReader::handleCodeAttribute { int size = _Jv_InterpMethod::size (exc_table_length, code_length); _Jv_InterpMethod *method = - (_Jv_InterpMethod*) (_Jv_AllocBytesChecked (size)); + (_Jv_InterpMethod*) (_Jv_AllocBytes (size)); method->max_stack = max_stack; method->max_locals = max_locals; @@ -1282,7 +1282,7 @@ void _Jv_ClassReader::handleMethodsEnd () else { _Jv_JNIMethod *m = (_Jv_JNIMethod *) - _Jv_AllocBytesChecked (sizeof (_Jv_JNIMethod)); + _Jv_AllocBytes (sizeof (_Jv_JNIMethod)); m->defining_class = def; m->self = method; m->function = NULL; diff --git a/libjava/gcj/Makefile.am b/libjava/gcj/Makefile.am index 4b1d8c0569d..aa5f6fb16cb 100644 --- a/libjava/gcj/Makefile.am +++ b/libjava/gcj/Makefile.am @@ -3,4 +3,4 @@ AUTOMAKE_OPTIONS = foreign gcjdir = $(includedir)/gcj -gcj_HEADERS = array.h cni.h field.h javaprims.h method.h +gcj_HEADERS = array.h cni.h field.h javaprims.h method.h libgcj-config.h diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in index 0df9a7bbacb..1b58ce4ab2f 100644 --- a/libjava/gcj/Makefile.in +++ b/libjava/gcj/Makefile.in @@ -85,6 +85,7 @@ GCLIBS = @GCLIBS@ GCOBJS = @GCOBJS@ GCSPEC = @GCSPEC@ GCTESTSPEC = @GCTESTSPEC@ +HASH_SYNC_SPEC = @HASH_SYNC_SPEC@ INCLTDL = @INCLTDL@ JC1GCSPEC = @JC1GCSPEC@ LIBDATASTARTSPEC = @LIBDATASTARTSPEC@ @@ -123,13 +124,13 @@ libgcj_basedir = @libgcj_basedir@ AUTOMAKE_OPTIONS = foreign gcjdir = $(includedir)/gcj -gcj_HEADERS = array.h cni.h field.h javaprims.h method.h +gcj_HEADERS = array.h cni.h field.h javaprims.h method.h libgcj-config.h mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = ../include/config.h +CONFIG_HEADER = ../include/config.h libgcj-config.h CONFIG_CLEAN_FILES = HEADERS = $(gcj_HEADERS) -DIST_COMMON = Makefile.am Makefile.in +DIST_COMMON = ./stamp-h2.in Makefile.am Makefile.in libgcj-config.h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -146,6 +147,34 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +libgcj-config.h: stamp-h2 + @if test ! -f $@; then \ + rm -f stamp-h2; \ + $(MAKE) stamp-h2; \ + else :; fi +stamp-h2: $(srcdir)/libgcj-config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=gcj/libgcj-config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h2 2> /dev/null +$(srcdir)/libgcj-config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h2.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h2.in; \ + $(MAKE) $(srcdir)/stamp-h2.in; \ + else :; fi +$(srcdir)/stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h2.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f libgcj-config.h + +maintainer-clean-hdr: + install-gcjHEADERS: $(gcj_HEADERS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(gcjdir) @@ -171,15 +200,15 @@ ID: $(HEADERS) $(SOURCES) $(LISP) here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) +TAGS: $(HEADERS) $(SOURCES) libgcj-config.h.in $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + test -z "$(ETAGS_ARGS)libgcj-config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags libgcj-config.h.in $$unique $(LISP) -o $$here/TAGS) mostlyclean-tags: @@ -218,6 +247,9 @@ check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am +all-recursive-am: libgcj-config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + install-exec-am: install-exec: install-exec-am @@ -229,7 +261,7 @@ install-am: all-am install: install-am uninstall-am: uninstall-gcjHEADERS uninstall: uninstall-am -all-am: Makefile $(HEADERS) +all-am: Makefile $(HEADERS) libgcj-config.h all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install @@ -246,31 +278,32 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -mostlyclean-am: mostlyclean-tags mostlyclean-generic +mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic mostlyclean: mostlyclean-am -clean-am: clean-tags clean-generic mostlyclean-am +clean-am: clean-hdr clean-tags clean-generic mostlyclean-am clean: clean-am -distclean-am: distclean-tags distclean-generic clean-am +distclean-am: distclean-hdr distclean-tags distclean-generic clean-am -rm -f libtool distclean: distclean-am -maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ - distclean-am +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \ + maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am -.PHONY: uninstall-gcjHEADERS install-gcjHEADERS tags mostlyclean-tags \ +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +uninstall-gcjHEADERS install-gcjHEADERS tags mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all installdirs \ +dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean diff --git a/libjava/gcj/javaprims.h b/libjava/gcj/javaprims.h index 71558daee27..a6111f8f777 100644 --- a/libjava/gcj/javaprims.h +++ b/libjava/gcj/javaprims.h @@ -1,6 +1,6 @@ // javaprims.h - Main external header file for libgcj. -*- c++ -*- -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation This file is part of libgcj. @@ -14,6 +14,8 @@ details. */ // Force C++ compiler to use Java-style exceptions. #pragma GCC java_exceptions +#include + // FIXME: this is a hack until we get a proper gcjh. // It is needed to work around system header files that define TRUE // and FALSE. @@ -367,14 +369,24 @@ typedef struct _Jv_Field *jfieldID; typedef struct _Jv_Method *jmethodID; extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__)); +#ifdef JV_HASH_SYNCHRONIZATION + extern "C" jobject _Jv_AllocPtrFreeObject (jclass, jint) + __attribute__((__malloc__)); +#else + // Collector still needs to scan sync_info + static inline jobject _Jv_AllocPtrFreeObject (jclass klass, jint sz) + { + return _Jv_AllocObject(klass, sz); + } +#endif extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass); extern "C" jstring _Jv_AllocString(jsize) __attribute__((__malloc__)); extern "C" jstring _Jv_NewString (const jchar*, jsize) __attribute__((__malloc__)); extern jint _Jv_FormatInt (jchar* bufend, jint num); extern "C" jchar* _Jv_GetStringChars (jstring str); -extern "C" jint _Jv_MonitorEnter (jobject); -extern "C" jint _Jv_MonitorExit (jobject); +extern "C" void _Jv_MonitorEnter (jobject); +extern "C" void _Jv_MonitorExit (jobject); extern "C" jstring _Jv_NewStringLatin1(const char*, jsize) __attribute__((__malloc__)); extern "C" jsize _Jv_GetStringUTFLength (jstring); @@ -400,4 +412,5 @@ struct _Jv_Utf8Const char data[1]; /* In Utf8 format, with final '\0'. */ }; + #endif /* __JAVAPRIMS_H__ */ diff --git a/libjava/gcj/libgcj-config.h.in b/libjava/gcj/libgcj-config.h.in new file mode 100644 index 00000000000..8bc71e7a2e1 --- /dev/null +++ b/libjava/gcj/libgcj-config.h.in @@ -0,0 +1,5 @@ +/* The header derived from this file is installed, so this file should + only contain defines which are named safely. */ + +/* Define if hash synchronization is in use. */ +#undef JV_HASH_SYNCHRONIZATION diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in index 541fa325bd3..a911f316b77 100644 --- a/libjava/include/Makefile.in +++ b/libjava/include/Makefile.in @@ -85,6 +85,7 @@ GCLIBS = @GCLIBS@ GCOBJS = @GCOBJS@ GCSPEC = @GCSPEC@ GCTESTSPEC = @GCTESTSPEC@ +HASH_SYNC_SPEC = @HASH_SYNC_SPEC@ INCLTDL = @INCLTDL@ JC1GCSPEC = @JC1GCSPEC@ LIBDATASTARTSPEC = @LIBDATASTARTSPEC@ @@ -124,11 +125,11 @@ AUTOMAKE_OPTIONS = foreign include_HEADERS = jni.h jvmpi.h mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = config.h +CONFIG_HEADER = config.h ../gcj/libgcj-config.h CONFIG_CLEAN_FILES = HEADERS = $(include_HEADERS) -DIST_COMMON = ./stamp-h.in Makefile.am Makefile.in config.h.in +DIST_COMMON = ./stamp-h1.in Makefile.am Makefile.in config.h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -145,24 +146,24 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -config.h: stamp-h +config.h: stamp-h1 @if test ! -f $@; then \ - rm -f stamp-h; \ - $(MAKE) stamp-h; \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ else :; fi -stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=include/config.h \ $(SHELL) ./config.status - @echo timestamp > stamp-h 2> /dev/null -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in + @echo timestamp > stamp-h1 2> /dev/null +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h1.in @if test ! -f $@; then \ - rm -f $(srcdir)/stamp-h.in; \ - $(MAKE) $(srcdir)/stamp-h.in; \ + rm -f $(srcdir)/stamp-h1.in; \ + $(MAKE) $(srcdir)/stamp-h1.in; \ else :; fi -$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) +$(srcdir)/stamp-h1.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) - @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + @echo timestamp > $(srcdir)/stamp-h1.in 2> /dev/null mostlyclean-hdr: diff --git a/libjava/include/boehm-gc.h b/libjava/include/boehm-gc.h index fa4e8d04633..cd421a44358 100644 --- a/libjava/include/boehm-gc.h +++ b/libjava/include/boehm-gc.h @@ -21,4 +21,35 @@ extern "C" JV_MARKARRAY_DECL; }; +// Enough stuff to inline _Jv_AllocObj. Ugly. +#include +#include +#include + +extern "C" void * GC_gcj_malloc(size_t, void *); +extern "C" void * GC_malloc_atomic(size_t); + +inline void * +_Jv_AllocObj (jsize size, jclass klass) +{ + // This should call GC_GCJ_MALLOC, but that would involve + // including gc.h. + return GC_gcj_malloc (size, klass->vtable); +} + +inline void * +_Jv_AllocPtrFreeObj (jsize size, jclass klass) +{ +#ifdef JV_HASH_SYNCHRONIZATION + void * obj = GC_malloc_atomic(size); + *((_Jv_VTable **) obj) = klass->vtable; +#else + void * obj = GC_gcj_malloc(size, klass->vtable); +#endif + return obj; +} + +// _Jv_AllocBytes (jsize size) should go here, too. But clients don't +// usually include this header. + #endif /* __JV_BOEHM_GC__ */ diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index 50af7569fb2..9088df1a414 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -107,10 +107,18 @@ typedef void _Jv_FinalizerFunc (jobject); /* Allocate space for a new Java object. */ void *_Jv_AllocObj (jsize size, jclass cl) __attribute__((__malloc__)); +/* Allocate space for a potentially uninitialized pointer-free object. + Interesting only with JV_HASH_SYNCHRONIZATION. */ +void *_Jv_AllocPtrFreeObj (jsize size, jclass cl) __attribute__((__malloc__)); /* Allocate space for an array of Java objects. */ void *_Jv_AllocArray (jsize size, jclass cl) __attribute__((__malloc__)); /* Allocate space that is known to be pointer-free. */ void *_Jv_AllocBytes (jsize size) __attribute__((__malloc__)); +/* Explicitly throw an out-of-memory exception. */ +void _Jv_ThrowNoMemory(); +/* Allocate an object with a single pointer. The first word is reserved + for the GC, and the second word is the traced pointer. */ +void *_Jv_AllocTraceOne (jsize size /* incl. reserved slot */); /* Initialize the GC. */ void _Jv_InitGC (void); /* Register a finalizer. */ @@ -157,9 +165,6 @@ void _Jv_SetInitialHeapSize (const char *arg); _Jv_GCSetMaximumHeapSize. */ void _Jv_SetMaximumHeapSize (const char *arg); -/* Allocate some unscanned bytes. Throw exception if out of memory. */ -void *_Jv_AllocBytesChecked (jsize size) __attribute__((__malloc__)); - extern "C" void JvRunMain (jclass klass, int argc, const char **argv); void _Jv_RunMain (const char* name, int argc, const char **argv, bool is_jar); diff --git a/libjava/include/posix-threads.h b/libjava/include/posix-threads.h index ad09bedd45a..e033209d088 100644 --- a/libjava/include/posix-threads.h +++ b/libjava/include/posix-threads.h @@ -1,7 +1,7 @@ // -*- c++ -*- // posix-threads.h - Defines for using POSIX threads. -/* Copyright (C) 1998, 1999 Free Software Foundation +/* Copyright (C) 1998, 1999, 2001 Free Software Foundation This file is part of libgcj. @@ -106,10 +106,21 @@ _Jv_CondInit (_Jv_ConditionVariable_t *cv) // Mutexes. // +#ifdef LOCK_DEBUG +# include +#endif + inline void _Jv_MutexInit (_Jv_Mutex_t *mu) { +# ifdef LOCK_DEBUG /* Assumes Linuxthreads */ + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); + pthread_mutex_init (&mu->mutex, &attr); +# else pthread_mutex_init (&mu->mutex, 0); +# endif mu->count = 0; mu->owner = 0; @@ -125,7 +136,16 @@ _Jv_MutexLock (_Jv_Mutex_t *mu) } else { - pthread_mutex_lock (&mu->mutex); +# ifdef LOCK_DEBUG + int result = pthread_mutex_lock (&mu->mutex); + if (0 != result) + { + fprintf(stderr, "Pthread_mutex_lock returned %d\n", result); + for (;;) {} + } +# else + pthread_mutex_lock (&mu->mutex); +# endif mu->count = 1; mu->owner = self; } @@ -136,14 +156,29 @@ inline int _Jv_MutexUnlock (_Jv_Mutex_t *mu) { if (_Jv_PthreadCheckMonitor (mu)) - return 1; + { +# ifdef LOCK_DEBUG + fprintf(stderr, "_Jv_MutexUnlock: Not owner\n"); + for (;;) {} +# endif + return 1; + } mu->count--; if (mu->count == 0) { mu->owner = 0; - pthread_mutex_unlock (&mu->mutex); +# ifdef LOCK_DEBUG + int result = pthread_mutex_unlock (&mu->mutex); + if (0 != result) + { + fprintf(stderr, "Pthread_mutex_unlock returned %d\n", result); + for (;;) {} + } +# else + pthread_mutex_unlock (&mu->mutex); +# endif } return 0; } @@ -179,6 +214,126 @@ _Jv_ThreadCurrent (void) return (java::lang::Thread *) pthread_getspecific (_Jv_ThreadKey); } +#ifdef JV_HASH_SYNCHRONIZATION +// Should be specialized to just load the "current thread" register +// on platforms that support it. Speed is of the essence. The value +// of the descriptor is not, so long as there is a one-to-one correspondence +// to threads. + + +#ifdef __i386__ + +#define SLOW_PTHREAD_SELF + // Add a cache for pthread_self() if we don't have the thread + // pointer in a register. + +#endif /* __i386__ */ + +#ifdef __ia64__ + +typedef size_t _Jv_ThreadId_t; + +register size_t _Jv_self __asm__("r13"); + // For linux_threads this is really a pointer to its thread data + // structure. We treat it as opaque. That should also work + // on other operating systems that follow the ABI standard. + +// This should become the prototype for machines that maintain a thread +// pointer in a register. +inline _Jv_ThreadId_t +_Jv_ThreadSelf (void) +{ + return _Jv_self; +} + +#define JV_SELF_DEFINED + +#endif /* __ia64__ */ + +#if defined(SLOW_PTHREAD_SELF) + +typedef pthread_t _Jv_ThreadId_t; + +// E.g. on X86 Linux, pthread_self() is too slow for our purpose. +// Instead we maintain a cache based on the current sp value. +// This is similar to what's done for thread local allocation in the +// GC, only far simpler. +// This code should probably go away when Linux/X86 starts using a +// segment register to hold the thread id. +# define LOG_THREAD_SPACING 12 + // If two thread pointer values are closer than + // 1 << LOG_THREAD_SPACING, we assume they belong + // to the same thread. +# define SELF_CACHE_SIZE 1024 +# define SC_INDEX(sp) (((unsigned long)(sp) >> 19) & (SELF_CACHE_SIZE-1)) + // Mapping from sp value to cache index. + // Note that this is not in any real sense a hash + // function, since we need to be able to clear + // all possibly matching slots on thread startup. + // Thus all entries that might correspond to + // a given thread are intentionally contiguous. + // Works well with anything that allocates at least + // 512KB stacks. +# define SC_CLEAR_MIN (-16) // When starting a new thread, we clear +# define SC_CLEAR_MAX 0 // all self cache entries between + // SC_INDEX(sp)+SC_CLEAR_MIN and + // SC_INDEX(sp)+SC_CLEAR_MAX to ensure + // we never see stale values. The + // current values assume a downward + // growing stack of size <= 7.5 MB. +# define BAD_HIGH_SP_VALUE ((size_t)(-1)) + +extern volatile +struct self_cache_entry { + size_t high_sp_bits; // sp value >> LOG_THREAD_SPACING + pthread_t self; // Corresponding thread +} _Jv_self_cache[]; + +void _Jv_Self_Cache_Init(); + +_Jv_ThreadId_t +_Jv_ThreadSelf_out_of_line(volatile self_cache_entry *sce, + size_t high_sp_bits); + +inline _Jv_ThreadId_t +_Jv_ThreadSelf (void) +{ + int dummy; + size_t sp = (size_t)(&dummy); + unsigned h = SC_INDEX(sp); + volatile self_cache_entry *sce = _Jv_self_cache + h; + pthread_t candidate_self = sce -> self; // Read must precede following one. + // Read barrier goes here, if needed. + if (sce -> high_sp_bits == sp >> LOG_THREAD_SPACING) + { + // The sce -> self value we read must be valid. An intervening + // cache replacement by another thread would have first replaced + // high_sp_bits by something else, and it can't possibly change + // back without our intervention. + return candidate_self; + } + else + return _Jv_ThreadSelf_out_of_line(sce, sp >> LOG_THREAD_SPACING); +} + +#define JV_SELF_DEFINED + +#endif /* SLOW_PTHREAD_SELF */ + +#ifndef JV_SELF_DEFINED /* If all else fails, call pthread_self directly */ + +typedef pthread_t _Jv_ThreadId_t; + +inline _Jv_ThreadId_t +_Jv_ThreadSelf (void) +{ + return pthread_self(); +} + +#endif /* !JV_SELF_DEFINED */ + +#endif /* JV_HASH_SYNCHRONIZATION */ + inline _Jv_Thread_t * _Jv_ThreadCurrentData (void) { diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index 8cce30f3f6e..4986dbf391b 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -267,6 +267,7 @@ private: friend jobject _Jv_AllocObject (jclass, jint); friend void *_Jv_AllocObj (jint, jclass); + friend void *_Jv_AllocPtrFreeObj (jint, jclass); friend void *_Jv_AllocArray (jint, jclass); friend jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv *, jclass, jfieldID, diff --git a/libjava/java/lang/Object.h b/libjava/java/lang/Object.h index 352d48b501d..93e207fc467 100644 --- a/libjava/java/lang/Object.h +++ b/libjava/java/lang/Object.h @@ -42,8 +42,8 @@ public: void wait (void); void wait (jlong timeout); - friend jint _Jv_MonitorEnter (jobject obj); - friend jint _Jv_MonitorExit (jobject obj); + friend void _Jv_MonitorEnter (jobject obj); + friend void _Jv_MonitorExit (jobject obj); friend void _Jv_InitializeSyncMutex (void); friend void _Jv_FinalizeObject (jobject obj); @@ -63,10 +63,12 @@ private: // This does not actually refer to a Java object. Instead it is a // placeholder for a piece of internal data (the synchronization // information). - jobject sync_info; +# ifndef JV_HASH_SYNCHRONIZATION + jobject sync_info; +# endif - // Initialize the sync_info field. - void sync_init (void); + // Initialize the sync_info field. Not called with JV_HASH_SYNCHRONIZATION. + void sync_init (void); }; #endif /* __JAVA_LANG_OBJECT_H__ */ diff --git a/libjava/java/lang/natObject.cc b/libjava/java/lang/natObject.cc index 3ea073ba057..fb2c6d45355 100644 --- a/libjava/java/lang/natObject.cc +++ b/libjava/java/lang/natObject.cc @@ -28,6 +28,10 @@ details. */ #include #include +#ifdef LOCK_DEBUG +# include +#endif + // This is used to represent synchronization information. @@ -100,11 +104,26 @@ java::lang::Object::clone (void) return r; } +void +_Jv_FinalizeObject (jobject obj) +{ + // Ignore exceptions. From section 12.6 of the Java Language Spec. + try + { + obj->finalize (); + } + catch (java::lang::Throwable *t) + { + // Ignore. + } +} + // // Synchronization code. // +#ifndef JV_HASH_SYNCHRONIZATION // This global is used to make sure that only one thread sets an // object's `sync_info' field. static _Jv_Mutex_t sync_mutex; @@ -153,7 +172,7 @@ java::lang::Object::sync_init (void) // been finalized. So if we just reinitialize the old one, // we'll never be able to (re-)destroy the mutex and/or // condition variable. - si = (_Jv_SyncInfo *) _Jv_AllocBytesChecked (sizeof (_Jv_SyncInfo)); + si = (_Jv_SyncInfo *) _Jv_AllocBytes (sizeof (_Jv_SyncInfo)); _Jv_MutexInit (&si->mutex); _Jv_CondInit (&si->condition); #if defined (_Jv_HaveCondDestroy) || defined (_Jv_HaveMutexDestroy) @@ -219,7 +238,7 @@ _Jv_InitializeSyncMutex (void) _Jv_MutexInit (&sync_mutex); } -jint +void _Jv_MonitorEnter (jobject obj) { #ifndef HANDLE_SEGV @@ -229,10 +248,12 @@ _Jv_MonitorEnter (jobject obj) if (__builtin_expect (INIT_NEEDED (obj), false)) obj->sync_init (); _Jv_SyncInfo *si = (_Jv_SyncInfo *) obj->sync_info; - return _Jv_MutexLock (&si->mutex); + _Jv_MutexLock (&si->mutex); + // FIXME: In the Windows case, this can return a nonzero error code. + // We should turn that into some exception ... } -jint +void _Jv_MonitorExit (jobject obj) { JvAssert (obj); @@ -240,19 +261,928 @@ _Jv_MonitorExit (jobject obj) _Jv_SyncInfo *si = (_Jv_SyncInfo *) obj->sync_info; if (__builtin_expect (_Jv_MutexUnlock (&si->mutex), false)) throw new java::lang::IllegalMonitorStateException; - return 0; } +#else /* JV_HASH_SYNCHRONIZATION */ + +// FIXME: We shouldn't be calling GC_register_finalizer directly. +#ifndef HAVE_BOEHM_GC +# error Hash synchronization currently requires boehm-gc +// That's actually a bit of a lie: It should also work with the null GC, +// probably even better than the alternative. +// To really support alternate GCs here, we would need to widen the +// interface to finalization, since we sometimes have to register a +// second finalizer for an object that already has one. +// We might also want to move the GC interface to a .h file, since +// the number of procedure call levels involved in some of these +// operations is already ridiculous, and would become worse if we +// went through the proper intermediaries. +#else +# include "gc.h" +#endif + +// What follows currenly assumes a Linux-like platform. +// Some of it specifically assumes X86 or IA64 Linux, though that +// should be easily fixable. + +// A Java monitor implemention based on a table of locks. +// Each entry in the table describes +// locks held for objects that hash to that location. +// This started out as a reimplementation of the technique used in SGIs JVM, +// for which we obtained permission from SGI. +// But in fact, this ended up quite different, though some ideas are +// still shared with the original. +// It was also influenced by some of the published IBM work, +// though it also differs in many ways from that. +// We could speed this up if we had a way to atomically update +// an entire cache entry, i.e. 2 contiguous words of memory. +// That would usually be the case with a 32 bit ABI on a 64 bit processor. +// But we don't currently go out of our way to target those. +// I don't know how to do much better with a N bit ABI on a processor +// that can atomically update only N bits at a time. +// Author: Hans-J. Boehm (Hans_Boehm@hp.com, boehm@acm.org) + +#include +#include +#include // for usleep, sysconf. +#include // for sched_yield. +#include + +typedef size_t obj_addr_t; /* Integer type big enough for object */ + /* address. */ + +// The following should move to some standard place. Linux-threads +// already defines roughly these, as do more recent versions of boehm-gc. +// The problem is that neither exports them. + +#if defined(__GNUC__) && defined(__i386__) + // Atomically replace *addr by new_val if it was initially equal to old. + // Return true if the comparison succeeded. + // Assumed to have acquire semantics, i.e. later memory operations + // cannot execute before the compare_and_swap finishes. + inline static bool + compare_and_swap(volatile obj_addr_t *addr, + obj_addr_t old, + obj_addr_t new_val) + { + char result; + __asm__ __volatile__("lock; cmpxchgl %2, %0; setz %1" + : "=m"(*(addr)), "=q"(result) + : "r" (new_val), "0"(*(addr)), "a"(old) : "memory"); + return (bool) result; + } + + // Set *addr to new_val with release semantics, i.e. making sure + // that prior loads and stores complete before this + // assignment. + // On X86, the hardware shouldn't reorder reads and writes, + // so we just have to convince gcc not to do it either. + inline static void + release_set(volatile obj_addr_t *addr, obj_addr_t new_val) + { + __asm__ __volatile__(" " : : : "memory"); + *(addr) = new_val; + } + + // Compare_and_swap with release semantics instead of acquire semantics. + // On many architecture, the operation makes both guarantees, so the + // implementation can be the same. + inline static bool + compare_and_swap_release(volatile obj_addr_t *addr, + obj_addr_t old, + obj_addr_t new_val) + { + return compare_and_swap(addr, old, new_val); + } +#endif + +#if defined(__GNUC__) && defined(__ia64__) && SIZEOF_VOID_P == 8 + inline static bool + compare_and_swap(volatile obj_addr_t *addr, + obj_addr_t old, + obj_addr_t new_val) + { + unsigned long oldval; + __asm__ __volatile__("mov ar.ccv=%4 ;; cmpxchg8.acq %0=%1,%2,ar.ccv" + : "=r"(oldval), "=m"(*addr) + : "r"(new_val), "1"(*addr), "r"(old) : "memory"); + return (oldval == old); + } + + // The fact that *addr is volatile should cause the compiler to + // automatically generate an st8.rel. + inline static void + release_set(volatile obj_addr_t *addr, obj_addr_t new_val) + { + __asm__ __volatile__(" " : : : "memory"); + *(addr) = new_val; + } + + inline static bool + compare_and_swap_release(volatile obj_addr_t *addr, + obj_addr_t old, + obj_addr_t new_val) + { + unsigned long oldval; + __asm__ __volatile__("mov ar.ccv=%4 ;; cmpxchg8.rel %0=%1,%2,ar.ccv" + : "=r"(oldval), "=m"(*addr) + : "r"(new_val), "1"(*addr), "r"(old) : "memory"); + return (oldval == old); + } +#endif + +// Try to determine whether we are on a multiprocessor, i.e. whether +// spinning may be profitable. +// This should really use a suitable autoconf macro. +// False is the conservative answer, though the right one is much better. +static bool +is_mp() +{ + long nprocs = sysconf(_SC_NPROCESSORS_ONLN); + return (nprocs > 1); +} + +// A call to keep_live(p) forces p to be accessible to the GC +// at this point. +inline static void +keep_live(obj_addr_t p) +{ + __asm__ __volatile__("" : : "rm"(p) : "memory"); +} + + +// Each hash table entry holds a single preallocated "lightweight" lock. +// In addition, it holds a chain of "heavyweight" locks. Lightweight +// locks do not support Object.wait(), and are converted to heavyweight +// status in response to contention. Unlike the SGI scheme, both +// ligtweight and heavyweight locks in one hash entry can be simultaneously +// in use. (The SGI scheme requires that we be able to acquire a heavyweight +// lock on behalf of another thread, and can thus convert a lock we don't +// hold to heavyweight status. Here we don't insist on that, and thus +// let the original holder of the lighweight lock keep it.) + +struct heavy_lock { + void * reserved_for_gc; + struct heavy_lock *next; // Hash chain link. + // The only field traced by GC. + obj_addr_t address; // Object to which this lock corresponds. + // Should not be traced by GC. + _Jv_SyncInfo si; + // The remaining fields save prior finalization info for + // the object, which we needed to replace in order to arrange + // for cleanup of the lock structure. + GC_finalization_proc old_finalization_proc; + void * old_client_data; +}; + +#ifdef LOCK_DEBUG void -_Jv_FinalizeObject (jobject obj) +print_hl_list(heavy_lock *hl) { - // Ignore exceptions. From section 12.6 of the Java Language Spec. - try + heavy_lock *p = hl; + for (; 0 != p; p = p->next) + fprintf (stderr, "(hl = %p, addr = %p)", p, (void *)(p -> address)); +} +#endif /* LOCK_DEBUG */ + +#if defined (_Jv_HaveCondDestroy) || defined (_Jv_HaveMutexDestroy) +// If we have to run a destructor for a sync_info member, then this +// function is registered as a finalizer for the sync_info. +static void +heavy_lock_finalization_proc (jobject obj) +{ + heavy_lock *hl = (heavy_lock *) obj; +#if defined (_Jv_HaveCondDestroy) + _Jv_CondDestroy (&hl->si.condition); +#endif +#if defined (_Jv_HaveMutexDestroy) + _Jv_MutexDestroy (&hl->si.mutex); +#endif + hl->si.init = false; +} +#endif /* defined (_Jv_HaveCondDestroy) || defined (_Jv_HaveMutexDestroy) */ + +// We convert the lock back to lightweight status when +// we exit, so that a single contention episode doesn't doom the lock +// forever. But we also need to make sure that lock structures for dead +// objects are eventually reclaimed. We do that in a an additional +// finalizer on the underlying object. +// Note that if the corresponding object is dead, it is safe to drop +// the heavy_lock structure from its list. It is not necessarily +// safe to deallocate it, since the unlock code could still be running. + +struct hash_entry { + volatile obj_addr_t address; // Address of object for which lightweight + // k is held. + // We assume the 3 low order bits are zero. + // With the Boehm collector and bitmap + // allocation, objects of size 4 bytes are + // broken anyway. Thus this is primarily + // a constraint on statically allocated + // objects used for synchronization. + // This allows us to use the low order + // bits as follows: +# define LOCKED 1 // This hash entry is locked, and its + // state may be invalid. + // The lock protects both the hash_entry + // itself (except for the light_count + // and light_thr_id fields, which + // are protected by the lightweight + // lock itself), and any heavy_monitor + // structures attached to it. +# define HEAVY 2 // There may be heavyweight locks + // associated with this cache entry. + // The lightweight entry is still valid, + // if the leading bits of the address + // field are nonzero. + // Set if heavy_count is > 0 . + // Stored redundantly so a single + // compare-and-swap works in the easy case. +# define REQUEST_CONVERSION 4 // The lightweight lock is held. But + // one or more other threads have tried + // to acquire the lock, and hence request + // conversion to heavyweight status. +# define FLAGS (LOCKED | HEAVY | REQUEST_CONVERSION) + volatile _Jv_ThreadId_t light_thr_id; + // Thr_id of holder of lightweight lock. + // Only updated by lightweight lock holder. + // Must be recognizably invalid if the + // lightweight lock is not held. +# define INVALID_THREAD_ID 0 // Works for Linux? + // If zero doesn't work, we have to + // initialize lock table. + volatile unsigned short light_count; + // Number of times the lightweight lock + // is held minus one. Zero if lightweight + // lock is not held. + unsigned short heavy_count; // Total number of times heavyweight locks + // associated with this hash entry are held + // or waiting to be acquired. + // Threads in wait() are included eventhough + // they have temporarily released the lock. + struct heavy_lock * heavy_locks; + // Chain of heavy locks. Protected + // by lockbit for he. Locks may + // remain allocated here even if HEAVY + // is not set and heavy_count is 0. + // If a lightweight and hevyweight lock + // correspond to the same address, the + // lightweight lock is the right one. +}; + +#ifndef JV_SYNC_TABLE_SZ +# define JV_SYNC_TABLE_SZ 1024 +#endif + +hash_entry light_locks[JV_SYNC_TABLE_SZ]; + +#define JV_SYNC_HASH(p) (((long)p ^ ((long)p >> 10)) % JV_SYNC_TABLE_SZ) + +#ifdef LOCK_DEBUG + void print_he(hash_entry *he) + { + fprintf(stderr, "lock hash entry = %p, index = %d, address = 0x%lx\n" + "\tlight_thr_id = 0x%lx, light_count = %d, " + "heavy_count = %d\n\theavy_locks:", he, + he - light_locks, he -> address, he -> light_thr_id, + he -> light_count, he -> heavy_count); + print_hl_list(he -> heavy_locks); + fprintf(stderr, "\n"); + } +#endif /* LOCK_DEBUG */ + +// Wait for roughly 2^n units, touching as little memory as possible. +static void +spin(unsigned n) +{ + const unsigned MP_SPINS = 10; + const unsigned YIELDS = 4; + const unsigned SPINS_PER_UNIT = 30; + const unsigned MIN_SLEEP_USECS = 2001; // Shorter times spin under Linux. + const unsigned MAX_SLEEP_USECS = 200000; + static unsigned spin_limit = 0; + static unsigned yield_limit = YIELDS; + static bool mp = false; + static bool spin_initialized = false; + + if (!spin_initialized) { - obj->finalize (); + mp = is_mp(); + if (mp) + { + spin_limit = MP_SPINS; + yield_limit = MP_SPINS + YIELDS; + } + spin_initialized = true; } - catch (java::lang::Throwable *t) + if (n < spin_limit) { - // Ignore. + unsigned i = SPINS_PER_UNIT << n; + for (; i > 0; --i) + __asm__ __volatile__(""); + } + else if (n < yield_limit) + { + sched_yield(); + } + else + { + unsigned duration = MIN_SLEEP_USECS << (n - yield_limit); + if (n >= 15 + yield_limit || duration > MAX_SLEEP_USECS) + duration = MAX_SLEEP_USECS; + usleep(duration); + } +} + +// Wait for a hash entry to become unlocked. +static void +wait_unlocked (hash_entry *he) +{ + unsigned i = 0; + while (he -> address & LOCKED) + spin (i++); +} + +// Return the heavy lock for addr if it was already allocated. +// The client passes in the appropriate hash_entry. +// We hold the lock for he. +static inline heavy_lock * +find_heavy (obj_addr_t addr, hash_entry *he) +{ + heavy_lock *hl = he -> heavy_locks; + while (hl != 0 && hl -> address != addr) hl = hl -> next; + return hl; +} + +// Unlink the heavy lock for the given address from its hash table chain. +// Dies miserably and conspicuously if it's not there, since that should +// be impossible. +static inline void +unlink_heavy (obj_addr_t addr, hash_entry *he) +{ + heavy_lock **currentp = &(he -> heavy_locks); + while ((*currentp) -> address != addr) + currentp = &((*currentp) -> next); + *currentp = (*currentp) -> next; +} + +// Finalization procedure for objects that have associated heavy-weight +// locks. This may replace the real finalization procedure. +static void +heavy_lock_obj_finalization_proc (void *obj, void *cd) +{ + heavy_lock *hl = (heavy_lock *)cd; + obj_addr_t addr = (obj_addr_t)obj; + GC_finalization_proc old_finalization_proc = hl -> old_finalization_proc; + void * old_client_data = hl -> old_client_data; + + if (old_finalization_proc != 0) + { + // We still need to run a real finalizer. In an idealized + // world, in which people write thread-safe finalizers, that is + // likely to require synchronization. Thus we reregister + // ourselves as the only finalizer, and simply run the real one. + // Thus we don't clean up the lock yet, but we're likely to do so + // on the next GC cycle. + hl -> old_finalization_proc = 0; + hl -> old_client_data = 0; +# ifdef HAVE_BOEHM_GC + GC_REGISTER_FINALIZER_NO_ORDER(obj, heavy_lock_obj_finalization_proc, cd, 0, 0); +# endif + old_finalization_proc(obj, old_client_data); + } + else + { + // The object is really dead, although it's conceivable that + // some thread may still be in the process of releasing the + // heavy lock. Unlink it and, if necessary, register a finalizer + // to distroy sync_info. + hash_entry *he = light_locks + JV_SYNC_HASH(addr); + obj_addr_t address = (he -> address & ~LOCKED); + while (!compare_and_swap(&(he -> address), address, address | LOCKED )) + { + // Hash table entry is currently locked. We can't safely touch + // touch the list of heavy locks. + wait_unlocked(he); + address = (he -> address & ~LOCKED); + } + unlink_heavy(addr, light_locks + JV_SYNC_HASH(addr)); + release_set(&(he -> address), address); +# if defined (_Jv_HaveCondDestroy) || defined (_Jv_HaveMutexDestroy) + // Register a finalizer, yet again. + hl->si.init = true; + _Jv_RegisterFinalizer (hl, heavy_lock_finalization_proc); +# endif + } +} + +// Allocate a new heavy lock for addr, returning its address. +// Assumes we already have the hash_entry locked, and there +// is currently no lightweight or allocated lock for addr. +// We register a finalizer for addr, which is responsible for +// removing the heavy lock when addr goes away, in addition +// to the responsibilities of any prior finalizer. +static heavy_lock * +alloc_heavy(obj_addr_t addr, hash_entry *he) +{ + heavy_lock * hl = (heavy_lock *) _Jv_AllocTraceOne(sizeof (heavy_lock)); + + hl -> address = addr; + _Jv_MutexInit (&(hl -> si.mutex)); + _Jv_CondInit (&(hl -> si.condition)); +# if defined (_Jv_HaveCondDestroy) || defined (_Jv_HaveMutexDestroy) + si->init = true; // needed ? +# endif + hl -> next = he -> heavy_locks; + he -> heavy_locks = hl; + // FIXME: The only call that cheats and goes directly to the GC interface. +# ifdef HAVE_BOEHM_GC + GC_REGISTER_FINALIZER_NO_ORDER( + (void *)addr, heavy_lock_obj_finalization_proc, + hl, &hl->old_finalization_proc, + &hl->old_client_data); +# endif /* HAVE_BOEHM_GC */ + return hl; +} + +// Return the heavy lock for addr, allocating if necessary. +// Assumes we have the cache entry locked, and there is no lightweight +// lock for addr. +static heavy_lock * +get_heavy(obj_addr_t addr, hash_entry *he) +{ + heavy_lock *hl = find_heavy(addr, he); + if (0 == hl) + hl = alloc_heavy(addr, he); + return hl; +} + +void +_Jv_MonitorEnter (jobject obj) +{ + obj_addr_t addr = (obj_addr_t)obj; + obj_addr_t address; + unsigned hash = JV_SYNC_HASH(addr); + hash_entry * he = light_locks + hash; + _Jv_ThreadId_t self = _Jv_ThreadSelf(); + unsigned count; + const unsigned N_SPINS = 18; + + assert(!(addr & FLAGS)); +retry: + if (__builtin_expect(compare_and_swap(&(he -> address), + 0, addr),true)) + { + assert(he -> light_thr_id == INVALID_THREAD_ID); + assert(he -> light_count == 0); + he -> light_thr_id = self; + // Count fields are set correctly. Heavy_count was also zero, + // but can change asynchronously. + // This path is hopefully both fast and the most common. + return; + } + address = he -> address; + if ((address & ~(HEAVY | REQUEST_CONVERSION)) == addr) + { + if (he -> light_thr_id == self) + { + // We hold the lightweight lock, and it's for the right + // address. + count = he -> light_count; + if (count == USHRT_MAX) + { + // I think most JVMs don't check for this. + // But I'm not convinced I couldn't turn this into a security + // hole, even with a 32 bit counter. + throw new java::lang::IllegalMonitorStateException( + JvNewStringLatin1("maximum monitor nesting level exceeded")); + } + he -> light_count = count + 1; + return; + } + else + { + // Lightweight lock is held, but by somone else. + // Spin a few times. This avoids turning this into a heavyweight + // lock if the current holder is about to release it. + for (unsigned int i = 0; i < N_SPINS; ++i) + { + if ((he -> address & ~LOCKED) != (address & ~LOCKED)) goto retry; + spin(i); + } + address &= ~LOCKED; + if (!compare_and_swap(&(he -> address), address, address | LOCKED )) + { + wait_unlocked(he); + goto retry; + } + heavy_lock *hl = get_heavy(addr, he); + ++ (he -> heavy_count); + // The hl lock acquisition can't block for long, since it can + // only be held by other threads waiting for conversion, and + // they, like us, drop it quickly without blocking. + _Jv_MutexLock(&(hl->si.mutex)); + assert(he -> address == address | LOCKED ); + release_set(&(he -> address), (address | REQUEST_CONVERSION | HEAVY)); + // release lock on he + while ((he -> address & ~FLAGS) == (address & ~FLAGS)) + { + // Once converted, the lock has to retain heavyweight + // status, since heavy_count > 0 . + _Jv_CondWait (&(hl->si.condition), &(hl->si.mutex), 0, 0); + } + keep_live(addr); + // Guarantee that hl doesn't get unlinked by finalizer. + // This is only an issue if the client fails to release + // the lock, which is unlikely. + assert(he -> address & HEAVY); + // Lock has been converted, we hold the heavyweight lock, + // heavy_count has been incremented. + return; + } + } + obj_addr_t was_heavy = (address & HEAVY); + address &= ~LOCKED; + if (!compare_and_swap(&(he -> address), address, (address | LOCKED ))) + { + wait_unlocked(he); + goto retry; + } + if ((address & ~(HEAVY | REQUEST_CONVERSION)) == 0) + { + // Either was_heavy is true, or something changed out from under us, + // since the initial test for 0 failed. + assert(!(address & REQUEST_CONVERSION)); + // Can't convert a nonexistent lightweight lock. + heavy_lock *hl; + hl = (was_heavy? find_heavy(addr, he) : 0); + if (0 == hl) + { + // It is OK to use the lighweight lock, since either the + // heavyweight lock does not exist, or none of the + // heavyweight locks currently exist. Future threads + // trying to acquire the lock will see the lightweight + // one first and use that. + he -> light_thr_id = self; // OK, since nobody else can hold + // light lock or do this at the same time. + assert(he -> light_count == 0); + assert(was_heavy == (he -> address & HEAVY)); + release_set(&(he -> address), (addr | was_heavy)); + } + else + { + // Must use heavy lock. + ++ (he -> heavy_count); + assert(0 == (address & ~HEAVY)); + release_set(&(he -> address), HEAVY); + _Jv_MutexLock(&(hl->si.mutex)); + keep_live(addr); + } + return; + } + // Lightweight lock is held, but does not correspond to this object. + // We hold the lock on the hash entry, and he -> address can't + // change from under us. Neither can the chain of heavy locks. + { + assert(0 == he -> heavy_count || (address & HEAVY)); + heavy_lock *hl = get_heavy(addr, he); + ++ (he -> heavy_count); + release_set(&(he -> address), address | HEAVY); + _Jv_MutexLock(&(hl->si.mutex)); + keep_live(addr); } } + + +void +_Jv_MonitorExit (jobject obj) +{ + obj_addr_t addr = (obj_addr_t)obj; + _Jv_ThreadId_t self = _Jv_ThreadSelf(); + unsigned hash = JV_SYNC_HASH(addr); + hash_entry * he = light_locks + hash; + _Jv_ThreadId_t light_thr_id; + unsigned count; + obj_addr_t address; + +retry: + light_thr_id = he -> light_thr_id; + // Unfortunately, it turns out we always need to read the address + // first. Even if we are going to update it with compare_and_swap, + // we need to reset light_thr_id, and that's not safe unless we know + // know that we hold the lock. + address = he -> address; + // First the (relatively) fast cases: + if (__builtin_expect(light_thr_id == self, true)) + { + count = he -> light_count; + if (__builtin_expect((address & ~HEAVY) == addr, true)) + { + if (count != 0) + { + // We held the lightweight lock all along. Thus the values + // we saw for light_thr_id and light_count must have been valid. + he -> light_count = count - 1; + return; + } + else + { + // We hold the lightweight lock once. + he -> light_thr_id = INVALID_THREAD_ID; + if (compare_and_swap_release(&(he -> address), address, + address & HEAVY)) + return; + else + { + he -> light_thr_id = light_thr_id; // Undo prior damage. + goto retry; + } + } + } + // else lock is not for this address, conversion is requested, + // or the lock bit in the address field is set. + } + else + { + if ((address & ~(HEAVY | REQUEST_CONVERSION)) == addr) + { +# ifdef LOCK_DEBUG + fprintf(stderr, "Lightweight lock held by other thread\n\t" + "light_thr_id = 0x%lx, self = 0x%lx, " + "address = 0x%lx, pid = %d\n", + light_thr_id, self, address, getpid()); + print_he(he); + for(;;) {} +# endif + // Someone holds the lightweight lock for this object, and + // it can't be us. + throw new java::lang::IllegalMonitorStateException( + JvNewStringLatin1("current thread not owner")); + } + else + count = he -> light_count; + } + if (address & LOCKED) + { + wait_unlocked(he); + goto retry; + } + // Now the unlikely cases. + // We do know that: + // - Address is set, and doesn't contain the LOCKED bit. + // - If address refers to the same object as addr, then he -> light_thr_id + // refers to this thread, and count is valid. + // - The case in which we held the lightweight lock has been + // completely handled, except for the REQUEST_CONVERSION case. + // + if ((address & ~FLAGS) == addr) + { + // The lightweight lock is assigned to this object. + // Thus we must be in the REQUEST_CONVERSION case. + if (0 != count) + { + // Defer conversion until we exit completely. + he -> light_count = count - 1; + return; + } + assert(he -> light_thr_id == self); + assert(address & REQUEST_CONVERSION); + // Conversion requested + // Convert now. + if (!compare_and_swap(&(he -> address), address, address | LOCKED)) + goto retry; + heavy_lock *hl = find_heavy(addr, he); + assert (0 != hl); + // Requestor created it. + he -> light_count = 0; + assert(he -> heavy_count > 0); + // was incremented by requestor. + _Jv_MutexLock(&(hl->si.mutex)); + // Release the he lock after acquiring the mutex. + // Otherwise we can accidentally + // notify a thread that has already seen a heavyweight + // lock. + he -> light_thr_id = INVALID_THREAD_ID; + release_set(&(he -> address), HEAVY); + // lightweight lock now unused. + _Jv_CondNotifyAll(&(hl->si.condition), &(hl->si.mutex)); + _Jv_MutexUnlock(&(hl->si.mutex)); + // heavy_count was already incremented by original requestor. + keep_live(addr); + return; + } + // lightweight lock not for this object. + assert(!(address & LOCKED)); + assert((address & ~FLAGS) != addr); + if (!compare_and_swap(&(he -> address), address, address | LOCKED)) + goto retry; + heavy_lock *hl = find_heavy(addr, he); + if (NULL == hl) + { +# ifdef LOCK_DEBUG + fprintf(stderr, "Failed to find heavyweight lock for addr 0x%lx" + " pid = %d\n", addr, getpid()); + print_he(he); + for(;;) {} +# endif + throw new java::lang::IllegalMonitorStateException( + JvNewStringLatin1("current thread not owner")); + } + assert(address & HEAVY); + count = he -> heavy_count; + assert(count > 0); + --count; + if (0 == count) address &= ~HEAVY; + he -> heavy_count = count; + release_set(&(he -> address), address); + // release lock bit, preserving + // REQUEST_CONVERSION + // and object address. + _Jv_MutexUnlock(&(hl->si.mutex)); + // Unlock after releasing the lock bit, so that + // we don't switch to another thread prematurely. + keep_live(addr); +} + +// The rest of these are moderately thin veneers on _Jv_Cond ops. +// The current version of Notify might be able to make the pthread +// call AFTER releasing the lock, thus saving some context switches?? + +void +java::lang::Object::wait (jlong timeout, jint nanos) +{ + obj_addr_t addr = (obj_addr_t)this; + _Jv_ThreadId_t self = _Jv_ThreadSelf(); + unsigned hash = JV_SYNC_HASH(addr); + hash_entry * he = light_locks + hash; + unsigned count; + obj_addr_t address; + heavy_lock *hl; + + if (__builtin_expect (timeout < 0 || nanos < 0 || nanos > 999999, false)) + throw new IllegalArgumentException; +retry: + address = he -> address; + address &= ~LOCKED; + if (!compare_and_swap(&(he -> address), address, address | LOCKED)) + { + wait_unlocked(he); + goto retry; + } + // address does not have the lock bit set. We hold the lock on he. + if ((address & ~FLAGS) == addr) + { + // Convert to heavyweight. + if (he -> light_thr_id != self) + { +# ifdef LOCK_DEBUG + fprintf(stderr, "Found wrong lightweight lock owner in wait " + "address = 0x%lx pid = %d\n", address, getpid()); + print_he(he); + for(;;) {} +# endif + release_set(&(he -> address), address); + throw new IllegalMonitorStateException (JvNewStringLatin1 + ("current thread not owner")); + } + count = he -> light_count; + hl = get_heavy(addr, he); + he -> light_count = 0; + he -> heavy_count += count + 1; + for (unsigned i = 0; i <= count; ++i) + _Jv_MutexLock(&(hl->si.mutex)); + // Again release the he lock after acquiring the mutex. + he -> light_thr_id = INVALID_THREAD_ID; + release_set(&(he -> address), HEAVY); // lightweight lock now unused. + if (address & REQUEST_CONVERSION) + _Jv_CondNotify (&(hl->si.condition), &(hl->si.mutex)); + } + else /* We should hold the heavyweight lock. */ + { + hl = find_heavy(addr, he); + release_set(&(he -> address), address); + if (0 == hl) + { +# ifdef LOCK_DEBUG + fprintf(stderr, "Couldn't find heavy lock in wait " + "addr = 0x%lx pid = %d\n", addr, getpid()); + print_he(he); + for(;;) {} +# endif + throw new IllegalMonitorStateException (JvNewStringLatin1 + ("current thread not owner")); + } + assert(address & HEAVY); + } + switch (_Jv_CondWait (&(hl->si.condition), &(hl->si.mutex), timeout, nanos)) + { + case _JV_NOT_OWNER: + throw new IllegalMonitorStateException (JvNewStringLatin1 + ("current thread not owner")); + case _JV_INTERRUPTED: + if (Thread::interrupted ()) + throw new InterruptedException; + } +} + +void +java::lang::Object::notify (void) +{ + obj_addr_t addr = (obj_addr_t)this; + _Jv_ThreadId_t self = _Jv_ThreadSelf(); + unsigned hash = JV_SYNC_HASH(addr); + hash_entry * he = light_locks + hash; + heavy_lock *hl; + obj_addr_t address; + int result; + +retry: + address = ((he -> address) & ~LOCKED); + if (!compare_and_swap(&(he -> address), address, address | LOCKED)) + { + wait_unlocked(he); + goto retry; + } + if ((address & ~FLAGS) == addr && he -> light_thr_id == self) + { + // We hold lightweight lock. Since it has not + // been inflated, there are no waiters. + release_set(&(he -> address), address); // unlock + return; + } + hl = find_heavy(addr, he); + // Hl can't disappear since we point to the underlying object. + // It's important that we release the lock bit before the notify, since + // otherwise we will try to wake up thee target while we still hold the + // bit. This results in lock bit contention, which we don't handle + // terribly well. + release_set(&(he -> address), address); // unlock + if (0 == hl) + { + throw new IllegalMonitorStateException(JvNewStringLatin1 + ("current thread not owner")); + return; + } + result = _Jv_CondNotify(&(hl->si.condition), &(hl->si.mutex)); + keep_live(addr); + if (__builtin_expect (result, 0)) + throw new IllegalMonitorStateException(JvNewStringLatin1 + ("current thread not owner")); +} + +void +java::lang::Object::notifyAll (void) +{ + obj_addr_t addr = (obj_addr_t)this; + _Jv_ThreadId_t self = _Jv_ThreadSelf(); + unsigned hash = JV_SYNC_HASH(addr); + hash_entry * he = light_locks + hash; + heavy_lock *hl; + obj_addr_t address; + int result; + +retry: + address = (he -> address) & ~LOCKED; + if (!compare_and_swap(&(he -> address), address, address | LOCKED)) + { + wait_unlocked(he); + goto retry; + } + hl = find_heavy(addr, he); + if ((address & ~FLAGS) == addr && he -> light_thr_id == self) + { + // We hold lightweight lock. Since it has not + // been inflated, there are no waiters. + release_set(&(he -> address), address); // unlock + return; + } + release_set(&(he -> address), address); // unlock + if (0 == hl) + { + throw new IllegalMonitorStateException(JvNewStringLatin1 + ("current thread not owner")); + } + result = _Jv_CondNotifyAll(&(hl->si.condition), &(hl->si.mutex)); + if (__builtin_expect (result, 0)) + throw new IllegalMonitorStateException(JvNewStringLatin1 + ("current thread not owner")); +} + +// This is declared in Java code and in Object.h. +// It should never be called with JV_HASH_SYNCHRONIZATION +void +java::lang::Object::sync_init (void) +{ + throw new IllegalMonitorStateException(JvNewStringLatin1 + ("internal error: sync_init")); +} + +// This is called on startup and declared in Object.h. +// For now we just make it a no-op. +void +_Jv_InitializeSyncMutex (void) +{ +} + +#endif /* JV_HASH_SYNCHRONIZATION */ + diff --git a/libjava/java/lang/natString.cc b/libjava/java/lang/natString.cc index 659810f31e7..520188274f6 100644 --- a/libjava/java/lang/natString.cc +++ b/libjava/java/lang/natString.cc @@ -121,8 +121,7 @@ java::lang::String::rehash() if (strhash == NULL) { strhash_size = 1024; - strhash = (jstring *) _Jv_AllocBytesChecked (strhash_size - * sizeof (jstring)); + strhash = (jstring *) _Jv_AllocBytes (strhash_size * sizeof (jstring)); memset (strhash, 0, strhash_size * sizeof (jstring)); } else @@ -130,8 +129,7 @@ java::lang::String::rehash() int i = strhash_size; jstring* ptr = strhash + i; int nsize = strhash_size * 2; - jstring *next = (jstring *) _Jv_AllocBytesChecked (nsize - * sizeof (jstring)); + jstring *next = (jstring *) _Jv_AllocBytes (nsize * sizeof (jstring)); memset (next, 0, nsize * sizeof (jstring)); while (--i >= 0) @@ -392,8 +390,18 @@ _Jv_AllocString(jsize len) { jsize sz = sizeof(java::lang::String) + len * sizeof(jchar); - jstring obj = (jstring) JvAllocObject(&StringClass, sz); - + // We assert that for strings allocated this way, the data field + // will always point to the object itself. Thus there is no reason + // for the garbage collector to scan any of it. + // Furthermore, we're about to overwrite the string data, so + // initialization of the object is not an issue. +#ifdef ENABLE_JVMPI + jstring obj = (jstring) _Jv_AllocPtrFreeObject(&StringClass, sz); +#else + // Class needs no initialization, and there is no finalizer, so + // we can go directly to the collector's allocator interface. + jstring obj = (jstring) _Jv_AllocPtrFreeObj(&StringClass, sz); +#endif obj->data = obj; obj->boffset = sizeof(java::lang::String); obj->count = len; diff --git a/libjava/java/net/natInetAddress.cc b/libjava/java/net/natInetAddress.cc index 627fd3c6eea..cd281fc5b3e 100644 --- a/libjava/java/net/natInetAddress.cc +++ b/libjava/java/net/natInetAddress.cc @@ -95,7 +95,7 @@ java::net::InetAddress::aton (jstring host) if (len < 100) hostname = buf; else - hostname = (char*) _Jv_AllocBytesChecked (len+1); + hostname = (char*) _Jv_AllocBytes (len+1); JvGetStringUTFRegion (host, 0, host->length(), hostname); buf[len] = '\0'; char* bytes = NULL; @@ -180,7 +180,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr, if (len < 100) hostname = buf; else - hostname = (char*) _Jv_AllocBytesChecked (len+1); + hostname = (char*) _Jv_AllocBytes (len+1); JvGetStringUTFRegion (host, 0, host->length(), hostname); buf[len] = '\0'; #ifdef HAVE_GETHOSTBYNAME_R @@ -201,7 +201,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr, if (! ok && herr == ERANGE) { size_r *= 2; - buffer_r = (char *) _Jv_AllocBytesChecked (size_r); + buffer_r = (char *) _Jv_AllocBytes (size_r); } else #endif /* HAVE_STRUCT_HOSTENT_DATA */ @@ -255,7 +255,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr, if (! ok && herr == ERANGE) { size_r *= 2; - buffer_r = (char *) _Jv_AllocBytesChecked (size_r); + buffer_r = (char *) _Jv_AllocBytes (size_r); } else #endif /* HAVE_STRUCT_HOSTENT_DATA */ diff --git a/libjava/libgcj.spec.in b/libjava/libgcj.spec.in index 51092251d96..90e48833402 100644 --- a/libjava/libgcj.spec.in +++ b/libjava/libgcj.spec.in @@ -6,7 +6,7 @@ %rename lib liborig *lib: -lgcj -lm @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig) -*jc1: @DIVIDESPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ +*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ # # On some systems we force in a data_start symbol so that the GC will work diff --git a/libjava/nogc.cc b/libjava/nogc.cc index 08296719cbf..7cdd5827724 100644 --- a/libjava/nogc.cc +++ b/libjava/nogc.cc @@ -1,6 +1,6 @@ // nogc.cc - Implement null garbage collector. -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation This file is part of libgcj. @@ -32,6 +32,17 @@ _Jv_AllocObj (jsize size, jclass klass) { total += size; void *obj = calloc (size, 1); + if (!obj) _Jv_ThrowNoMemory(); + *((_Jv_VTable **) obj) = klass->vtable; + return obj; +} + +void * +_Jv_AllocPtrFreeObj (jsize size, jclass klass) +{ + total += size; + ptr_t obj = malloc (size, 1); + if (!obj) _Jv_ThrowNoMemory(); *((_Jv_VTable **) obj) = klass->vtable; return obj; } @@ -41,6 +52,7 @@ _Jv_AllocArray (jsize size, jclass klass) { total += size; void *obj = calloc (size, 1); + if (!obj) _Jv_ThrowNoMemory(); *((_Jv_VTable **) obj) = klass->vtable; return obj; } @@ -49,7 +61,9 @@ void * _Jv_AllocBytes (jsize size) { total += size; - return calloc (size, 1); + ptr_t obj = calloc (size, 1); + if (!obj) _Jv_ThrowNoMemory(); + return obj; } void @@ -111,3 +125,13 @@ void _Jv_InitGC (void) { } + +#ifdef JV_HASH_SYNCHRONIZATION +void * +_Jv_AllocTraceOne (jsize size /* includes vtable slot */) +{ + ptr_t obj = calloc(size, 1); + if (!obj) _Jv_ThrowNoMemory(); + return result; +} +#endif /* JV_HASH_SYNCHRONIZATION */ diff --git a/libjava/posix-threads.cc b/libjava/posix-threads.cc index 286bf83116f..21f61370df2 100644 --- a/libjava/posix-threads.cc +++ b/libjava/posix-threads.cc @@ -1,6 +1,6 @@ // posix-threads.cc - interface between libjava and POSIX threads. -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation This file is part of libgcj. @@ -336,6 +336,22 @@ _Jv_ThreadRegister (_Jv_Thread_t *data) // is called. Since it may need to be accessed from the new thread, work // around the potential race here by explicitly setting it again. data->thread = pthread_self (); + +# ifdef SLOW_PTHREAD_SELF + // Clear all self cache slots that might be needed by this thread. + int dummy; + int low_index = SC_INDEX(&dummy) + SC_CLEAR_MIN; + int high_index = SC_INDEX(&dummy) + SC_CLEAR_MAX; + for (int i = low_index; i <= high_index; ++i) + { + int current_index = i; + if (current_index < 0) + current_index += SELF_CACHE_SIZE; + if (current_index >= SELF_CACHE_SIZE) + current_index -= SELF_CACHE_SIZE; + _Jv_self_cache[current_index].high_sp_bits = BAD_HIGH_SP_VALUE; + } +# endif } void @@ -356,7 +372,7 @@ really_start (void *x) _Jv_ThreadRegister (info->data); info->method (info->data->thread_obj); - + if (! (info->data->flags & FLAG_DAEMON)) { pthread_mutex_lock (&daemon_mutex); @@ -365,7 +381,7 @@ really_start (void *x) pthread_cond_signal (&daemon_cond); pthread_mutex_unlock (&daemon_mutex); } - + return NULL; } @@ -418,3 +434,23 @@ _Jv_ThreadWait (void) pthread_cond_wait (&daemon_cond, &daemon_mutex); pthread_mutex_unlock (&daemon_mutex); } + +#if defined(SLOW_PTHREAD_SELF) + +// Support for pthread_self() lookup cache. + +volatile self_cache_entry _Jv_self_cache[SELF_CACHE_SIZE]; + + +_Jv_ThreadId_t +_Jv_ThreadSelf_out_of_line(volatile self_cache_entry *sce, size_t high_sp_bits) +{ + pthread_t self = pthread_self(); + // The ordering between the following writes matters. + // On Alpha, we probably need a memory barrier in the middle. + sce -> high_sp_bits = high_sp_bits; + sce -> self = self; + return self; +} + +#endif /* SLOW_PTHREAD_SELF */ diff --git a/libjava/prims.cc b/libjava/prims.cc index 6bcf646ddea..954f1aa9a60 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -221,11 +221,11 @@ _Jv_strLengthUtf8(char* str, int len) ptr = (unsigned char*) str; limit = ptr + len; str_length = 0; - for (; ptr < limit; str_length++) { - if (UTF8_GET (ptr, limit) < 0) { - return (-1); + for (; ptr < limit; str_length++) + { + if (UTF8_GET (ptr, limit) < 0) + return (-1); } - } return (str_length); } @@ -271,7 +271,7 @@ _Jv_makeUtf8Const (jstring string) jint len = _Jv_GetStringUTFLength (string); Utf8Const* m = (Utf8Const*) - _Jv_AllocBytesChecked (sizeof(Utf8Const) + len + 1); + _Jv_AllocBytes (sizeof(Utf8Const) + len + 1); m->hash = hash; m->length = len; @@ -331,14 +331,11 @@ _Jv_ThrowNullPointerException () throw new java::lang::NullPointerException; } -// Allocate some unscanned memory and throw an exception if no memory. -void * -_Jv_AllocBytesChecked (jsize size) +// Explicitly throw a no memory exception. +// The collector calls this when it encounters an out-of-memory condition. +void _Jv_ThrowNoMemory() { - void *r = _Jv_AllocBytes (size); - if (! r) - throw no_memory; - return r; + _Jv_Throw (no_memory); } // Allocate a new object of class KLASS. SIZE is the size of the object @@ -350,8 +347,6 @@ _Jv_AllocObject (jclass klass, jint size) _Jv_InitClass (klass); jobject obj = (jobject) _Jv_AllocObj (size, klass); - if (__builtin_expect (! obj, false)) - throw no_memory; // If this class has inherited finalize from Object, then don't // bother registering a finalizer. We know that finalize() is the @@ -379,6 +374,14 @@ _Jv_AllocObject (jclass klass, jint size) event.u.obj_alloc.size = size; event.u.obj_alloc.obj_id = (jobjectID) obj; + // FIXME: This doesn't look right for the Boehm GC. A GC may + // already be in progress. _Jv_DisableGC () doesn't wait for it. + // More importantly, I don't see the need for disabling GC, since we + // blatantly have a pointer to obj on our stack, ensuring that the + // object can't be collected. Even for a nonconservative collector, + // it appears to me that this must be true, since we are about to + // return obj. Isn't this whole approach way too intrusive for + // a useful profiling interface? - HB _Jv_DisableGC (); (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (&event); _Jv_EnableGC (); @@ -388,6 +391,43 @@ _Jv_AllocObject (jclass klass, jint size) return obj; } +// A version of the above that assumes the object contains no pointers, +// and requires no finalization. This can't happen if we need pointers +// to locks. +#ifdef JV_HASH_SYNCHRONIZATION +jobject +_Jv_AllocPtrFreeObject (jclass klass, jint size) +{ + _Jv_InitClass (klass); + + jobject obj = (jobject) _Jv_AllocPtrFreeObj (size, klass); + +#ifdef ENABLE_JVMPI + // Service JVMPI request. + + if (__builtin_expect (_Jv_JVMPI_Notify_OBJECT_ALLOC != 0, false)) + { + JVMPI_Event event; + + event.event_type = JVMPI_EVENT_OBJECT_ALLOC; + event.env_id = NULL; + event.u.obj_alloc.arena_id = 0; + event.u.obj_alloc.class_id = (jobjectID) klass; + event.u.obj_alloc.is_array = 0; + event.u.obj_alloc.size = size; + event.u.obj_alloc.obj_id = (jobjectID) obj; + + _Jv_DisableGC (); + (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (&event); + _Jv_EnableGC (); + } +#endif + + return obj; +} +#endif /* JV_HASH_SYNCHRONIZATION */ + + // Allocate a new array of Java objects. Each object is of type // `elementClass'. `init' is used to initialize each slot in the // array. @@ -408,8 +448,6 @@ _Jv_NewObjectArray (jsize count, jclass elementClass, jobject init) jclass klass = _Jv_GetArrayClass (elementClass, 0); obj = (jobjectArray) _Jv_AllocArray (size, klass); - if (__builtin_expect (! obj, false)) - throw no_memory; // Cast away const. jsize *lp = const_cast (&obj->length); *lp = count; @@ -444,13 +482,19 @@ _Jv_NewPrimArray (jclass eltype, jint count) jclass klass = _Jv_GetArrayClass (eltype, 0); +# ifdef JV_HASH_SYNCHRONIZATION + // Since the vtable is always statically allocated, + // these are completely pointerfree! Make sure the GC doesn't touch them. + __JArray *arr = + (__JArray*) _Jv_AllocPtrFreeObj (size + elsize * count, klass); + memset((char *)arr + size, 0, elsize * count); +# else __JArray *arr = (__JArray*) _Jv_AllocObj (size + elsize * count, klass); - if (__builtin_expect (! arr, false)) - throw no_memory; + // Note that we assume we are given zeroed memory by the allocator. +# endif // Cast away const. jsize *lp = const_cast (&arr->length); *lp = count; - // Note that we assume we are given zeroed memory by the allocator. return arr; } diff --git a/libjava/resolve.cc b/libjava/resolve.cc index d165c80b242..9fbc9630645 100644 --- a/libjava/resolve.cc +++ b/libjava/resolve.cc @@ -583,7 +583,7 @@ _Jv_PrepareClass(jclass klass) // allocate static memory if (static_size != 0) { - char *static_data = (char*)_Jv_AllocBytesChecked (static_size); + char *static_data = (char*)_Jv_AllocBytes (static_size); memset (static_data, 0, static_size); @@ -697,7 +697,7 @@ _Jv_PrepareClass(jclass klass) /* allocate vtable structure */ _Jv_VTable *vtable = (_Jv_VTable*) - _Jv_AllocBytesChecked (sizeof (_Jv_VTable) + _Jv_AllocBytes (sizeof (_Jv_VTable) + (sizeof (void*) * (vtable_count))); vtable->clas = clz; vtable->gc_descr = _Jv_BuildGCDescr(clz); @@ -1076,7 +1076,7 @@ _Jv_InterpMethod::ncode () int arg_count = count_arguments (self->signature, staticp); ncode_closure *closure = - (ncode_closure*)_Jv_AllocBytesChecked (sizeof (ncode_closure) + (ncode_closure*)_Jv_AllocBytes (sizeof (ncode_closure) + arg_count * sizeof (ffi_type*)); init_cif (self->signature, @@ -1126,8 +1126,8 @@ _Jv_JNIMethod::ncode () int arg_count = count_arguments (self->signature, staticp); ncode_closure *closure = - (ncode_closure*)_Jv_AllocBytesChecked (sizeof (ncode_closure) - + arg_count * sizeof (ffi_type*)); + (ncode_closure*)_Jv_AllocBytes (sizeof (ncode_closure) + + arg_count * sizeof (ffi_type*)); ffi_type *rtype; init_cif (self->signature, @@ -1187,8 +1187,8 @@ _Jv_BuildResolvedMethod (_Jv_Method* method, int arg_count = count_arguments (method->signature, staticp); _Jv_ResolvedMethod* result = (_Jv_ResolvedMethod*) - _Jv_AllocBytesChecked (sizeof (_Jv_ResolvedMethod) - + arg_count*sizeof (ffi_type*)); + _Jv_AllocBytes (sizeof (_Jv_ResolvedMethod) + + arg_count*sizeof (ffi_type*)); result->stack_item_count = init_cif (method->signature, diff --git a/libjava/testsuite/Makefile.in b/libjava/testsuite/Makefile.in index 9d72715ec1e..6fea5010a37 100644 --- a/libjava/testsuite/Makefile.in +++ b/libjava/testsuite/Makefile.in @@ -85,6 +85,7 @@ GCLIBS = @GCLIBS@ GCOBJS = @GCOBJS@ GCSPEC = @GCSPEC@ GCTESTSPEC = @GCTESTSPEC@ +HASH_SYNC_SPEC = @HASH_SYNC_SPEC@ INCLTDL = @INCLTDL@ JC1GCSPEC = @JC1GCSPEC@ LIBDATASTARTSPEC = @LIBDATASTARTSPEC@ @@ -123,15 +124,19 @@ libgcj_basedir = @libgcj_basedir@ AUTOMAKE_OPTIONS = foreign dejagnu # Setup the testing framework, if you have one -EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then echo $(top_builddir)/../expect/expect ; else echo expect ; fi` +EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ + echo $(top_builddir)/../expect/expect ; \ + else echo expect ; fi` -RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then echo $(top_srcdir)/../dejagnu/runtest ; else echo runtest; fi` +RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ + echo $(top_srcdir)/../dejagnu/runtest ; \ + else echo runtest; fi` RUNTESTFLAGS = @AM_RUNTESTFLAGS@ mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = ../include/config.h +CONFIG_HEADER = ../include/config.h ../gcj/libgcj-config.h CONFIG_CLEAN_FILES = DIST_COMMON = ChangeLog Makefile.am Makefile.in -- 2.30.2