Invocation related fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12566 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-02-20 05:08:46 +00:00
parent 17164af508
commit c7b827b21e
9 changed files with 102 additions and 72 deletions

View file

@ -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];

View file

@ -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)
{

View file

@ -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);

View file

@ -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

View file

@ -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;
}