mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
simplify last change
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30616 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
acda1d1480
commit
68241e49bb
4 changed files with 20 additions and 23 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2010-06-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSFFIInvocation.m:
|
||||||
|
* Source/cifframe.h:
|
||||||
|
* Source/cifframe.m:
|
||||||
|
Removed distinction between GC and non-GC code.
|
||||||
|
|
||||||
2010-06-07 Richard Frith-Macdonald <rfm@gnu.org>
|
2010-06-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/GSInvocation.h:
|
* Source/GSInvocation.h:
|
||||||
|
|
|
@ -141,7 +141,7 @@ gs_find_by_receiver_best_typed_sel (id receiver, SEL sel)
|
||||||
|
|
||||||
static IMP gs_objc_msg_forward2 (id receiver, SEL sel)
|
static IMP gs_objc_msg_forward2 (id receiver, SEL sel)
|
||||||
{
|
{
|
||||||
void *frame;
|
NSMutableData *frame;
|
||||||
cifframe_t *cframe;
|
cifframe_t *cframe;
|
||||||
ffi_closure *cclosure;
|
ffi_closure *cclosure;
|
||||||
NSMethodSignature *sig;
|
NSMethodSignature *sig;
|
||||||
|
@ -202,11 +202,7 @@ static IMP gs_objc_msg_forward2 (id receiver, SEL sel)
|
||||||
where it becomes owned by the callback invocation, so we don't have to
|
where it becomes owned by the callback invocation, so we don't have to
|
||||||
worry about ownership */
|
worry about ownership */
|
||||||
frame = cifframe_from_signature(sig);
|
frame = cifframe_from_signature(sig);
|
||||||
#if GS_WITH_GC
|
cframe = [frame mutableBytes];
|
||||||
cframe = frame;
|
|
||||||
#else
|
|
||||||
cframe = [(NSMutableData*)frame mutableBytes];
|
|
||||||
#endif
|
|
||||||
/* Autorelease the closure through GSAutoreleasedBuffer */
|
/* Autorelease the closure through GSAutoreleasedBuffer */
|
||||||
|
|
||||||
memory = [GSCodeBuffer memoryWithSize: sizeof(ffi_closure)];
|
memory = [GSCodeBuffer memoryWithSize: sizeof(ffi_closure)];
|
||||||
|
@ -333,14 +329,9 @@ static id gs_objc_proxy_lookup(id receiver, SEL op)
|
||||||
_sig = RETAIN(aSignature);
|
_sig = RETAIN(aSignature);
|
||||||
_numArgs = [aSignature numberOfArguments];
|
_numArgs = [aSignature numberOfArguments];
|
||||||
_info = [aSignature methodInfo];
|
_info = [aSignature methodInfo];
|
||||||
#if GS_WITH_GC
|
_frame = cifframe_from_signature(_sig);
|
||||||
_frame = nil;
|
|
||||||
_cframe = cifframe_from_signature(_sig);
|
|
||||||
#else
|
|
||||||
_frame = (NSMutableData*)cifframe_from_signature(_sig);
|
|
||||||
[_frame retain];
|
[_frame retain];
|
||||||
_cframe = [_frame mutableBytes];
|
_cframe = [_frame mutableBytes];
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make sure we have somewhere to store the return value if needed.
|
/* Make sure we have somewhere to store the return value if needed.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -50,7 +50,9 @@ typedef struct _cifframe_t {
|
||||||
void **values;
|
void **values;
|
||||||
} cifframe_t;
|
} cifframe_t;
|
||||||
|
|
||||||
extern void *cifframe_from_signature (NSMethodSignature *info);
|
@class NSMutableData;
|
||||||
|
|
||||||
|
extern NSMutableData *cifframe_from_signature (NSMethodSignature *info);
|
||||||
|
|
||||||
extern void cifframe_set_arg(cifframe_t *cframe, int index, void *buffer,
|
extern void cifframe_set_arg(cifframe_t *cframe, int index, void *buffer,
|
||||||
int size);
|
int size);
|
||||||
|
|
|
@ -122,14 +122,14 @@ cifframe_guess_struct_size(ffi_type *stype)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *
|
NSMutableData *
|
||||||
cifframe_from_signature (NSMethodSignature *info)
|
cifframe_from_signature (NSMethodSignature *info)
|
||||||
{
|
{
|
||||||
unsigned size = sizeof(cifframe_t);
|
unsigned size = sizeof(cifframe_t);
|
||||||
unsigned align = __alignof(double);
|
unsigned align = __alignof(double);
|
||||||
unsigned type_offset = 0;
|
unsigned type_offset = 0;
|
||||||
unsigned offset = 0;
|
unsigned offset = 0;
|
||||||
void *result;
|
NSMutableData *result;
|
||||||
void *buf;
|
void *buf;
|
||||||
int i;
|
int i;
|
||||||
int numargs = [info numberOfArguments];
|
int numargs = [info numberOfArguments];
|
||||||
|
@ -180,13 +180,9 @@ cifframe_from_signature (NSMethodSignature *info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GS_WITH_GC
|
result = [NSMutableData dataWithCapacity: size];
|
||||||
cframe = buf = result = NSAllocateCollectable(size, NSScannedOption);
|
[result setLength: size];
|
||||||
#else
|
cframe = buf = [result mutableBytes];
|
||||||
result = (void*)[NSMutableData dataWithCapacity: size];
|
|
||||||
[(NSMutableData*)result setLength: size];
|
|
||||||
cframe = buf = [(NSMutableData*)result mutableBytes];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (cframe)
|
if (cframe)
|
||||||
{
|
{
|
||||||
|
@ -199,7 +195,8 @@ cifframe_from_signature (NSMethodSignature *info)
|
||||||
if (ffi_prep_cif (&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs,
|
if (ffi_prep_cif (&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs,
|
||||||
rtype, cframe->arg_types) != FFI_OK)
|
rtype, cframe->arg_types) != FFI_OK)
|
||||||
{
|
{
|
||||||
cframe = result = NULL;
|
cframe = NULL;
|
||||||
|
result = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cframe)
|
if (cframe)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue