diff options
-rw-r--r-- | libjava/ChangeLog | 53 | ||||
-rw-r--r-- | libjava/boehm.cc | 151 | ||||
-rwxr-xr-x | libjava/configure | 310 | ||||
-rw-r--r-- | libjava/configure.in | 3 | ||||
-rw-r--r-- | libjava/include/jvm.h | 15 | ||||
-rw-r--r-- | libjava/java/lang/Class.h | 4 | ||||
-rw-r--r-- | libjava/java/lang/natClassLoader.cc | 10 | ||||
-rw-r--r-- | libjava/libgcj.spec.in | 2 | ||||
-rw-r--r-- | libjava/nogc.cc | 20 | ||||
-rw-r--r-- | libjava/prims.cc | 30 | ||||
-rw-r--r-- | libjava/resolve.cc | 40 |
11 files changed, 412 insertions, 226 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index f55d2cc..543d04b 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,56 @@ +2000-09-30 Hans Boehm <boehm@acm.org> + Bryce McKinlay <bryce@albatross.co.nz> + + Implement bitmap descriptor based marking for Boehm GC. + + * configure.in: Define JC1GCSPEC. Set it if boehm-gc is used. + * configure: Rebuilt. + * libgcj.spec.in: Pass JC1GCSPEC to jc1. + * include/jvm.h (struct _Jv_VTable): New field `gc_descr'. New inline + method get_finalizer(). + (struct _Jv_ArrayVTable): Ditto. Declare method array with + NUM_OBJECT_METHODS elements instead of NUM_OBJECT_METHODS + 1. + (_Jv_AllocObj): Add new jclass parameter. + (_Jv_AllocArray): Ditto. + (_Jv_BuildGCDescr): New prototype. + * prims.cc (_Jv_AllocObject): Rename parameter `c' to `klass'. Pass + `klass' to _Jv_AllocObj. Don't set the new object's vtable. Use + get_finalizer() instead of direct finalizer vtable offset. + (_Jv_NewObjectArray): Rename parameter `clas' to `klass'. Pass + `klass' to _Jv_AllocArray. Don't set the new array's vtable. + (_Jv_NewPrimArray): Call _Jv_FindArrayClass before _Jv_AllocObj. Pass + `klass' to _Jv_AllocObj. Don't set the new array's vtable. + * resolve.cc (METHOD_NOT_THERE, METHOD_INACCESSIBLE): New #defines. + (_Jv_ResolvePoolEntry): Use METHOD_NOT_THERE and METHOD_INACCESSIBLE. + (_Jv_DetermineVTableIndex): Ditto. + (_Jv_PrepareClass): Ditto. Remove offset-by-one adjustments from vtable + calculations to account for new gc_descr field. + * boehm.cc: #include gc_gcj.h. + (obj_kind_x, obj_free_list): `#if 0'-ed away. + (_Jv_MarkObj): Check that vtable doesn't point to a cleared object. + New commentary from HB. Mark the classes vtable. + (_Jv_MarkArray): Check that vtable doesn't point to a cleared object. + (GC_DEFAULT_DESCR): New #define. + (_Jv_BuildGCDescr): New function. Use GC_DEFAULT_DESCR, for now. + (_Jv_AllocObj): New parameter `klass'. Use GC_GCJ_MALLOC (). + (_Jv_AllocArray): New parameter `klass'. Allocate with GC_MALLOC and + scan conservativly if size is less than min_heap_addr. Set vtable + pointer of new object before returning. + (_Jv_AllocBytes): Use GC_MALLOC_ATOMIC, not GC_GENERIC_MALLOC. + (_Jv_InitGC): Call GC_init_gcj_malloc(). Don't set up marking and + allocation for obj_kind_x. + * nogc.cc (_Jv_BuildGCDescr): New function. Return 0. + (_Jv_AllocObj): Set vtable on returned object. + (_Jv_AllocArray): Ditto. + * java/lang/Class.h (_Jv_NewObjectArray): No longer a friend. + (_Jv_NewPrimArray): Ditto. + (_Jv_AllocObj): Declare as a friend. + (_Jv_AllocArray): Ditto. + * java/lang/natClassLoader.cc (_Jv_FindArrayClass): Copy gc_descr + from &ObjectClass into new array class. Remove offset-by-one + adjustments from `method' size calculations to account for gc_descr + field. + 2000-09-26 Tom Tromey <tromey@cygnus.com> * java/awt/Scrollbar.java (removeAdjustmentListener): Use diff --git a/libjava/boehm.cc b/libjava/boehm.cc index 14c4263..f0d679c 100644 --- a/libjava/boehm.cc +++ b/libjava/boehm.cc @@ -28,6 +28,7 @@ extern "C" { #include <gc_priv.h> #include <gc_mark.h> +#include <include/gc_gcj.h> // These aren't declared in any Boehm GC header. void GC_finalize_all (void); @@ -58,14 +59,16 @@ extern java::lang::Class ClassClass; // Nonzero if this module has been initialized. static int initialized = 0; +#if 0 // `kind' index used when allocating Java objects. static int obj_kind_x; -// `kind' index used when allocating Java arrays. -static int array_kind_x; - // Freelist used for Java objects. static ptr_t *obj_free_list; +#endif /* 0 */ + +// `kind' index used when allocating Java arrays. +static int array_kind_x; // Freelist used for Java arrays. static ptr_t *array_free_list; @@ -79,16 +82,24 @@ static _Jv_Mutex_t disable_gc_mutex; // object. We use `void *' arguments and return, and not what the // Boehm GC wants, to avoid pollution in our headers. void * -_Jv_MarkObj (void *addr, void *msp, void *msl, void * /*env*/) +_Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */) { mse *mark_stack_ptr = (mse *) msp; mse *mark_stack_limit = (mse *) msl; jobject obj = (jobject) addr; + // FIXME: if env is 1, this object was allocated through the debug + // interface, and addr points to the beginning of the debug header. + // In that case, we should really add the size of the header to addr. + _Jv_VTable *dt = *(_Jv_VTable **) addr; - // We check this in case a GC occurs before the vtbl is set. FIXME: - // should use allocation lock while initializing object. - if (__builtin_expect (! dt, false)) + // The object might not yet have its vtable set, or it might + // really be an object on the freelist. In either case, the vtable slot + // will either be 0, or it will point to a cleared object. + // This assumes Java objects have size at least 3 words, + // including the header. But this should remain true, since this + // should only be used with debugging allocation or with large objects. + if (__builtin_expect (! dt || !(dt -> get_finalizer()), false)) return mark_stack_ptr; jclass klass = dt->clas; @@ -101,6 +112,18 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /*env*/) if (__builtin_expect (klass == &ClassClass, false)) { + // Currently we allocate some of the memory referenced from class objects + // as pointerfree memory, and then mark it more intelligently here. + // We ensure that the ClassClass mark descriptor forces invocation of + // this procedure. + // Correctness of this is subtle, but it looks OK to me for now. For the incremental + // collector, we need to make sure that the class object is written whenever + // any of the subobjects are altered and may need rescanning. This may be tricky + // during construction, and this may not be the right way to do this with + // incremental collection. + // If we overflow the mark stack, we will rescan the class object, so we should + // be OK. The same applies if we redo the mark phase because win32 unmapped part + // of our root set. - HB jclass c = (jclass) addr; p = (ptr_t) c->name; @@ -121,6 +144,8 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /*env*/) MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c5alabel); p = (ptr_t) c->constants.data; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c5blabel); + p = (ptr_t) c->vtable; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c5clabel); } #endif @@ -272,9 +297,10 @@ _Jv_MarkArray (void *addr, void *msp, void *msl, void * /*env*/) jobjectArray array = (jobjectArray) addr; _Jv_VTable *dt = *(_Jv_VTable **) addr; - // We check this in case a GC occurs before the vtbl is set. FIXME: - // should use allocation lock while initializing object. - if (__builtin_expect (! dt, false)) + // Assumes size >= 3 words. That's currently true since arrays have + // a vtable, sync pointer, and size. If the sync pointer goes away, + // we may need to round up the size. + if (__builtin_expect (! dt || !(dt -> get_finalizer()), false)) return mark_stack_ptr; jclass klass = dt->clas; @@ -295,29 +321,61 @@ _Jv_MarkArray (void *addr, void *msp, void *msl, void * /*env*/) return mark_stack_ptr; } -// Allocate space for a new Java object. FIXME: this might be the -// wrong interface; we might prefer to pass in the object type as -// well. It isn't important for this collector, but it might be for -// other collectors. +// Return GC descriptor for interpreted class +#ifdef INTERPRETER + +// We assume that the gcj mark proc has index 0. This is a dubious assumption, +// since another one could be registered first. But the compiler also +// knows this, so in that case everything else will break, too. +#define GCJ_DEFAULT_DESCR MAKE_PROC(GCJ_RESERVED_MARK_PROC_INDEX,0) +void * +_Jv_BuildGCDescr(jclass klass) +{ + /* 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. void * -_Jv_AllocObj (jsize size) +_Jv_AllocObj (jsize size, jclass klass) { - return GC_GENERIC_MALLOC (size, obj_kind_x); + return GC_GCJ_MALLOC (size, klass->vtable); } -// Allocate space for a new Java array. FIXME: again, this might be -// the wrong interface. +// Allocate space for a new Java array. +// Used only for arrays of objects. void * -_Jv_AllocArray (jsize size) +_Jv_AllocArray (jsize size, jclass klass) { - return GC_GENERIC_MALLOC (size, array_kind_x); + void *obj; + const jsize min_heap_addr = 16*1024; + // A heuristic. If size is less than this value, the size + // stored in the array can't possibly be misinterpreted as + // a pointer. Thus we lose nothing by scanning the object + // completely conservatively, since no misidentification can + // take place. + +#ifdef GC_DEBUG + // There isn't much to lose by scanning this conservatively. + // If we didn't, the mark proc would have to understand that + // it needed to skip the header. + obj = GC_MALLOC(size); +#else + if (size < min_heap_addr) + obj = GC_MALLOC(size); + else + obj = GC_GENERIC_MALLOC (size, array_kind_x); +#endif + *((_Jv_VTable **) obj) = klass->vtable; + return obj; } // Allocate some space that is known to be pointer-free. void * _Jv_AllocBytes (jsize size) { - void *r = GC_GENERIC_MALLOC (size, PTRFREE); + 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 @@ -423,6 +481,56 @@ _Jv_InitGC (void) return; } initialized = 1; + UNLOCK (); + + // Configure the collector to use the bitmap marking descriptors that we + // stash in the class vtable. + GC_init_gcj_malloc (0, (void *) _Jv_MarkObj); + + LOCK (); + GC_java_finalization = 1; + + // We use a different mark procedure for object arrays. This code + // configures a different object `kind' for object array allocation and + // marking. FIXME: see above. + array_free_list = (ptr_t *) GC_generic_malloc_inner ((MAXOBJSZ + 1) + * sizeof (ptr_t), + PTRFREE); + memset (array_free_list, 0, (MAXOBJSZ + 1) * sizeof (ptr_t)); + + proc = GC_n_mark_procs++; + GC_mark_procs[proc] = (mark_proc) _Jv_MarkArray; + + array_kind_x = GC_n_kinds++; + GC_obj_kinds[array_kind_x].ok_freelist = array_free_list; + GC_obj_kinds[array_kind_x].ok_reclaim_list = 0; + GC_obj_kinds[array_kind_x].ok_descriptor = MAKE_PROC (proc, 0); + GC_obj_kinds[array_kind_x].ok_relocate_descr = FALSE; + GC_obj_kinds[array_kind_x].ok_init = TRUE; + + _Jv_MutexInit (&disable_gc_mutex); + + UNLOCK (); + ENABLE_SIGNALS (); +} + +#if 0 +void +_Jv_InitGC (void) +{ + int proc; + DCL_LOCK_STATE; + + DISABLE_SIGNALS (); + LOCK (); + + if (initialized) + { + UNLOCK (); + ENABLE_SIGNALS (); + return; + } + initialized = 1; GC_java_finalization = 1; @@ -464,3 +572,4 @@ _Jv_InitGC (void) UNLOCK (); ENABLE_SIGNALS (); } +#endif /* 0 */ diff --git a/libjava/configure b/libjava/configure index dfbf8a5..e4a5528 100755 --- a/libjava/configure +++ b/libjava/configure @@ -2995,6 +2995,7 @@ GCINCS= GCDEPS= GCOBJS= GCSPEC= +JC1GCSPEC= GCTESTSPEC= case "$GC" in boehm) @@ -3005,6 +3006,7 @@ case "$GC" in GCLIBS="$GCDEPS -L\$(here)/../boehm-gc/$libsubdir" GCINCS='-I$(top_srcdir)/../boehm-gc -I$(top_builddir)/../boehm-gc' GCSPEC='-lgcjgc' + JC1GCSPEC='-fuse-boehm-gc' GCTESTSPEC="-L`pwd`/../boehm-gc/.libs -rpath `pwd`/../boehm-gc/.libs" GCINCS="$GCINCS `cat ../boehm-gc/boehm-cflags`" GCOBJS=boehm.lo @@ -3032,8 +3034,9 @@ esac + echo $ac_n "checking for threads package to use""... $ac_c" 1>&6 -echo "configure:3037: checking for threads package to use" >&5 +echo "configure:3040: checking for threads package to use" >&5 # Check whether --enable-threads or --disable-threads was given. if test "${enable_threads+set}" = set; then enableval="$enable_threads" @@ -3227,12 +3230,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:3231: checking for $ac_func" >&5 +echo "configure:3234: 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 <<EOF -#line 3236 "configure" +#line 3239 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3255,7 +3258,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3262: \"$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 @@ -3282,12 +3285,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:3286: checking for $ac_func" >&5 +echo "configure:3289: 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 <<EOF -#line 3291 "configure" +#line 3294 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3310,7 +3313,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3317: \"$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 @@ -3337,12 +3340,12 @@ done for ac_func in access stat mkdir rename rmdir unlink realpath do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3341: checking for $ac_func" >&5 +echo "configure:3344: 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 <<EOF -#line 3346 "configure" +#line 3349 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3365,7 +3368,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3372: \"$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 @@ -3392,12 +3395,12 @@ done for ac_func in iconv nl_langinfo do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3396: checking for $ac_func" >&5 +echo "configure:3399: 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 <<EOF -#line 3401 "configure" +#line 3404 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3420,7 +3423,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3427: \"$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 @@ -3447,12 +3450,12 @@ done for ac_func in inet_aton inet_addr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3451: checking for $ac_func" >&5 +echo "configure:3454: 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 <<EOF -#line 3456 "configure" +#line 3459 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3475,7 +3478,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3482: \"$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 @@ -3502,12 +3505,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:3506: checking for $ac_func" >&5 +echo "configure:3509: 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 <<EOF -#line 3511 "configure" +#line 3514 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3530,7 +3533,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3537: \"$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 @@ -3557,12 +3560,12 @@ done for ac_func in backtrace fork execvp pipe do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3561: checking for $ac_func" >&5 +echo "configure:3564: 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 <<EOF -#line 3566 "configure" +#line 3569 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3585,7 +3588,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3592: \"$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 @@ -3613,17 +3616,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3617: checking for $ac_hdr" >&5 +echo "configure:3620: 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 -#line 3622 "configure" +#line 3625 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3630: \"$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* @@ -3650,7 +3653,7 @@ fi done echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6 -echo "configure:3654: checking for dladdr in -ldl" >&5 +echo "configure:3657: 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 @@ -3658,7 +3661,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3662 "configure" +#line 3665 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3669,7 +3672,7 @@ int main() { dladdr() ; return 0; } EOF -if { (eval echo configure:3673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3676: \"$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 @@ -3698,7 +3701,7 @@ do ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_file""... $ac_c" 1>&6 -echo "configure:3702: checking for $ac_file" >&5 +echo "configure:3705: 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 @@ -3733,12 +3736,12 @@ done for ac_func in gethostbyname_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3737: checking for $ac_func" >&5 +echo "configure:3740: 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 <<EOF -#line 3742 "configure" +#line 3745 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3761,7 +3764,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3768: \"$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 @@ -3788,7 +3791,7 @@ EOF # We look for the one that returns `int'. # Hopefully this check is robust enough. cat > conftest.$ac_ext <<EOF -#line 3792 "configure" +#line 3795 "configure" #include "confdefs.h" #include <netdb.h> EOF @@ -3808,7 +3811,7 @@ rm -f conftest* *" -D_REENTRANT "*) ;; *) echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6 -echo "configure:3812: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5 +echo "configure:3815: 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 @@ -3821,14 +3824,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <<EOF -#line 3825 "configure" +#line 3828 "configure" #include "confdefs.h" #include <netdb.h> int main() { gethostbyname_r("", 0, 0); ; return 0; } EOF -if { (eval echo configure:3832: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3835: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_gethostbyname_r_needs_reentrant=no else @@ -3838,14 +3841,14 @@ else CPPFLAGS_SAVE="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_REENTRANT" cat > conftest.$ac_ext <<EOF -#line 3842 "configure" +#line 3845 "configure" #include "confdefs.h" #include <netdb.h> int main() { gethostbyname_r("", 0, 0); ; return 0; } EOF -if { (eval echo configure:3849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_gethostbyname_r_needs_reentrant=yes else @@ -3880,12 +3883,12 @@ EOF esac echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6 -echo "configure:3884: checking for struct hostent_data" >&5 +echo "configure:3887: 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 <<EOF -#line 3889 "configure" +#line 3892 "configure" #include "confdefs.h" #if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT) @@ -3896,7 +3899,7 @@ int main() { struct hostent_data data; ; return 0; } EOF -if { (eval echo configure:3900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_struct_hostent_data=yes else @@ -3925,12 +3928,12 @@ done for ac_func in gethostbyaddr_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3929: checking for $ac_func" >&5 +echo "configure:3932: 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 <<EOF -#line 3934 "configure" +#line 3937 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3953,7 +3956,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3960: \"$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 @@ -3980,7 +3983,7 @@ EOF # We look for the one that returns `int'. # Hopefully this check is robust enough. cat > conftest.$ac_ext <<EOF -#line 3984 "configure" +#line 3987 "configure" #include "confdefs.h" #include <netdb.h> EOF @@ -4004,12 +4007,12 @@ done for ac_func in gethostname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4008: checking for $ac_func" >&5 +echo "configure:4011: 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 <<EOF -#line 4013 "configure" +#line 4016 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4032,7 +4035,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4039: \"$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 @@ -4056,7 +4059,7 @@ EOF EOF cat > conftest.$ac_ext <<EOF -#line 4060 "configure" +#line 4063 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -4087,12 +4090,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:4091: checking for $ac_func" >&5 +echo "configure:4094: 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 <<EOF -#line 4096 "configure" +#line 4099 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4115,7 +4118,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4122: \"$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 @@ -4145,12 +4148,12 @@ done for ac_func in sched_yield do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4149: checking for $ac_func" >&5 +echo "configure:4152: 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 <<EOF -#line 4154 "configure" +#line 4157 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4173,7 +4176,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4180: \"$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 @@ -4195,7 +4198,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6 -echo "configure:4199: checking for sched_yield in -lrt" >&5 +echo "configure:4202: 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 @@ -4203,7 +4206,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lrt $LIBS" cat > conftest.$ac_ext <<EOF -#line 4207 "configure" +#line 4210 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4214,7 +4217,7 @@ int main() { sched_yield() ; return 0; } EOF -if { (eval echo configure:4218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4221: \"$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 @@ -4240,7 +4243,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6 -echo "configure:4244: checking for sched_yield in -lposix4" >&5 +echo "configure:4247: 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 @@ -4248,7 +4251,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <<EOF -#line 4252 "configure" +#line 4255 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4259,7 +4262,7 @@ int main() { sched_yield() ; return 0; } EOF -if { (eval echo configure:4263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4266: \"$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 @@ -4295,7 +4298,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 <<EOF -#line 4299 "configure" +#line 4302 "configure" #include "confdefs.h" #include <pthread.h> int main() { @@ -4304,7 +4307,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4308: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define PTHREAD_MUTEX_HAVE_M_COUNT 1 @@ -4316,7 +4319,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 4320 "configure" +#line 4323 "configure" #include "confdefs.h" #include <pthread.h> int main() { @@ -4325,7 +4328,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4329: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define PTHREAD_MUTEX_HAVE___M_COUNT 1 @@ -4345,12 +4348,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:4349: checking for $ac_func" >&5 +echo "configure:4352: 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 <<EOF -#line 4354 "configure" +#line 4357 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4373,7 +4376,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4380: \"$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 @@ -4404,12 +4407,12 @@ done for ac_func in memmove do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4408: checking for $ac_func" >&5 +echo "configure:4411: 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 <<EOF -#line 4413 "configure" +#line 4416 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4432,7 +4435,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4439: \"$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 @@ -4462,12 +4465,12 @@ done for ac_func in memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4466: checking for $ac_func" >&5 +echo "configure:4469: 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 <<EOF -#line 4471 "configure" +#line 4474 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4490,7 +4493,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4497: \"$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 @@ -4538,7 +4541,7 @@ done #-------------------------------------------------------------------- echo $ac_n "checking for socket libraries""... $ac_c" 1>&6 -echo "configure:4542: checking for socket libraries" >&5 +echo "configure:4545: 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 @@ -4546,12 +4549,12 @@ else gcj_checkBoth=0 unset ac_cv_func_connect echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:4550: checking for connect" >&5 +echo "configure:4553: 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 <<EOF -#line 4555 "configure" +#line 4558 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -4574,7 +4577,7 @@ connect(); ; return 0; } EOF -if { (eval echo configure:4578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4581: \"$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 @@ -4597,7 +4600,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:4601: checking for main in -lsocket" >&5 +echo "configure:4604: 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 @@ -4605,14 +4608,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 4609 "configure" +#line 4612 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:4616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4619: \"$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 @@ -4639,12 +4642,12 @@ fi LIBS="$LIBS -lsocket -lnsl" unset ac_cv_func_accept echo $ac_n "checking for accept""... $ac_c" 1>&6 -echo "configure:4643: checking for accept" >&5 +echo "configure:4646: 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 <<EOF -#line 4648 "configure" +#line 4651 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char accept(); below. */ @@ -4667,7 +4670,7 @@ accept(); ; return 0; } EOF -if { (eval echo configure:4671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4674: \"$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 @@ -4694,12 +4697,12 @@ fi gcj_oldLibs=$LIBS LIBS="$LIBS $gcj_cv_lib_sockets" echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:4698: checking for gethostbyname" >&5 +echo "configure:4701: 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 <<EOF -#line 4703 "configure" +#line 4706 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname(); below. */ @@ -4722,7 +4725,7 @@ gethostbyname(); ; return 0; } EOF -if { (eval echo configure:4726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4729: \"$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 @@ -4740,7 +4743,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:4744: checking for main in -lnsl" >&5 +echo "configure:4747: 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 @@ -4748,14 +4751,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 4752 "configure" +#line 4755 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:4759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4762: \"$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 @@ -4787,7 +4790,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:4791: checking for deflate in -lz" >&5 +echo "configure:4794: 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 @@ -4795,7 +4798,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <<EOF -#line 4799 "configure" +#line 4802 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4806,7 +4809,7 @@ int main() { deflate() ; return 0; } EOF -if { (eval echo configure:4810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4813: \"$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 @@ -4836,7 +4839,7 @@ fi # requires -ldl. if test "$GC" = boehm; then echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6 -echo "configure:4840: checking for main in -ldl" >&5 +echo "configure:4843: 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 @@ -4844,14 +4847,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 4848 "configure" +#line 4851 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:4855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4858: \"$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 @@ -4898,7 +4901,7 @@ GCJ="$GCJ -I$srcdir" # 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:4902: checking for $ac_word" >&5 +echo "configure:4905: 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 @@ -4930,7 +4933,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:4934: checking for $ac_word" >&5 +echo "configure:4937: 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 @@ -4990,7 +4993,7 @@ exec 5>>./config.log echo $ac_n "checking size of void *""... $ac_c" 1>&6 -echo "configure:4994: checking size of void *" >&5 +echo "configure:4997: 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 @@ -4998,7 +5001,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 5002 "configure" +#line 5005 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -5009,7 +5012,7 @@ main() exit(0); } EOF -if { (eval echo configure:5013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5016: \"$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 @@ -5107,7 +5110,7 @@ EOF # See if gcj supports -fuse-divide-subroutine. gcc 2.95 does not, and # we want to continue to support that version. echo $ac_n "checking whether gcj supports -fuse-divide-subroutine""... $ac_c" 1>&6 -echo "configure:5111: checking whether gcj supports -fuse-divide-subroutine" >&5 +echo "configure:5114: checking whether gcj supports -fuse-divide-subroutine" >&5 cat > conftest.java << 'END' public class conftest { } END @@ -5124,18 +5127,18 @@ echo "$ac_t""$use_fuse" 1>&6 echo $ac_n "checking for g++ -ffloat-store bug""... $ac_c" 1>&6 -echo "configure:5128: checking for g++ -ffloat-store bug" >&5 +echo "configure:5131: checking for g++ -ffloat-store bug" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-x c++ -O2 -ffloat-store" cat > conftest.$ac_ext <<EOF -#line 5132 "configure" +#line 5135 "configure" #include "confdefs.h" #include <math.h> int main() { ; return 0; } EOF -if { (eval echo configure:5139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""no" 1>&6 else @@ -5155,17 +5158,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:5159: checking for $ac_hdr" >&5 +echo "configure:5162: 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 -#line 5164 "configure" +#line 5167 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5172: \"$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* @@ -5195,17 +5198,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:5199: checking for $ac_hdr" >&5 +echo "configure:5202: 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 -#line 5204 "configure" +#line 5207 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5209: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5212: \"$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* @@ -5233,12 +5236,12 @@ done echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:5237: checking for ANSI C header files" >&5 +echo "configure:5240: 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 <<EOF -#line 5242 "configure" +#line 5245 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -5246,7 +5249,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5253: \"$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* @@ -5263,7 +5266,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 -#line 5267 "configure" +#line 5270 "configure" #include "confdefs.h" #include <string.h> EOF @@ -5281,7 +5284,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 -#line 5285 "configure" +#line 5288 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -5302,7 +5305,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 5306 "configure" +#line 5309 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -5313,7 +5316,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:5317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -5337,12 +5340,12 @@ EOF fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:5341: checking for ssize_t" >&5 +echo "configure:5344: 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 <<EOF -#line 5346 "configure" +#line 5349 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -5371,9 +5374,9 @@ fi echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6 -echo "configure:5375: checking for in_addr_t" >&5 +echo "configure:5378: checking for in_addr_t" >&5 cat > conftest.$ac_ext <<EOF -#line 5377 "configure" +#line 5380 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -5387,7 +5390,7 @@ int main() { in_addr_t foo; ; return 0; } EOF -if { (eval echo configure:5391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_IN_ADDR_T 1 @@ -5403,16 +5406,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:5407: checking whether struct ip_mreq is in netinet/in.h" >&5 +echo "configure:5410: checking whether struct ip_mreq is in netinet/in.h" >&5 cat > conftest.$ac_ext <<EOF -#line 5409 "configure" +#line 5412 "configure" #include "confdefs.h" #include <netinet/in.h> int main() { struct ip_mreq mreq; ; return 0; } EOF -if { (eval echo configure:5416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5419: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STRUCT_IP_MREQ 1 @@ -5428,16 +5431,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:5432: checking whether struct sockaddr_in6 is in netinet/in.h" >&5 +echo "configure:5435: checking whether struct sockaddr_in6 is in netinet/in.h" >&5 cat > conftest.$ac_ext <<EOF -#line 5434 "configure" +#line 5437 "configure" #include "confdefs.h" #include <netinet/in.h> int main() { struct sockaddr_in6 addr6; ; return 0; } EOF -if { (eval echo configure:5441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_INET6 1 @@ -5453,16 +5456,16 @@ fi rm -f conftest* echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6 -echo "configure:5457: checking for socklen_t in sys/socket.h" >&5 +echo "configure:5460: checking for socklen_t in sys/socket.h" >&5 cat > conftest.$ac_ext <<EOF -#line 5459 "configure" +#line 5462 "configure" #include "confdefs.h" #include <sys/socket.h> int main() { socklen_t x = 5; ; return 0; } EOF -if { (eval echo configure:5466: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_SOCKLEN_T 1 @@ -5478,16 +5481,16 @@ fi rm -f conftest* echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:5482: checking for tm_gmtoff in struct tm" >&5 +echo "configure:5485: checking for tm_gmtoff in struct tm" >&5 cat > conftest.$ac_ext <<EOF -#line 5484 "configure" +#line 5487 "configure" #include "confdefs.h" #include <time.h> int main() { struct tm tim; tim.tm_gmtoff = 0; ; return 0; } EOF -if { (eval echo configure:5491: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define STRUCT_TM_HAS_GMTOFF 1 @@ -5500,16 +5503,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:5504: checking for global timezone variable" >&5 +echo "configure:5507: checking for global timezone variable" >&5 cat > conftest.$ac_ext <<EOF -#line 5506 "configure" +#line 5509 "configure" #include "confdefs.h" #include <time.h> int main() { long z2 = timezone; ; return 0; } EOF -if { (eval echo configure:5513: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5516: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TIMEZONE 1 @@ -5529,19 +5532,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:5533: checking for working alloca.h" >&5 +echo "configure:5536: 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 <<EOF -#line 5538 "configure" +#line 5541 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:5545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5548: \"$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 @@ -5562,12 +5565,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:5566: checking for alloca" >&5 +echo "configure:5569: 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 <<EOF -#line 5571 "configure" +#line 5574 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -5595,7 +5598,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:5599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5602: \"$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 @@ -5627,12 +5630,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:5631: checking whether alloca needs Cray hooks" >&5 +echo "configure:5634: 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 <<EOF -#line 5636 "configure" +#line 5639 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -5657,12 +5660,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&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:5661: checking for $ac_func" >&5 +echo "configure:5664: 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 <<EOF -#line 5666 "configure" +#line 5669 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5685,7 +5688,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5692: \"$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 @@ -5712,7 +5715,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:5716: checking stack direction for C alloca" >&5 +echo "configure:5719: 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 @@ -5720,7 +5723,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 5724 "configure" +#line 5727 "configure" #include "confdefs.h" find_stack_direction () { @@ -5739,7 +5742,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:5743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5746: \"$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 @@ -5766,7 +5769,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:5770: checking for $ac_word" >&5 +echo "configure:5773: 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 @@ -6028,6 +6031,7 @@ s%@GCINCS@%$GCINCS%g s%@GCDEPS@%$GCDEPS%g s%@GCOBJS@%$GCOBJS%g s%@GCSPEC@%$GCSPEC%g +s%@JC1GCSPEC@%$JC1GCSPEC%g s%@GCTESTSPEC@%$GCTESTSPEC%g s%@THREADLIBS@%$THREADLIBS%g s%@THREADINCS@%$THREADINCS%g diff --git a/libjava/configure.in b/libjava/configure.in index a0723ba..0cbdcb2 100644 --- a/libjava/configure.in +++ b/libjava/configure.in @@ -208,6 +208,7 @@ GCINCS= GCDEPS= GCOBJS= GCSPEC= +JC1GCSPEC= GCTESTSPEC= case "$GC" in boehm) @@ -218,6 +219,7 @@ case "$GC" in GCLIBS="$GCDEPS -L\$(here)/../boehm-gc/$libsubdir" GCINCS='-I$(top_srcdir)/../boehm-gc -I$(top_builddir)/../boehm-gc' GCSPEC='-lgcjgc' + JC1GCSPEC='-fuse-boehm-gc' GCTESTSPEC="-L`pwd`/../boehm-gc/.libs -rpath `pwd`/../boehm-gc/.libs" dnl We also want to pick up some cpp flags required when including dnl boehm-config.h. Yuck. @@ -241,6 +243,7 @@ AC_SUBST(GCINCS) AC_SUBST(GCDEPS) AC_SUBST(GCOBJS) AC_SUBST(GCSPEC) +AC_SUBST(JC1GCSPEC) AC_SUBST(GCTESTSPEC) AC_LINK_FILES(include/$GCHDR, include/java-gc.h) diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index e6e6fa6..8d93ed5 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -31,7 +31,9 @@ details. */ struct _Jv_VTable { jclass clas; + void *gc_descr; void *method[1]; + void *get_finalizer() { return method[0]; } }; // Number of virtual methods on object. FIXME: it sucks that we have @@ -42,8 +44,9 @@ struct _Jv_VTable struct _Jv_ArrayVTable { jclass clas; - // `+1' because there is an extra slot for C++ RTTI compatibility. - void *method[NUM_OBJECT_METHODS + 1]; + void *gc_descr; + void *method[NUM_OBJECT_METHODS]; + void *get_finalizer() { return method[0]; } }; union _Jv_word @@ -106,15 +109,19 @@ extern java::lang::Class StringClass; typedef void _Jv_FinalizerFunc (jobject); /* Allocate space for a new Java object. */ -void *_Jv_AllocObj (jsize size) __attribute__((__malloc__)); +void *_Jv_AllocObj (jsize size, jclass cl) __attribute__((__malloc__)); /* Allocate space for an array of Java objects. */ -void *_Jv_AllocArray (jsize size) __attribute__((__malloc__)); +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__)); /* Initialize the GC. */ void _Jv_InitGC (void); /* Register a finalizer. */ void _Jv_RegisterFinalizer (void *object, _Jv_FinalizerFunc *method); +/* Compute the GC descriptor for a class */ +#ifdef INTERPRETER +void * _Jv_BuildGCDescr(jclass); +#endif /* Allocate some unscanned, unmoveable memory. Return NULL if out of memory. */ diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index 0f60274..0300a59 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -220,8 +220,8 @@ private: friend jint JvNumStaticFields (jclass); friend jobject _Jv_AllocObject (jclass, jint); - friend jobjectArray _Jv_NewObjectArray (jsize, jclass, jobject); - friend jobject _Jv_NewPrimArray (jclass, jint); + friend void *_Jv_AllocObj (jint, jclass); + friend void *_Jv_AllocArray (jint, jclass); friend jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv *, jclass, jfieldID, jboolean); diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index 54ffc42..b03b8c2 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -586,16 +586,15 @@ _Jv_FindArrayClass (jclass element, java::lang::ClassLoader *loader, array_class = _Jv_NewClass (array_name, &ObjectClass, element->loader); // Note that `vtable_method_count' doesn't include the initial - // NULL slot. + // gc_descr slot. JvAssert (ObjectClass.vtable_method_count == NUM_OBJECT_METHODS); - int dm_count = ObjectClass.vtable_method_count + 1; + int dm_count = ObjectClass.vtable_method_count; // Create a new vtable by copying Object's vtable (except the // class pointer, of course). Note that we allocate this as // unscanned memory -- the vtables are handled specially by the // GC. - int size = (sizeof (_Jv_VTable) + - ((dm_count - 1) * sizeof (void *))); + int size = (sizeof (_Jv_VTable) + ((dm_count - 1) * sizeof (void *))); _Jv_VTable *vtable; if (array_vtable) vtable = array_vtable; @@ -604,6 +603,7 @@ _Jv_FindArrayClass (jclass element, java::lang::ClassLoader *loader, vtable->clas = array_class; memcpy (vtable->method, ObjectClass.vtable->method, dm_count * sizeof (void *)); + vtable->gc_descr = ObjectClass.vtable->gc_descr; array_class->vtable = vtable; array_class->vtable_method_count = ObjectClass.vtable_method_count; @@ -615,6 +615,8 @@ _Jv_FindArrayClass (jclass element, java::lang::ClassLoader *loader, array_class->interfaces = interfaces; array_class->interface_count = sizeof interfaces / sizeof interfaces[0]; + // FIXME: Shouldn't this be synchronized? _Jv_PrepareConstantTimeTables + // needs to be called with the mutex for array_class held. // Generate the interface dispatch table. _Jv_PrepareConstantTimeTables (array_class); diff --git a/libjava/libgcj.spec.in b/libjava/libgcj.spec.in index e9c2548..ec02658 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@ %(liborig) -*jc1: @DIVIDESPEC@ @EXCEPTIONSPEC@ -fasynchronous-exceptions +*jc1: @DIVIDESPEC@ @EXCEPTIONSPEC@ @JC1GCSPEC@ -fasynchronous-exceptions # # libgcc should really be a shared library. This is a design flaw diff --git a/libjava/nogc.cc b/libjava/nogc.cc index 10d4f80..b5bd6f3 100644 --- a/libjava/nogc.cc +++ b/libjava/nogc.cc @@ -19,18 +19,30 @@ details. */ // Total amount of memory allocated. static long total = 0; +#ifdef INTERPRETER void * -_Jv_AllocObj (jsize size) +_Jv_BuildGCDescr(jclass klass) +{ + return 0; +} +#endif + +void * +_Jv_AllocObj (jsize size, jclass klass) { total += size; - return calloc (size, 1); + ptr_t obj = calloc (size, 1); + *((_Jv_VTable **) obj) = klass->vtable; + return obj; } void * -_Jv_AllocArray (jsize size) +_Jv_AllocArray (jsize size, jclass klass) { total += size; - return calloc (size, 1); + ptr_t obj = calloc (size, 1); + *((_Jv_VTable **) obj) = klass->vtable; + return obj; } void * diff --git a/libjava/prims.cc b/libjava/prims.cc index 92e4496..ff48b97 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -335,18 +335,17 @@ _Jv_AllocBytesChecked (jsize size) return r; } -// Allocate a new object of class C. SIZE is the size of the object +// Allocate a new object of class KLASS. SIZE is the size of the object // to allocate. You might think this is redundant, but it isn't; some // classes, such as String, aren't of fixed size. jobject -_Jv_AllocObject (jclass c, jint size) +_Jv_AllocObject (jclass klass, jint size) { - _Jv_InitClass (c); + _Jv_InitClass (klass); - jobject obj = (jobject) _Jv_AllocObj (size); + jobject obj = (jobject) _Jv_AllocObj (size, klass); if (__builtin_expect (! obj, false)) JvThrow (no_memory); - *((_Jv_VTable **) obj) = c->vtable; // If this class has inherited finalize from Object, then don't // bother registering a finalizer. We know that finalize() is the @@ -355,7 +354,7 @@ _Jv_AllocObject (jclass c, jint size) // implementation would look for Object.finalize in Object's method // table at startup, and then use that information to find the // appropriate index in the method vector. - if (c->vtable->method[1] != ObjectClass.vtable->method[1]) + if (klass->vtable->get_finalizer() != ObjectClass.vtable->get_finalizer()) _Jv_RegisterFinalizer (obj, _Jv_FinalizeObject); #ifdef ENABLE_JVMPI @@ -368,7 +367,7 @@ _Jv_AllocObject (jclass c, jint size) 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) c; + 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; @@ -405,9 +404,9 @@ _Jv_NewObjectArray (jsize count, jclass elementClass, jobject init) size += count * sizeof (jobject); // FIXME: second argument should be "current loader" // - jclass clas = _Jv_FindArrayClass (elementClass, 0); + jclass klass = _Jv_FindArrayClass (elementClass, 0); - obj = (jobjectArray) _Jv_AllocArray (size); + obj = (jobjectArray) _Jv_AllocArray (size, klass); if (__builtin_expect (! obj, false)) JvThrow (no_memory); obj->length = count; @@ -419,10 +418,6 @@ _Jv_NewObjectArray (jsize count, jclass elementClass, jobject init) while (--count >= 0) *ptr++ = init; } - // Set the vtbl last to avoid problems if the GC happens during the - // window in this function between the allocation and this - // assignment. - *((_Jv_VTable **) obj) = clas->vtable; return obj; } @@ -444,17 +439,14 @@ _Jv_NewPrimArray (jclass eltype, jint count) (SIZE_T_MAX - size) / elsize, false)) JvThrow (no_memory); - __JArray *arr = (__JArray*) _Jv_AllocObj (size + elsize * count); + jclass klass = _Jv_FindArrayClass (eltype, 0); + + __JArray *arr = (__JArray*) _Jv_AllocObj (size + elsize * count, klass); if (__builtin_expect (! arr, false)) JvThrow (no_memory); arr->length = count; // Note that we assume we are given zeroed memory by the allocator. - jclass klass = _Jv_FindArrayClass (eltype, 0); - // Set the vtbl last to avoid problems if the GC happens during the - // window in this function between the allocation and this - // assignment. - *((_Jv_VTable **) arr) = klass->vtable; return arr; } diff --git a/libjava/resolve.cc b/libjava/resolve.cc index ab1fafb..898de51 100644 --- a/libjava/resolve.cc +++ b/libjava/resolve.cc @@ -46,6 +46,9 @@ extern java::lang::Class ClassObject; #define ObjectClass _CL_Q34java4lang6Object extern java::lang::Class ObjectClass; +// Exceptional return values for _Jv_DetermineVTableIndex +#define METHOD_NOT_THERE (-2) +#define METHOD_INACCESSIBLE (-1) static int get_alignment_from_class (jclass); @@ -299,7 +302,7 @@ _Jv_ResolvePoolEntry (jclass klass, int index) vtable_index = _Jv_DetermineVTableIndex (found_class, method_name, method_signature); - if (vtable_index == 0) + if (vtable_index == METHOD_NOT_THERE) throw_incompatible_class_change_error (JvNewStringLatin1 ("method not found")); @@ -378,9 +381,9 @@ _Jv_ResolveField (_Jv_Field *field, java::lang::ClassLoader *loader) things if compiled classes to know vtable offset, and _Jv_Method had a field for this. - Returns 0 if this class does not declare the given method. - Returns -1 if the given method does not appear in the vtable. - i.e., it is static, private, final or a constructor. + Returns METHOD_NOT_THERE if this class does not declare the given method. + Returns METHOD_INACCESSIBLE if the given method does not appear in the + vtable, i.e., it is static, private, final or a constructor. Otherwise, returns the vtable index. */ int _Jv_DetermineVTableIndex (jclass klass, @@ -396,7 +399,7 @@ _Jv_DetermineVTableIndex (jclass klass, int prev = _Jv_DetermineVTableIndex (super_class, name, signature); - if (prev != 0) + if (prev != METHOD_NOT_THERE) return prev; } @@ -410,7 +413,7 @@ _Jv_DetermineVTableIndex (jclass klass, /* now, if we do not declare this method, return zero */ if (meth == NULL) - return 0; + return METHOD_NOT_THERE; /* so now, we know not only that the super class does not declare the * method, but we do! So, this is a first declaration of the method. */ @@ -427,21 +430,21 @@ _Jv_DetermineVTableIndex (jclass klass, | Modifier::FINAL)) != 0 || (klass->accflags & Modifier::FINAL) != 0 || _Jv_equalUtf8Consts (name, init_name)) - return -1; + return METHOD_INACCESSIBLE; /* reaching this point, we know for sure, that the method in question * will be in the vtable. The question is where. */ /* the base offset, is where we will start assigning vtable - * indexes for this class. It is 1 for base classes - * (vtable->method[0] is unused), and for non-base classes it is the - * number of entries in the super class' vtable plus 1. */ + * indexes for this class. It is 0 for base classes + * and for non-base classes it is the + * number of entries in the super class' vtable. */ int base_offset; if (super_class == 0) - base_offset = 1; + base_offset = 0; else - base_offset = super_class->vtable_method_count+1; + base_offset = super_class->vtable_method_count; /* we will consider methods 0..this_method_index-1. And for each one, * determine if it is new (i.e., if it appears in the super class), @@ -704,6 +707,7 @@ _Jv_PrepareClass(jclass klass) _Jv_AllocBytesChecked (sizeof (_Jv_VTable) + (sizeof (void*) * (vtable_count))); vtable->clas = clz; + vtable->gc_descr = _Jv_BuildGCDescr(clz); { jclass effective_superclass = super_class; @@ -713,10 +717,10 @@ _Jv_PrepareClass(jclass klass) while (effective_superclass && effective_superclass->vtable == NULL) effective_superclass = effective_superclass->superclass; - /* copy super class' vtable entries (index 0 goes unused). */ + /* copy super class' vtable entries. */ if (effective_superclass && effective_superclass->vtable) - memcpy ((void*)&vtable->method[1], - (void*)&effective_superclass->vtable->method[1], + memcpy ((void*)&vtable->method[0], + (void*)&effective_superclass->vtable->method[0], sizeof (void*) * effective_superclass->vtable_method_count); } @@ -729,12 +733,12 @@ _Jv_PrepareClass(jclass klass) this_meth->name, this_meth->signature); - if (index == 0) + if (index == METHOD_NOT_THERE) throw_internal_error ("method now found in own class"); - if (index != -1) + if (index != METHOD_INACCESSIBLE) { - if (index > clz->vtable_method_count+1) + if (index > clz->vtable_method_count) throw_internal_error ("vtable problem..."); if (clz->interpreted_methods[i] == 0) |