diff --git a/ChangeLog b/ChangeLog index 060c4b175..df2e63831 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-06-08 Richard Frith-Macdonald + + * Source/GSFFIInvocation.m: + * Source/cifframe.h: + * Source/cifframe.m: + Removed distinction between GC and non-GC code. + 2010-06-07 Richard Frith-Macdonald * Source/GSInvocation.h: diff --git a/Source/GSFFIInvocation.m b/Source/GSFFIInvocation.m index 6f8a1ce1c..b300c526a 100644 --- a/Source/GSFFIInvocation.m +++ b/Source/GSFFIInvocation.m @@ -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) { - void *frame; + NSMutableData *frame; cifframe_t *cframe; ffi_closure *cclosure; 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 worry about ownership */ frame = cifframe_from_signature(sig); -#if GS_WITH_GC - cframe = frame; -#else - cframe = [(NSMutableData*)frame mutableBytes]; -#endif + cframe = [frame mutableBytes]; /* Autorelease the closure through GSAutoreleasedBuffer */ memory = [GSCodeBuffer memoryWithSize: sizeof(ffi_closure)]; @@ -333,14 +329,9 @@ static id gs_objc_proxy_lookup(id receiver, SEL op) _sig = RETAIN(aSignature); _numArgs = [aSignature numberOfArguments]; _info = [aSignature methodInfo]; -#if GS_WITH_GC - _frame = nil; - _cframe = cifframe_from_signature(_sig); -#else - _frame = (NSMutableData*)cifframe_from_signature(_sig); + _frame = cifframe_from_signature(_sig); [_frame retain]; _cframe = [_frame mutableBytes]; -#endif /* Make sure we have somewhere to store the return value if needed. */ diff --git a/Source/cifframe.h b/Source/cifframe.h index 361ecbc49..edc88ed38 100644 --- a/Source/cifframe.h +++ b/Source/cifframe.h @@ -50,7 +50,9 @@ typedef struct _cifframe_t { void **values; } 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, int size); diff --git a/Source/cifframe.m b/Source/cifframe.m index 7b5ec147d..8b380cf31 100644 --- a/Source/cifframe.m +++ b/Source/cifframe.m @@ -122,14 +122,14 @@ cifframe_guess_struct_size(ffi_type *stype) } -void * +NSMutableData * cifframe_from_signature (NSMethodSignature *info) { unsigned size = sizeof(cifframe_t); unsigned align = __alignof(double); unsigned type_offset = 0; unsigned offset = 0; - void *result; + NSMutableData *result; void *buf; int i; int numargs = [info numberOfArguments]; @@ -180,13 +180,9 @@ cifframe_from_signature (NSMethodSignature *info) } } -#if GS_WITH_GC - cframe = buf = result = NSAllocateCollectable(size, NSScannedOption); -#else - result = (void*)[NSMutableData dataWithCapacity: size]; - [(NSMutableData*)result setLength: size]; - cframe = buf = [(NSMutableData*)result mutableBytes]; -#endif + result = [NSMutableData dataWithCapacity: size]; + [result setLength: size]; + cframe = buf = [result mutableBytes]; if (cframe) { @@ -199,7 +195,8 @@ cifframe_from_signature (NSMethodSignature *info) if (ffi_prep_cif (&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs, rtype, cframe->arg_types) != FFI_OK) { - cframe = result = NULL; + cframe = NULL; + result = NULL; } if (cframe)