diff --git a/ChangeLog b/ChangeLog index 694b231b3..fd948faa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-02-20 Richard Frith-Macdonald + + * Headers/Foundation/NSInvocation.h: Remove _argframe ivar + * Source/NSInvocation.m: Simplify by removing _argframe ivar and + using _frame throughout to hold arguments. Fix checks for valid frame. + * Source/callframe.m: Initialise newly created frame with zeros so + that setting an object in an invocation should work when the + invocation is retaining its contents. + * configure.in: Disable ffi and warn about it. + * configure: regenerated + 2002-02-13 Richard Frith-Macdonald * Source/NSUserDefaults.m: Removed some code that was doing nothing, diff --git a/Headers/gnustep/base/NSInvocation.h b/Headers/gnustep/base/NSInvocation.h index c5c393c99..b9544cfd9 100644 --- a/Headers/gnustep/base/NSInvocation.h +++ b/Headers/gnustep/base/NSInvocation.h @@ -30,7 +30,6 @@ @interface NSInvocation : NSObject { NSMethodSignature *_sig; - arglist_t _argframe; void *_cframe; void *_retval; id _target; diff --git a/Source/GSFFCallInvocation.m b/Source/GSFFCallInvocation.m index 21d156ed1..5d6e15687 100644 --- a/Source/GSFFCallInvocation.m +++ b/Source/GSFFCallInvocation.m @@ -653,7 +653,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp) /* * Temporarily set new target and copy it (and the selector) into the - * _argframe. + * _cframe. */ old_target = RETAIN(_target); [self setTarget: anObject]; diff --git a/Source/GSFFIInvocation.m b/Source/GSFFIInvocation.m index 9657f4ade..a40a84a72 100644 --- a/Source/GSFFIInvocation.m +++ b/Source/GSFFIInvocation.m @@ -58,7 +58,7 @@ { [self setSelector: aSelector]; /* - * Copy the _argframe we were given. + * Copy the _cframe we were given. */ if (frame) { @@ -83,7 +83,6 @@ _sig = RETAIN(aSignature); _numArgs = [aSignature numberOfArguments]; _info = [aSignature methodInfo]; - _argframe = mframe_create_argframe([_sig methodType], &_retval); _cframe = cifframe_from_sig([_sig methodType], &_retval); if (_retval == 0 && _info[0].size > 0) { diff --git a/Source/NSInvocation.m b/Source/NSInvocation.m index 860c3091e..db2694420 100644 --- a/Source/NSInvocation.m +++ b/Source/NSInvocation.m @@ -87,19 +87,19 @@ _arg_addr(NSInvocation *inv, int index) static inline void _get_arg(NSInvocation *inv, int index, void *buffer) { - mframe_get_arg(inv->_argframe, &inv->_info[index+1], buffer); + mframe_get_arg((arglist_t)inv->_cframe, &inv->_info[index+1], buffer); } static inline void _set_arg(NSInvocation *inv, int index, void *buffer) { - mframe_set_arg(inv->_argframe, &inv->_info[index+1], buffer); + mframe_set_arg((arglist_t)inv->_cframe, &inv->_info[index+1], buffer); } static inline void * _arg_addr(NSInvocation *inv, int index) { - return mframe_arg_addr(inv->_argframe, &inv->_info[index+1]); + return mframe_arg_addr((arglist_t)inv->_cframe, &inv->_info[index+1]); } #endif @@ -143,7 +143,7 @@ _arg_addr(NSInvocation *inv, int index) { RELEASE(_target); _argsRetained = NO; - if (_argframe && _sig) + if (_cframe && _sig) { int i; @@ -166,26 +166,28 @@ _arg_addr(NSInvocation *inv, int index) } } } -#ifdef USE_LIBFFI +#if defined(USE_LIBFFI) if (_cframe) - cifframe_free((cifframe_t *)_cframe); -#else -#ifdef USE_FFCALL + { + cifframe_free((cifframe_t *)_cframe); + _retval = 0; // Part of _cframe + } +#elif defined(USE_FFCALL) if (_cframe) { NSZoneFree(NSDefaultMallocZone(), _cframe); _retval = 0; // Part of _cframe } -#endif -#endif - if (_argframe) +#else + if (_cframe) { - mframe_destroy_argframe([_sig methodType], _argframe); + mframe_destroy_argframe([_sig methodType], (arglist_t)_cframe); } if (_retval) { NSZoneFree(NSDefaultMallocZone(), _retval); } +#endif RELEASE(_sig); [super dealloc]; } @@ -369,7 +371,7 @@ _arg_addr(NSInvocation *inv, int index) _argsRetained = YES; IF_NO_GC(RETAIN(_target)); - if (_argframe == 0) + if (_cframe == 0) { return; } @@ -435,7 +437,7 @@ _arg_addr(NSInvocation *inv, int index) /* * Temporarily set new target and copy it (and the selector) into the - * _argframe. + * _cframe. */ old_target = RETAIN(_target); [self setTarget: anObject]; @@ -484,7 +486,8 @@ _arg_addr(NSInvocation *inv, int index) cifframe_decode_return(_info[0].type, _retval); } #else - returned = __builtin_apply((void(*)(void))imp, _argframe, stack_argsize); + returned = __builtin_apply((void(*)(void))imp, + (arglist_t)_cframe, stack_argsize); if (_info[0].size) { mframe_decode_return(_info[0].type, _retval, returned); @@ -786,7 +789,7 @@ _arg_addr(NSInvocation *inv, int index) { [self setSelector: aSelector]; /* - * Copy the _argframe we were given. + * Copy the _cframe we were given. */ if (frame) { @@ -795,7 +798,7 @@ _arg_addr(NSInvocation *inv, int index) mframe_get_arg(frame, &_info[1], &_target); for (i = 1; i <= _numArgs; i++) { - mframe_cpy_arg(_argframe, frame, &_info[i]); + mframe_cpy_arg((arglist_t)_cframe, frame, &_info[i]); } } } @@ -810,7 +813,7 @@ _arg_addr(NSInvocation *inv, int index) _sig = RETAIN(aSignature); _numArgs = [aSignature numberOfArguments]; _info = [aSignature methodInfo]; - _argframe = mframe_create_argframe([_sig methodType], &_retval); + _cframe = mframe_create_argframe([_sig methodType], &_retval); if (_retval == 0 && _info[0].size > 0) { _retval = NSZoneMalloc(NSDefaultMallocZone(), _info[0].size); diff --git a/Source/callframe.m b/Source/callframe.m index c72656b09..f5319ec70 100644 --- a/Source/callframe.m +++ b/Source/callframe.m @@ -91,7 +91,7 @@ callframe_from_info (NSArgumentInfo *info, int numargs, void **retval) } pos = full; full += MAX(info[0].size, sizeof(smallret_t)); - cframe = buf = NSZoneMalloc(NSDefaultMallocZone(), full); + cframe = buf = NSZoneCalloc(NSDefaultMallocZone(), full, 1); if (cframe) { *retval = buf + pos; @@ -99,7 +99,7 @@ callframe_from_info (NSArgumentInfo *info, int numargs, void **retval) } else { - cframe = buf = NSZoneMalloc(NSDefaultMallocZone(), size); + cframe = buf = NSZoneCalloc(NSDefaultMallocZone(), size, 1); } if (cframe) @@ -633,7 +633,7 @@ callframe_build_return (NSInvocation *inv, retLength = objc_sizeof_type(tmptype); /* Allocate memory to hold the value we're pointing to. */ *(void**)retval = - NSZoneMalloc(NSDefaultMallocZone(), retLength); + NSZoneCalloc(NSDefaultMallocZone(), retLength, 1); /* We are responsible for making sure this memory gets free'd eventually. Ask NSData class to autorelease it. */ [NSData dataWithBytesNoCopy: *(void**)retval diff --git a/Source/cifframe.m b/Source/cifframe.m index 446330b6f..fece54157 100644 --- a/Source/cifframe.m +++ b/Source/cifframe.m @@ -73,8 +73,8 @@ cifframe_from_sig (const char *typePtr, void **retval) if (retval) { - *retval = NSZoneMalloc(NSDefaultMallocZone(), - MAX(cframe->rtype->size, sizeof(smallret_t)) ); + *retval = NSZoneCalloc(NSDefaultMallocZone(), + MAX(cframe->rtype->size, sizeof(smallret_t)), 1); } return cframe; } diff --git a/configure b/configure index 10ac07fc7..d3fe78baf 100755 --- a/configure +++ b/configure @@ -4978,6 +4978,15 @@ else enable_libffi=no fi +if test $enable_libffi = yes; then + echo "configure: warning: libffi support disabled" 1>&2 + echo + echo "GNUstep requires more functionality than the ffi library" + echo "currently supports ... please use ffcall instead." + echo "libffi support will be added when the ffi library improves" + enable_libffi=no +fi + # Check whether --enable-ffcall or --disable-ffcall was given. if test "${enable_ffcall+set}" = set; then enableval="$enable_ffcall" @@ -4989,17 +4998,17 @@ fi ac_safe=`echo "ffi.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ffi.h""... $ac_c" 1>&6 -echo "configure:4993: checking for ffi.h" >&5 +echo "configure:5002: checking for ffi.h" >&5 if eval "test \"\${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:5003: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5012: \"$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* @@ -5023,9 +5032,9 @@ fi echo $ac_n "checking "for forwarding callback in runtime"""... $ac_c" 1>&6 -echo "configure:5027: checking "for forwarding callback in runtime"" >&5 +echo "configure:5036: checking "for forwarding callback in runtime"" >&5 cat > conftest.$ac_ext < EOF @@ -5043,17 +5052,17 @@ for ac_hdr in callback.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5047: checking for $ac_hdr" >&5 +echo "configure:5056: checking for $ac_hdr" >&5 if eval "test \"\${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:5057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5066: \"$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* @@ -5082,7 +5091,7 @@ done echo $ac_n "checking "FFI library usage"""... $ac_c" 1>&6 -echo "configure:5086: checking "FFI library usage"" >&5 +echo "configure:5095: checking "FFI library usage"" >&5 WITH_FFI=none if test $enable_libffi = yes; then cat >> confdefs.h <<\EOF @@ -5147,7 +5156,7 @@ fi # Extract the first word of "xml2-config", so it can be a program name with args. set dummy xml2-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5151: checking for $ac_word" >&5 +echo "configure:5160: checking for $ac_word" >&5 if eval "test \"\${ac_cv_path_XML2_CONFIG+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5184,7 +5193,7 @@ fi # Extract the first word of "xml-config", so it can be a program name with args. set dummy xml-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5188: checking for $ac_word" >&5 +echo "configure:5197: checking for $ac_word" >&5 if eval "test \"\${ac_cv_path_XML_CONFIG+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5222,7 +5231,7 @@ fi fi min_xml_version=2.2.3 echo $ac_n "checking for libxml - version >= $min_xml_version""... $ac_c" 1>&6 -echo "configure:5226: checking for libxml - version >= $min_xml_version" >&5 +echo "configure:5235: checking for libxml - version >= $min_xml_version" >&5 no_xml="" if test "$XML_CONFIG" = "no" ; then no_xml=yes @@ -5245,7 +5254,7 @@ echo "configure:5226: checking for libxml - version >= $min_xml_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -5320,7 +5329,7 @@ main() } EOF -if { (eval echo configure:5324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -5432,17 +5441,17 @@ if test $enable_openssl = yes; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5436: checking for $ac_hdr" >&5 +echo "configure:5445: checking for $ac_hdr" >&5 if eval "test \"\${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:5446: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5455: \"$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* @@ -5477,7 +5486,7 @@ done ssl_ok=no else echo $ac_n "checking for CRYPTO_malloc in -lcrypto""... $ac_c" 1>&6 -echo "configure:5481: checking for CRYPTO_malloc in -lcrypto" >&5 +echo "configure:5490: checking for CRYPTO_malloc in -lcrypto" >&5 ac_lib_var=`echo crypto'_'CRYPTO_malloc | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5485,7 +5494,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypto $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5509: \"$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 @@ -5521,7 +5530,7 @@ fi base_libs="$LIBS" LIBS="$LIBS -lcrypto" echo $ac_n "checking for ssl2_clear in -lssl""... $ac_c" 1>&6 -echo "configure:5525: checking for ssl2_clear in -lssl" >&5 +echo "configure:5534: checking for ssl2_clear in -lssl" >&5 ac_lib_var=`echo ssl'_'ssl2_clear | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5529,7 +5538,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lssl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5553: \"$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 @@ -5575,7 +5584,7 @@ fi fi echo $ac_n "checking for des_setkey in -lcipher""... $ac_c" 1>&6 -echo "configure:5579: checking for des_setkey in -lcipher" >&5 +echo "configure:5588: checking for des_setkey in -lcipher" >&5 ac_lib_var=`echo cipher'_'des_setkey | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5583,7 +5592,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcipher $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5607: \"$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 @@ -5678,17 +5687,17 @@ for ac_hdr in gmp.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5682: checking for $ac_hdr" >&5 +echo "configure:5691: checking for $ac_hdr" >&5 if eval "test \"\${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:5692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5701: \"$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* @@ -5716,7 +5725,7 @@ done if test $ac_cv_header_gmp_h = yes; then echo $ac_n "checking for mpf_abs in -lgmp""... $ac_c" 1>&6 -echo "configure:5720: checking for mpf_abs in -lgmp" >&5 +echo "configure:5729: checking for mpf_abs in -lgmp" >&5 ac_lib_var=`echo gmp'_'mpf_abs | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5724,7 +5733,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgmp $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5748: \"$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 @@ -5758,7 +5767,7 @@ fi if test "$gmp_ok" = no; then echo $ac_n "checking for __gmpf_abs in -lgmp""... $ac_c" 1>&6 -echo "configure:5762: checking for __gmpf_abs in -lgmp" >&5 +echo "configure:5771: checking for __gmpf_abs in -lgmp" >&5 ac_lib_var=`echo gmp'_'__gmpf_abs | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5766,7 +5775,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgmp $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5790: \"$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 @@ -5819,12 +5828,12 @@ fi for ac_func in iconv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5823: checking for $ac_func" >&5 +echo "configure:5832: checking for $ac_func" >&5 if eval "test \"\${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:5861: \"$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 @@ -5890,7 +5899,7 @@ fi # BSDs install this lib as libgiconv echo $ac_n "checking for main in -lgiconv""... $ac_c" 1>&6 -echo "configure:5894: checking for main in -lgiconv" >&5 +echo "configure:5903: checking for main in -lgiconv" >&5 ac_lib_var=`echo giconv'_'main | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5898,14 +5907,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lgiconv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5918: \"$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 @@ -5943,7 +5952,7 @@ EOF else echo $ac_n "checking for main in -liconv""... $ac_c" 1>&6 -echo "configure:5947: checking for main in -liconv" >&5 +echo "configure:5956: checking for main in -liconv" >&5 ac_lib_var=`echo iconv'_'main | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5951,14 +5960,14 @@ else ac_save_LIBS="$LIBS" LIBS="-liconv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5971: \"$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 @@ -6004,7 +6013,7 @@ subdirs="Source/mframe" # Record the version #-------------------------------------------------------------------- echo $ac_n "checking for the version of gnustep-base we are compiling""... $ac_c" 1>&6 -echo "configure:6008: checking for the version of gnustep-base we are compiling" >&5 +echo "configure:6017: checking for the version of gnustep-base we are compiling" >&5 if test -f "Version"; then . ./Version fi diff --git a/configure.in b/configure.in index 849ab2eb2..1a21910e9 100644 --- a/configure.in +++ b/configure.in @@ -825,6 +825,15 @@ AC_MSG_RESULT($enable_fake_main) AC_ARG_ENABLE(libffi, [ --enable-libffi Enable use of libffi library],, enable_libffi=no) +if test $enable_libffi = yes; then + AC_WARN(libffi support disabled) + echo + echo "GNUstep requires more functionality than the ffi library" + echo "currently supports ... please use ffcall instead." + echo "libffi support will be added when the ffi library improves" + enable_libffi=no +fi + AC_ARG_ENABLE(ffcall, [ --enable-ffcall Enable use of ffcall library],, enable_ffcall=yes)