mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
lrge changes to remove mframe
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28778 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0d0c1d346c
commit
16ce1cd7b3
43 changed files with 555 additions and 4725 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2009-10-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* configure.ac: enable ffcall if ffi is disabled
|
||||
* configure: Regenerate
|
||||
* Source/mframe:delete
|
||||
* Source/mframe.m: delete
|
||||
* Source/GSInvocation.h:
|
||||
* Source/GNUmakefile:
|
||||
* Source/NSMethodSignature.m:
|
||||
* Source/GSFFCallInvocation.m:
|
||||
* Source/NSKeyValueObserving.m:
|
||||
* Source/GSFFIInvocation.m:
|
||||
* Source/NSInvocation.m:
|
||||
* Source/cifframe.m:
|
||||
* Source/NSConnection.m:
|
||||
* Source/callframe.m:
|
||||
* Source/NSDistantObject.m:
|
||||
* Headers/Foundation/NSMethodSignature.h:
|
||||
* Headers/Foundation/NSInvocation.h:
|
||||
Update for removal of mframe code.
|
||||
|
||||
2009-10-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GNUmakefile:
|
||||
|
|
|
@ -41,11 +41,7 @@ extern "C" {
|
|||
id _target;
|
||||
SEL _selector;
|
||||
unsigned int _numArgs;
|
||||
#if OS_API_VERSION(GS_API_OPENSTEP, GS_API_MACOSX)
|
||||
NSArgumentInfo *_info;
|
||||
#else
|
||||
void *_dummy;
|
||||
#endif
|
||||
void *_info;
|
||||
BOOL _argsRetained;
|
||||
BOOL _targetRetained;
|
||||
BOOL _validReturn;
|
||||
|
|
|
@ -34,44 +34,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(GS_API_NONE, GS_API_MACOSX)
|
||||
/**
|
||||
* <p>Info about layout of arguments.
|
||||
* Extended from the original OpenStep version to let us know if the
|
||||
* arg is passed in registers or on the stack.</p>
|
||||
*
|
||||
* <p>NB. This no longer exists in Rhapsody/MacOS.</p>
|
||||
<example>
|
||||
typedef struct {
|
||||
int offset;
|
||||
unsigned size;
|
||||
const char *type;
|
||||
unsigned align; // extension, available only in GNUSTEP
|
||||
unsigned qual; // extension, available only in GNUSTEP
|
||||
BOOL isReg; // extension, available only in GNUSTEP
|
||||
} NSArgumentInfo;
|
||||
</example>
|
||||
* <p>NB. The offset and register information may not always be reliable.
|
||||
* In the past it was dependent on locally maintained platform dependent
|
||||
* information. In the future it may depend on layout information
|
||||
* supplied by the compiler.</p>
|
||||
*/
|
||||
typedef struct {
|
||||
int offset;
|
||||
unsigned size;
|
||||
const char *type;
|
||||
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
|
||||
unsigned align;
|
||||
unsigned qual;
|
||||
BOOL isReg;
|
||||
#else
|
||||
unsigned _reserved1;
|
||||
unsigned _reserved2;
|
||||
BOOL _reserved3;
|
||||
#endif
|
||||
} NSArgumentInfo;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* <p>Class encapsulating type information for method arguments and return
|
||||
* value. It is used as a component of [NSInvocation] to implement message
|
||||
|
@ -80,7 +42,7 @@ typedef struct {
|
|||
* [NSObject-methodSignatureForSelector:].</p>
|
||||
*
|
||||
* <p>Basically, types are represented as Objective-C <code>@encode(...)</code>
|
||||
* compatible strings, together with size information. The arguments are
|
||||
* compatible strings. The arguments are
|
||||
* numbered starting from 0, including the implicit arguments
|
||||
* <code><em>self</em></code> (type <code>id</code>, at position 0) and
|
||||
* <code><em>_cmd</em></code> (type <code>SEL</code>, at position 1).</p>
|
||||
|
@ -90,11 +52,7 @@ typedef struct {
|
|||
const char *_methodTypes;
|
||||
NSUInteger _argFrameLength;
|
||||
NSUInteger _numArgs;
|
||||
#if OS_API_VERSION(GS_API_NONE, GS_API_MACOSX)
|
||||
NSArgumentInfo *_info;
|
||||
#else
|
||||
void *_info;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,14 +61,6 @@ typedef struct {
|
|||
*/
|
||||
+ (NSMethodSignature*) signatureWithObjCTypes: (const char*)t;
|
||||
|
||||
#if OS_API_VERSION(GS_API_OPENSTEP, GS_API_MACOSX)
|
||||
/**
|
||||
* Returns full information on given argument. Indices start at 0. Provide
|
||||
* -1 to get info on return value.
|
||||
*/
|
||||
- (NSArgumentInfo) argumentInfoAtIndex: (NSUInteger)index;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Number of bytes that the full set of arguments occupies on the stack, which
|
||||
* is platform(hardware)-dependent.
|
||||
|
@ -121,7 +71,8 @@ typedef struct {
|
|||
* Returns Objective-C <code>@encode(...)</code> compatible string. Arguments
|
||||
* are numbered starting from 0, including the implicit arguments
|
||||
* <code><em>self</em></code> (type <code>id</code>, at position 0) and
|
||||
* <code><em>_cmd</em></code> (type <code>SEL</code>, at position 1).
|
||||
* <code><em>_cmd</em></code> (type <code>SEL</code>, at position 1).<br />
|
||||
* Type strings may include leading type qualifiers.
|
||||
*/
|
||||
- (const char*) getArgumentTypeAtIndex: (NSUInteger)index;
|
||||
|
||||
|
@ -138,10 +89,9 @@ typedef struct {
|
|||
- (NSUInteger) methodReturnLength;
|
||||
|
||||
/**
|
||||
* Returns Objective-C <code>@encode(...)</code> compatible string. Arguments
|
||||
* are numbered starting from 0, including the implicit arguments
|
||||
* <code><em>self</em></code> (type <code>id</code>, at position 0) and
|
||||
* <code><em>_cmd</em></code> (type <code>SEL</code>, at position 1).
|
||||
* Returns an Objective-C <code>@encode(...)</code> compatible string
|
||||
* describing the return type of the method. This may include type
|
||||
* qualifiers.
|
||||
*/
|
||||
- (const char*) methodReturnType;
|
||||
|
||||
|
@ -153,26 +103,6 @@ typedef struct {
|
|||
|
||||
@end
|
||||
|
||||
#if GS_API_VERSION(GS_API_NONE, 011700)
|
||||
/**
|
||||
* Declares a convenience method for getting the entire array of raw type and
|
||||
* size information.
|
||||
*/
|
||||
@interface NSMethodSignature(GNUstep)
|
||||
/**
|
||||
* Convenience method for getting the entire array of raw type and size
|
||||
* information.
|
||||
*/
|
||||
- (NSArgumentInfo*) methodInfo;
|
||||
|
||||
/**
|
||||
* Returns a string containing all Objective-C
|
||||
* <code>@encode(...)</code> compatible type information.
|
||||
*/
|
||||
- (const char*) methodType;
|
||||
@end
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -96,8 +96,7 @@ endif
|
|||
|
||||
GNU_MFILES = \
|
||||
GSLocale.m \
|
||||
preface.m \
|
||||
mframe.m
|
||||
preface.m
|
||||
|
||||
ifeq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
|
||||
OBJC_LIBS += -lpthread
|
||||
|
@ -427,7 +426,6 @@ HEADERS_INSTALL = $(GNU_HEADERS) \
|
|||
GENERATED_HFILES = \
|
||||
dynamic-load.h \
|
||||
$(HEADER_DIR_BASE)/preface.h \
|
||||
$(GNUSTEP_TARGET_DIR)/mframe.h \
|
||||
$(GNUSTEP_TARGET_DIR)/config.h \
|
||||
$(GNUSTEP_TARGET_DIR)/GNUstepBase/GSConfig.h
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#import <callback.h>
|
||||
#import "callframe.h"
|
||||
|
||||
#import "GSInvocation.h"
|
||||
|
||||
#ifndef INLINE
|
||||
#define INLINE inline
|
||||
#endif
|
||||
|
@ -545,7 +547,7 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
}
|
||||
_sig = RETAIN(aSignature);
|
||||
_numArgs = [aSignature numberOfArguments];
|
||||
_info = [aSignature methodInfo];
|
||||
_info = (void*)[aSignature methodInfo];
|
||||
_cframe = callframe_from_signature(_sig, &_retval);
|
||||
return self;
|
||||
}
|
||||
|
@ -560,6 +562,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
unsigned int i;
|
||||
av_alist alist;
|
||||
NSInvocation_t *inv = (NSInvocation_t*)_inv;
|
||||
NSArgumentInfo *info = (NSArgumentInfo*)inv->_info;
|
||||
void *retval = inv->_retval;
|
||||
|
||||
/* Do an av call starting with the return type */
|
||||
|
@ -569,7 +572,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
_F(alist, imp, retval); \
|
||||
break;
|
||||
|
||||
switch (*inv->_info[0].type)
|
||||
switch (*info[0].type)
|
||||
{
|
||||
case _C_ID:
|
||||
av_start_ptr(alist, imp, id, retval);
|
||||
|
@ -604,12 +607,13 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
{
|
||||
int split = 0;
|
||||
|
||||
if (inv->_info[0].size > sizeof(long)
|
||||
&& inv->_info[0].size <= 2*sizeof(long))
|
||||
if (info[0].size > sizeof(long)
|
||||
&& info[0].size <= 2*sizeof(long))
|
||||
{
|
||||
split = gs_splittable(inv->_info[0].type);
|
||||
split = gs_splittable(info[0].type);
|
||||
}
|
||||
_av_start_struct(alist, imp, inv->_info[0].size, split, retval);
|
||||
_av_start_struct(alist, imp,
|
||||
info[0].size, split, retval);
|
||||
break;
|
||||
}
|
||||
case _C_VOID:
|
||||
|
@ -617,7 +621,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
break;
|
||||
default:
|
||||
NSCAssert1(0, @"GSFFCallInvocation: Return Type '%s' not implemented",
|
||||
inv->_info[0].type);
|
||||
info[0].type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -628,8 +632,8 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
/* Set the rest of the arguments */
|
||||
for (i = 2; i < inv->_numArgs; i++)
|
||||
{
|
||||
const char *type = inv->_info[i+1].type;
|
||||
unsigned size = inv->_info[i+1].size;
|
||||
const char *type = info[i+1].type;
|
||||
unsigned size = info[i+1].size;
|
||||
void *datum;
|
||||
|
||||
datum = callframe_arg_addr((callframe_t *)inv->_cframe, i);
|
||||
|
@ -696,7 +700,8 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
CASE_TYPE(_C_DBL, double, av_double)
|
||||
|
||||
case _C_STRUCT_B:
|
||||
_av_struct(alist, size, inv->_info[i+1].align, datum);
|
||||
_av_struct(alist, size,
|
||||
info[i+1].align, datum);
|
||||
break;
|
||||
default:
|
||||
NSCAssert1(0, @"GSFFCallInvocation: Type '%s' not implemented",
|
||||
|
@ -722,8 +727,8 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
*/
|
||||
if (anObject == nil)
|
||||
{
|
||||
memset(_retval, '\0', _info[0].size); /* Clear return value */
|
||||
if (*_info[0].type != _C_VOID)
|
||||
memset(_retval, '\0', _inf[0].size); /* Clear return value */
|
||||
if (*_inf[0].type != _C_VOID)
|
||||
{
|
||||
_validReturn = YES;
|
||||
}
|
||||
|
@ -740,8 +745,8 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
old_target = RETAIN(_target);
|
||||
[self setTarget: anObject];
|
||||
|
||||
callframe_set_arg((callframe_t *)_cframe, 0, &_target, _info[1].size);
|
||||
callframe_set_arg((callframe_t *)_cframe, 1, &_selector, _info[2].size);
|
||||
callframe_set_arg((callframe_t *)_cframe, 0, &_target, _inf[1].size);
|
||||
callframe_set_arg((callframe_t *)_cframe, 1, &_selector, _inf[2].size);
|
||||
|
||||
if (_sendToSuper == YES)
|
||||
{
|
||||
|
@ -1123,8 +1128,8 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
|
||||
for (i = 0; i < _numArgs; i++)
|
||||
{
|
||||
int flags = _info[i+1].qual;
|
||||
const char *type = _info[i+1].type;
|
||||
int flags = _inf[i+1].qual;
|
||||
const char *type = _inf[i+1].type;
|
||||
void *datum;
|
||||
|
||||
if (i == 0)
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#endif
|
||||
#import <pthread.h>
|
||||
#import "cifframe.h"
|
||||
#import "mframe.h"
|
||||
#import "GSPrivate.h"
|
||||
|
||||
#ifndef INLINE
|
||||
|
@ -304,6 +303,8 @@ static id gs_objc_proxy_lookup(id receiver, SEL op)
|
|||
*/
|
||||
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature
|
||||
{
|
||||
int i;
|
||||
|
||||
if (aSignature == nil)
|
||||
{
|
||||
RELEASE(self);
|
||||
|
@ -317,15 +318,16 @@ static id gs_objc_proxy_lookup(id receiver, SEL op)
|
|||
/* Make sure we have somewhere to store the return value if needed.
|
||||
*/
|
||||
_retval = _retptr = 0;
|
||||
if (_info[0].size > 0)
|
||||
i = objc_sizeof_type (objc_skip_type_qualifiers ([_sig methodReturnType]));
|
||||
if (i > 0)
|
||||
{
|
||||
if (_info[0].size <= sizeof(_retbuf))
|
||||
if (i <= sizeof(_retbuf))
|
||||
{
|
||||
_retval = _retbuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
_retptr = NSAllocateCollectable(_info[0].size, NSScannedOption);
|
||||
_retptr = NSAllocateCollectable(i, NSScannedOption);
|
||||
_retval = _retptr;
|
||||
}
|
||||
}
|
||||
|
@ -361,15 +363,16 @@ static id gs_objc_proxy_lookup(id receiver, SEL op)
|
|||
/* Make sure we have somewhere to store the return value if needed.
|
||||
*/
|
||||
_retval = _retptr = 0;
|
||||
if (_info[0].size > 0)
|
||||
i = objc_sizeof_type (objc_skip_type_qualifiers ([_sig methodReturnType]));
|
||||
if (i > 0)
|
||||
{
|
||||
if (_info[0].size <= sizeof(_retbuf))
|
||||
if (i <= sizeof(_retbuf))
|
||||
{
|
||||
_retval = _retbuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
_retptr = NSAllocateCollectable(_info[0].size, NSScannedOption);
|
||||
_retptr = NSAllocateCollectable(i, NSScannedOption);
|
||||
_retval = _retptr;
|
||||
}
|
||||
}
|
||||
|
@ -395,18 +398,22 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
- (void) invokeWithTarget: (id)anObject
|
||||
{
|
||||
id old_target;
|
||||
const char *type;
|
||||
IMP imp;
|
||||
|
||||
CLEAR_RETURN_VALUE_IF_OBJECT;
|
||||
_validReturn = NO;
|
||||
|
||||
type = objc_skip_type_qualifiers([_sig methodReturnType]);
|
||||
|
||||
/*
|
||||
* A message to a nil object returns nil.
|
||||
*/
|
||||
if (anObject == nil)
|
||||
{
|
||||
if (_retval)
|
||||
memset(_retval, '\0', _info[0].size); /* Clear return value */
|
||||
{
|
||||
memset(_retval, '\0', objc_sizeof_type (type));
|
||||
}
|
||||
_validReturn = YES;
|
||||
return;
|
||||
}
|
||||
|
@ -420,8 +427,8 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
old_target = RETAIN(_target);
|
||||
[self setTarget: anObject];
|
||||
|
||||
cifframe_set_arg((cifframe_t *)_cframe, 0, &_target, _info[1].size);
|
||||
cifframe_set_arg((cifframe_t *)_cframe, 1, &_selector, _info[2].size);
|
||||
cifframe_set_arg((cifframe_t *)_cframe, 0, &_target, sizeof(id));
|
||||
cifframe_set_arg((cifframe_t *)_cframe, 1, &_selector, sizeof(SEL));
|
||||
|
||||
if (_sendToSuper == YES)
|
||||
{
|
||||
|
@ -459,8 +466,10 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
GSFFIInvokeWithTargetAndImp(self, anObject, imp);
|
||||
|
||||
/* Decode the return value */
|
||||
if (*_info[0].type != _C_VOID)
|
||||
cifframe_decode_arg(_info[0].type, _retval);
|
||||
if (*type != _C_VOID)
|
||||
{
|
||||
cifframe_decode_arg(type, _retval);
|
||||
}
|
||||
|
||||
RETAIN_RETURN_VALUE;
|
||||
_validReturn = YES;
|
||||
|
@ -649,8 +658,8 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
|
||||
for (i = 0; i < _numArgs; i++)
|
||||
{
|
||||
int flags = _info[i+1].qual;
|
||||
const char *type = _info[i+1].type;
|
||||
int flags = _inf[i+1].qual;
|
||||
const char *type = _inf[i+1].type;
|
||||
void *datum;
|
||||
|
||||
if (i == 0)
|
||||
|
|
|
@ -27,6 +27,16 @@
|
|||
|
||||
#include <Foundation/NSInvocation.h>
|
||||
|
||||
typedef struct {
|
||||
int offset;
|
||||
unsigned size;
|
||||
const char *type;
|
||||
const char *qtype;
|
||||
unsigned align;
|
||||
unsigned qual;
|
||||
BOOL isReg;
|
||||
} NSArgumentInfo;
|
||||
|
||||
@interface GSFFIInvocation : NSInvocation
|
||||
{
|
||||
uint8_t _retbuf[32]; // Store return values of up to 32 bytes here.
|
||||
|
@ -47,13 +57,18 @@
|
|||
- (BOOL) encodeWithDistantCoder: (NSCoder*)coder passPointers: (BOOL)passp;
|
||||
@end
|
||||
|
||||
@interface NSMethodSignature (GNUstep)
|
||||
- (const char*) methodType;
|
||||
- (NSArgumentInfo*) methodInfo;
|
||||
@end
|
||||
|
||||
extern void
|
||||
GSFFCallInvokeWithTargetAndImp(NSInvocation *inv, id anObject, IMP imp);
|
||||
|
||||
extern void
|
||||
GSFFIInvokeWithTargetAndImp(NSInvocation *inv, id anObject, IMP imp);
|
||||
|
||||
#define CLEAR_RETURN_VALUE_IF_OBJECT do { if (_validReturn && *_info[0].type == _C_ID) \
|
||||
#define CLEAR_RETURN_VALUE_IF_OBJECT do { if (_validReturn && *_inf[0].type == _C_ID) \
|
||||
{ \
|
||||
RELEASE (*(id*) _retval); \
|
||||
*(id*) _retval = nil; \
|
||||
|
@ -61,6 +76,8 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *inv, id anObject, IMP imp);
|
|||
}\
|
||||
} while (0)
|
||||
|
||||
#define RETAIN_RETURN_VALUE IF_NO_GC(do { if (*_info[0].type == _C_ID) RETAIN (*(id*) _retval);} while (0))
|
||||
#define RETAIN_RETURN_VALUE IF_NO_GC(do { if (*_inf[0].type == _C_ID) RETAIN (*(id*) _retval);} while (0))
|
||||
|
||||
#define _inf ((NSArgumentInfo*)_info)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
*/
|
||||
|
||||
#import "config.h"
|
||||
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
@ -66,12 +67,6 @@ static GC_descr nodeDesc; // Type descriptor for map node.
|
|||
#include "Foundation/NSConnection.h"
|
||||
#undef _IN_CONNECTION_M
|
||||
|
||||
#if defined(USE_LIBFFI)
|
||||
#include "cifframe.h"
|
||||
#elif defined(USE_FFCALL)
|
||||
#include "callframe.h"
|
||||
#endif
|
||||
|
||||
#include "Foundation/NSPortCoder.h"
|
||||
#include "GNUstepBase/DistributedObjects.h"
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "Foundation/NSObjCRuntime.h"
|
||||
#include "Foundation/NSInvocation.h"
|
||||
#include <objc/Protocol.h>
|
||||
#include "GSInvocation.h"
|
||||
|
||||
|
||||
@interface NSDistantObject(GNUstepExtensions)
|
||||
|
@ -696,11 +697,6 @@ enum proxyLocation
|
|||
}
|
||||
return sig;
|
||||
}
|
||||
/*
|
||||
* Simlarly, when we fetch a method signature from the remote end,
|
||||
* we get a proxy, and when we build a local signature we need to
|
||||
* ask the proxy for its types ... and must avoid recursion again.
|
||||
*/
|
||||
if (sel_eq(aSelector, @selector(methodType)))
|
||||
{
|
||||
static NSMethodSignature *sig = nil;
|
||||
|
@ -757,31 +753,18 @@ enum proxyLocation
|
|||
|
||||
{
|
||||
id m = nil;
|
||||
#if defined(USE_FFCALL) || defined(USE_LIBFFI)
|
||||
id inv;
|
||||
id sig;
|
||||
|
||||
DO_FORWARD_INVOCATION(methodSignatureForSelector:, aSelector);
|
||||
#else
|
||||
arglist_t args;
|
||||
void *retframe;
|
||||
|
||||
id retframe_id (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
|
||||
/*
|
||||
* No protocol - so try forwarding the message.
|
||||
*/
|
||||
args = __builtin_apply_args();
|
||||
retframe = [self forward: _cmd : args];
|
||||
m = retframe_id(retframe);
|
||||
#endif
|
||||
if ([m isProxy] == YES)
|
||||
{
|
||||
const char *types = [m methodType];
|
||||
const char *types;
|
||||
|
||||
types = [m methodType];
|
||||
/* Create a local method signature.
|
||||
*/
|
||||
m = [NSMethodSignature signatureWithObjCTypes: types];
|
||||
}
|
||||
return m;
|
||||
|
@ -953,27 +936,13 @@ static inline BOOL class_is_kind_of (Class self, Class aClassObject)
|
|||
|
||||
- (BOOL) respondsToSelector: (SEL)aSelector
|
||||
{
|
||||
#if defined(USE_FFCALL) || defined(USE_LIBFFI)
|
||||
BOOL m = NO;
|
||||
id inv, sig;
|
||||
BOOL m = NO;
|
||||
id inv;
|
||||
id sig;
|
||||
|
||||
DO_FORWARD_INVOCATION(respondsToSelector:, aSelector);
|
||||
|
||||
return m;
|
||||
#else
|
||||
arglist_t args;
|
||||
void *retframe;
|
||||
|
||||
BOOL retframe_bool (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try forwarding the message.
|
||||
*/
|
||||
args = __builtin_apply_args();
|
||||
retframe = [self forward: _cmd : args];
|
||||
return retframe_bool(retframe);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (id) replacementObjectForCoder: (NSCoder*)aCoder
|
||||
|
|
|
@ -157,6 +157,8 @@ static Class NSInvocation_concrete_class;
|
|||
|
||||
|
||||
|
||||
#define _inf ((NSArgumentInfo*)_info)
|
||||
|
||||
/**
|
||||
* <p>The <code>NSInvocation</code> class implements a mechanism of constructing
|
||||
* messages (as <code>NSInvocation</code> instances), sending these to other
|
||||
|
@ -189,14 +191,14 @@ static inline void
|
|||
_get_arg(NSInvocation *inv, int index, void *buffer)
|
||||
{
|
||||
cifframe_get_arg((cifframe_t *)inv->_cframe, index, buffer,
|
||||
inv->_info[index+1].size);
|
||||
((NSArgumentInfo*)inv->_info)[index+1].size);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_set_arg(NSInvocation *inv, int index, void *buffer)
|
||||
{
|
||||
cifframe_set_arg((cifframe_t *)inv->_cframe, index, buffer,
|
||||
inv->_info[index+1].size);
|
||||
((NSArgumentInfo*)inv->_info)[index+1].size);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
|
@ -210,14 +212,14 @@ static inline void
|
|||
_get_arg(NSInvocation *inv, int index, void *buffer)
|
||||
{
|
||||
callframe_get_arg((callframe_t *)inv->_cframe, index, buffer,
|
||||
inv->_info[index+1].size);
|
||||
((NSArgumentInfo*)inv->_info)[index+1].size);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_set_arg(NSInvocation *inv, int index, void *buffer)
|
||||
{
|
||||
callframe_set_arg((callframe_t *)inv->_cframe, index, buffer,
|
||||
inv->_info[index+1].size);
|
||||
((NSArgumentInfo*)inv->_info)[index+1].size);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
|
@ -302,7 +304,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
|
||||
for (i = 3; i <= _numArgs; i++)
|
||||
{
|
||||
if (*_info[i].type == _C_CHARPTR)
|
||||
if (*_inf[i].type == _C_CHARPTR)
|
||||
{
|
||||
char *str = 0;
|
||||
|
||||
|
@ -312,7 +314,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
NSZoneFree(NSDefaultMallocZone(), str);
|
||||
}
|
||||
}
|
||||
else if (*_info[i].type == _C_ID)
|
||||
else if (*_inf[i].type == _C_ID)
|
||||
{
|
||||
id obj = nil;
|
||||
|
||||
|
@ -390,9 +392,9 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
|
||||
type = [_sig methodReturnType];
|
||||
|
||||
if (*_info[0].type != _C_VOID)
|
||||
if (*_inf[0].type != _C_VOID)
|
||||
{
|
||||
memcpy(buffer, _retval, _info[0].size);
|
||||
memcpy(buffer, _retval, _inf[0].size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,8 +435,8 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
}
|
||||
else
|
||||
{
|
||||
int i = index+1; /* Allow for return type in '_info' */
|
||||
const char *type = _info[i].type;
|
||||
int i = index+1; /* Allow for return type in '_inf' */
|
||||
const char *type = _inf[i].type;
|
||||
|
||||
if (_argsRetained && (*type == _C_ID || *type == _C_CHARPTR))
|
||||
{
|
||||
|
@ -488,13 +490,13 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
{
|
||||
const char *type;
|
||||
|
||||
type = _info[0].type;
|
||||
type = _inf[0].type;
|
||||
|
||||
CLEAR_RETURN_VALUE_IF_OBJECT;
|
||||
|
||||
if (*type != _C_VOID)
|
||||
{
|
||||
memcpy(_retval, buffer, _info[0].size);
|
||||
memcpy(_retval, buffer, _inf[0].size);
|
||||
}
|
||||
|
||||
RETAIN_RETURN_VALUE;
|
||||
|
@ -578,7 +580,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
}
|
||||
for (i = 3; i <= _numArgs; i++)
|
||||
{
|
||||
if (*_info[i].type == _C_ID)
|
||||
if (*_inf[i].type == _C_ID)
|
||||
{
|
||||
id old;
|
||||
|
||||
|
@ -588,7 +590,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
IF_NO_GC(RETAIN(old));
|
||||
}
|
||||
}
|
||||
else if (*_info[i].type == _C_CHARPTR)
|
||||
else if (*_inf[i].type == _C_CHARPTR)
|
||||
{
|
||||
char *str;
|
||||
|
||||
|
@ -665,12 +667,12 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
|
||||
[aCoder encodeObject: _target];
|
||||
|
||||
[aCoder encodeValueOfObjCType: _info[2].type
|
||||
[aCoder encodeValueOfObjCType: _inf[2].type
|
||||
at: &_selector];
|
||||
|
||||
for (i = 3; i <= _numArgs; i++)
|
||||
{
|
||||
const char *type = _info[i].type;
|
||||
const char *type = _inf[i].type;
|
||||
void *datum;
|
||||
|
||||
datum = _arg_addr(self, i-1);
|
||||
|
@ -684,12 +686,12 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
[aCoder encodeValueOfObjCType: type at: datum];
|
||||
}
|
||||
}
|
||||
if (*_info[0].type != _C_VOID)
|
||||
if (*_inf[0].type != _C_VOID)
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_validReturn];
|
||||
if (_validReturn)
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: _info[0].type at: _retval];
|
||||
[aCoder encodeValueOfObjCType: _inf[0].type at: _retval];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -715,15 +717,15 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
for (i = 3; i <= _numArgs; i++)
|
||||
{
|
||||
datum = _arg_addr(self, i-1);
|
||||
[aCoder decodeValueOfObjCType: _info[i].type at: datum];
|
||||
[aCoder decodeValueOfObjCType: _inf[i].type at: datum];
|
||||
}
|
||||
_argsRetained = YES;
|
||||
if (*_info[0].type != _C_VOID)
|
||||
if (*_inf[0].type != _C_VOID)
|
||||
{
|
||||
[aCoder decodeValueOfObjCType: @encode(BOOL) at: &_validReturn];
|
||||
if (_validReturn)
|
||||
{
|
||||
[aCoder decodeValueOfObjCType: _info[0].type at: _retval];
|
||||
[aCoder decodeValueOfObjCType: _inf[0].type at: _retval];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#import "GNUstepBase/GSObjCRuntime.h"
|
||||
#import "GNUstepBase/Unicode.h"
|
||||
#import "GNUstepBase/GSLock.h"
|
||||
#import "GSInvocation.h"
|
||||
|
||||
/*
|
||||
* IMPLEMENTATION NOTES
|
||||
|
|
|
@ -29,28 +29,408 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
#include <mframe.h>
|
||||
|
||||
#include "Foundation/NSMethodSignature.h"
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSString.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
|
||||
#include "GSInvocation.h"
|
||||
|
||||
/* The objc runtime library objc_skip_offset() is buggy on some compiler
|
||||
* versions, so we use our own alternative implementation.
|
||||
*/
|
||||
static const char *
|
||||
skip_offset(const char *ptr)
|
||||
{
|
||||
if (*ptr == '+' || *ptr == '-') ptr++;
|
||||
while (isdigit(*ptr)) ptr++;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#define ROUND(V, A) \
|
||||
({ typeof(V) __v=(V); typeof(A) __a=(A); \
|
||||
__a*((__v+__a-1)/__a); })
|
||||
|
||||
/* Step through method encoding information extracting details.
|
||||
* If outTypes is non-nul then we copy the qualified type into
|
||||
* the buffer as a nul terminated string and use the values in
|
||||
* this buffer for the qtype and type in info, rather than pointers
|
||||
* to positions in typePtr
|
||||
*/
|
||||
static const char *
|
||||
next_arg(const char *typePtr, NSArgumentInfo *info, char *outTypes)
|
||||
{
|
||||
NSArgumentInfo local;
|
||||
BOOL flag;
|
||||
BOOL negative = NO;
|
||||
|
||||
if (info == 0)
|
||||
{
|
||||
info = &local;
|
||||
}
|
||||
|
||||
info->qtype = typePtr;
|
||||
|
||||
/*
|
||||
* Skip past any type qualifiers - if the caller wants them, return them.
|
||||
*/
|
||||
flag = YES;
|
||||
info->qual = 0;
|
||||
while (flag)
|
||||
{
|
||||
switch (*typePtr)
|
||||
{
|
||||
case _C_CONST: info->qual |= _F_CONST; break;
|
||||
case _C_IN: info->qual |= _F_IN; break;
|
||||
case _C_INOUT: info->qual |= _F_INOUT; break;
|
||||
case _C_OUT: info->qual |= _F_OUT; break;
|
||||
case _C_BYCOPY: info->qual |= _F_BYCOPY; break;
|
||||
#ifdef _C_BYREF
|
||||
case _C_BYREF: info->qual |= _F_BYREF; break;
|
||||
#endif
|
||||
case _C_ONEWAY: info->qual |= _F_ONEWAY; break;
|
||||
#ifdef _C_GCINVISIBLE
|
||||
case _C_GCINVISIBLE: info->qual |= _F_GCINVISIBLE; break;
|
||||
#endif
|
||||
default: flag = NO;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
typePtr++;
|
||||
}
|
||||
}
|
||||
|
||||
info->type = typePtr;
|
||||
|
||||
/*
|
||||
* Scan for size and alignment information.
|
||||
*/
|
||||
switch (*typePtr++)
|
||||
{
|
||||
case _C_ID:
|
||||
info->size = sizeof(id);
|
||||
info->align = __alignof__(id);
|
||||
break;
|
||||
|
||||
case _C_CLASS:
|
||||
info->size = sizeof(Class);
|
||||
info->align = __alignof__(Class);
|
||||
break;
|
||||
|
||||
case _C_SEL:
|
||||
info->size = sizeof(SEL);
|
||||
info->align = __alignof__(SEL);
|
||||
break;
|
||||
|
||||
case _C_CHR:
|
||||
info->size = sizeof(char);
|
||||
info->align = __alignof__(char);
|
||||
break;
|
||||
|
||||
case _C_UCHR:
|
||||
info->size = sizeof(unsigned char);
|
||||
info->align = __alignof__(unsigned char);
|
||||
break;
|
||||
|
||||
case _C_SHT:
|
||||
info->size = sizeof(short);
|
||||
info->align = __alignof__(short);
|
||||
break;
|
||||
|
||||
case _C_USHT:
|
||||
info->size = sizeof(unsigned short);
|
||||
info->align = __alignof__(unsigned short);
|
||||
break;
|
||||
|
||||
case _C_INT:
|
||||
info->size = sizeof(int);
|
||||
info->align = __alignof__(int);
|
||||
break;
|
||||
|
||||
case _C_UINT:
|
||||
info->size = sizeof(unsigned int);
|
||||
info->align = __alignof__(unsigned int);
|
||||
break;
|
||||
|
||||
case _C_LNG:
|
||||
info->size = sizeof(long);
|
||||
info->align = __alignof__(long);
|
||||
break;
|
||||
|
||||
case _C_ULNG:
|
||||
info->size = sizeof(unsigned long);
|
||||
info->align = __alignof__(unsigned long);
|
||||
break;
|
||||
|
||||
case _C_LNG_LNG:
|
||||
info->size = sizeof(long long);
|
||||
info->align = __alignof__(long long);
|
||||
break;
|
||||
|
||||
case _C_ULNG_LNG:
|
||||
info->size = sizeof(unsigned long long);
|
||||
info->align = __alignof__(unsigned long long);
|
||||
break;
|
||||
|
||||
case _C_FLT:
|
||||
info->size = sizeof(float);
|
||||
info->align = __alignof__(float);
|
||||
break;
|
||||
|
||||
case _C_DBL:
|
||||
info->size = sizeof(double);
|
||||
info->align = __alignof__(double);
|
||||
break;
|
||||
|
||||
case _C_PTR:
|
||||
info->size = sizeof(char*);
|
||||
info->align = __alignof__(char*);
|
||||
if (*typePtr == '?')
|
||||
{
|
||||
typePtr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
typePtr = objc_skip_typespec(typePtr);
|
||||
}
|
||||
break;
|
||||
|
||||
case _C_ATOM:
|
||||
case _C_CHARPTR:
|
||||
info->size = sizeof(char*);
|
||||
info->align = __alignof__(char*);
|
||||
break;
|
||||
|
||||
case _C_ARY_B:
|
||||
{
|
||||
int length = atoi(typePtr);
|
||||
|
||||
while (isdigit(*typePtr))
|
||||
{
|
||||
typePtr++;
|
||||
}
|
||||
typePtr = next_arg(typePtr, &local, 0);
|
||||
info->size = length * ROUND(local.size, local.align);
|
||||
info->align = local.align;
|
||||
typePtr++; /* Skip end-of-array */
|
||||
}
|
||||
break;
|
||||
|
||||
case _C_STRUCT_B:
|
||||
{
|
||||
unsigned int acc_size = 0;
|
||||
unsigned int def_align = objc_alignof_type(typePtr-1);
|
||||
unsigned int acc_align = def_align;
|
||||
const char *ptr = typePtr;
|
||||
|
||||
/*
|
||||
* Skip "<name>=" stuff.
|
||||
*/
|
||||
while (*ptr != _C_STRUCT_E && *ptr != '=') ptr++;
|
||||
if (*ptr == '=') typePtr = ptr;
|
||||
typePtr++;
|
||||
|
||||
/*
|
||||
* Base structure alignment on first element.
|
||||
*/
|
||||
if (*typePtr != _C_STRUCT_E)
|
||||
{
|
||||
typePtr = next_arg(typePtr, &local, 0);
|
||||
if (typePtr == 0)
|
||||
{
|
||||
return 0; /* error */
|
||||
}
|
||||
acc_size = ROUND(acc_size, local.align);
|
||||
acc_size += local.size;
|
||||
acc_align = MAX(local.align, def_align);
|
||||
}
|
||||
/*
|
||||
* Continue accumulating structure size
|
||||
* and adjust alignment if necessary
|
||||
*/
|
||||
while (*typePtr != _C_STRUCT_E)
|
||||
{
|
||||
typePtr = next_arg(typePtr, &local, 0);
|
||||
if (typePtr == 0)
|
||||
{
|
||||
return 0; /* error */
|
||||
}
|
||||
acc_size = ROUND(acc_size, local.align);
|
||||
acc_size += local.size;
|
||||
acc_align = MAX(local.align, acc_align);
|
||||
}
|
||||
/*
|
||||
* Size must be a multiple of alignment
|
||||
*/
|
||||
if (acc_size % acc_align != 0)
|
||||
{
|
||||
acc_size += acc_align - acc_size % acc_align;
|
||||
}
|
||||
info->size = acc_size;
|
||||
info->align = acc_align;
|
||||
typePtr++; /* Skip end-of-struct */
|
||||
}
|
||||
break;
|
||||
|
||||
case _C_UNION_B:
|
||||
{
|
||||
unsigned int max_size = 0;
|
||||
unsigned int max_align = 0;
|
||||
|
||||
/*
|
||||
* Skip "<name>=" stuff.
|
||||
*/
|
||||
while (*typePtr != _C_UNION_E)
|
||||
{
|
||||
if (*typePtr++ == '=')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (*typePtr != _C_UNION_E)
|
||||
{
|
||||
typePtr = next_arg(typePtr, &local, 0);
|
||||
if (typePtr == 0)
|
||||
{
|
||||
return 0; /* error */
|
||||
}
|
||||
max_size = MAX(max_size, local.size);
|
||||
max_align = MAX(max_align, local.align);
|
||||
}
|
||||
info->size = max_size;
|
||||
info->align = max_align;
|
||||
typePtr++; /* Skip end-of-union */
|
||||
}
|
||||
break;
|
||||
|
||||
case _C_VOID:
|
||||
info->size = 0;
|
||||
info->align = __alignof__(char*);
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (typePtr == 0)
|
||||
{ /* Error condition. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Copy the type information into the buffer if provided.
|
||||
*/
|
||||
if (outTypes != 0)
|
||||
{
|
||||
unsigned len = typePtr - info->qtype;
|
||||
|
||||
strncpy(outTypes, info->qtype, len);
|
||||
outTypes[len] = '\0';
|
||||
info->qtype = outTypes;
|
||||
info->type = objc_skip_type_qualifiers (outTypes);
|
||||
}
|
||||
|
||||
/*
|
||||
* May tell the caller if the item is stored in a register.
|
||||
*/
|
||||
if (*typePtr == '+')
|
||||
{
|
||||
typePtr++;
|
||||
info->isReg = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->isReg = NO;
|
||||
}
|
||||
/*
|
||||
* Cope with negative offsets.
|
||||
*/
|
||||
if (*typePtr == '-')
|
||||
{
|
||||
typePtr++;
|
||||
negative = YES;
|
||||
}
|
||||
/*
|
||||
* May tell the caller what the stack/register offset is for
|
||||
* this argument.
|
||||
*/
|
||||
info->offset = 0;
|
||||
while (isdigit(*typePtr))
|
||||
{
|
||||
info->offset = info->offset * 10 + (*typePtr++ - '0');
|
||||
}
|
||||
if (negative == YES)
|
||||
{
|
||||
info->offset = -info->offset;
|
||||
}
|
||||
|
||||
return typePtr;
|
||||
}
|
||||
|
||||
@implementation NSMethodSignature
|
||||
|
||||
+ (NSMethodSignature*) signatureWithObjCTypes: (const char*)t
|
||||
- (id) _initWithObjCTypes: (const char*)t
|
||||
{
|
||||
NSMethodSignature *newMs;
|
||||
|
||||
const char *p = t;
|
||||
|
||||
if (t == 0 || *t == '\0')
|
||||
{
|
||||
return nil;
|
||||
[self release];
|
||||
self = nil;
|
||||
}
|
||||
newMs = AUTORELEASE([NSMethodSignature alloc]);
|
||||
newMs->_methodTypes = mframe_build_signature(t, (int*)&newMs->_argFrameLength,
|
||||
(int*)&newMs->_numArgs, 0);
|
||||
else
|
||||
{
|
||||
const char *q;
|
||||
char *args;
|
||||
char *ret;
|
||||
|
||||
return newMs;
|
||||
/* In case we have been given a method encoding string without offsets,
|
||||
* we attempt to generate the frame size and offsets in a new copy of
|
||||
* the types string.
|
||||
*/
|
||||
ret = alloca((strlen(t)+1)*16);
|
||||
|
||||
/* Copy the return type (including qualifiers) with ehough room
|
||||
* after it to store the frame size.
|
||||
*/
|
||||
p = t;
|
||||
p = objc_skip_typespec (p);
|
||||
strncpy(ret, t, p - t);
|
||||
ret[p - t] = '\0';
|
||||
args = ret + (p - t) + 10;
|
||||
*args = '\0';
|
||||
|
||||
/* Skip to the first arg type, taking note of where the qualifiers start.
|
||||
*/
|
||||
p = skip_offset (p);
|
||||
q = p;
|
||||
p = objc_skip_type_qualifiers (p);
|
||||
while (p && *p)
|
||||
{
|
||||
int size;
|
||||
|
||||
_numArgs++;
|
||||
size = objc_promoted_size (p);
|
||||
p = objc_skip_typespec (p);
|
||||
strncat(args, q, p - q);
|
||||
sprintf(args + strlen(args), "%d", _argFrameLength);
|
||||
_argFrameLength += size;
|
||||
p = skip_offset (p);
|
||||
q = p;
|
||||
p = objc_skip_type_qualifiers (p);
|
||||
}
|
||||
sprintf(ret + strlen(ret), "%d", _argFrameLength);
|
||||
_methodTypes = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
strlen(args) + strlen(ret) + 1);
|
||||
strcpy((char*)_methodTypes, ret);
|
||||
strcat((char*)_methodTypes, args);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (NSMethodSignature*) signatureWithObjCTypes: (const char*)t
|
||||
{
|
||||
return AUTORELEASE([[[self class] alloc] _initWithObjCTypes: t]);
|
||||
}
|
||||
|
||||
- (NSArgumentInfo) argumentInfoAtIndex: (NSUInteger)index
|
||||
|
@ -60,11 +440,11 @@
|
|||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Index too high."];
|
||||
}
|
||||
if (_info == 0)
|
||||
if (_inf == 0)
|
||||
{
|
||||
[self methodInfo];
|
||||
}
|
||||
return _info[index+1];
|
||||
return _inf[index+1];
|
||||
}
|
||||
|
||||
- (NSUInteger) frameLength
|
||||
|
@ -79,38 +459,38 @@
|
|||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Index too high."];
|
||||
}
|
||||
if (_info == 0)
|
||||
if (_inf == 0)
|
||||
{
|
||||
[self methodInfo];
|
||||
}
|
||||
return _info[index+1].type;
|
||||
return _inf[index+1].qtype;
|
||||
}
|
||||
|
||||
- (BOOL) isOneway
|
||||
{
|
||||
if (_info == 0)
|
||||
if (_inf == 0)
|
||||
{
|
||||
[self methodInfo];
|
||||
}
|
||||
return (_info[0].qual & _F_ONEWAY) ? YES : NO;
|
||||
return (_inf[0].qual & _F_ONEWAY) ? YES : NO;
|
||||
}
|
||||
|
||||
- (NSUInteger) methodReturnLength
|
||||
{
|
||||
if (_info == 0)
|
||||
if (_inf == 0)
|
||||
{
|
||||
[self methodInfo];
|
||||
}
|
||||
return _info[0].size;
|
||||
return _inf[0].size;
|
||||
}
|
||||
|
||||
- (const char*) methodReturnType
|
||||
{
|
||||
if (_info == 0)
|
||||
if (_inf == 0)
|
||||
{
|
||||
[self methodInfo];
|
||||
}
|
||||
return _info[0].type;
|
||||
return _inf[0].qtype;
|
||||
}
|
||||
|
||||
- (NSUInteger) numberOfArguments
|
||||
|
@ -122,8 +502,8 @@
|
|||
{
|
||||
if (_methodTypes)
|
||||
NSZoneFree(NSDefaultMallocZone(), (void*)_methodTypes);
|
||||
if (_info)
|
||||
NSZoneFree(NSDefaultMallocZone(), (void*)_info);
|
||||
if (_inf)
|
||||
NSZoneFree(NSDefaultMallocZone(), (void*)_inf);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -167,7 +547,7 @@
|
|||
@implementation NSMethodSignature(GNUstep)
|
||||
- (NSArgumentInfo*) methodInfo
|
||||
{
|
||||
if (_info == 0)
|
||||
if (_inf == 0)
|
||||
{
|
||||
const char *types = _methodTypes;
|
||||
char *outTypes;
|
||||
|
@ -180,17 +560,17 @@
|
|||
*/
|
||||
outTypes = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
sizeof(NSArgumentInfo)*(_numArgs+1) + strlen(types)*2);
|
||||
_info = (NSArgumentInfo*)outTypes;
|
||||
_info = (void*)outTypes;
|
||||
outTypes = outTypes + sizeof(NSArgumentInfo)*(_numArgs+1);
|
||||
/* Fill in the full argment information for each arg.
|
||||
*/
|
||||
for (i = 0; i <= _numArgs; i++)
|
||||
{
|
||||
types = mframe_next_arg(types, &_info[i], outTypes);
|
||||
types = next_arg(types, &_inf[i], outTypes);
|
||||
outTypes += strlen(outTypes) + 1;
|
||||
}
|
||||
}
|
||||
return _info;
|
||||
return _inf;
|
||||
}
|
||||
|
||||
- (const char*) methodType
|
||||
|
|
|
@ -68,6 +68,7 @@ callframe_from_signature (NSMethodSignature *info, void **retval)
|
|||
{
|
||||
const char *type = [info getArgumentTypeAtIndex: i];
|
||||
|
||||
type = objc_skip_type_qualifiers (type);
|
||||
size += objc_sizeof_type (type);
|
||||
if (size % align != 0)
|
||||
{
|
||||
|
@ -83,11 +84,13 @@ callframe_from_signature (NSMethodSignature *info, void **retval)
|
|||
*/
|
||||
if (retval)
|
||||
{
|
||||
const char *type = [info methodReturnType];
|
||||
const char *type;
|
||||
unsigned full = size;
|
||||
unsigned pos;
|
||||
unsigned ret;
|
||||
|
||||
type = [info methodReturnType];
|
||||
type = objc_skip_type_qualifiers (type);
|
||||
if (full % align != 0)
|
||||
{
|
||||
full += (align - full % align);
|
||||
|
@ -133,9 +136,12 @@ callframe_from_signature (NSMethodSignature *info, void **retval)
|
|||
}
|
||||
for (i = 0; i < cframe->nargs; i++)
|
||||
{
|
||||
const char *type = [info getArgumentTypeAtIndex: i];
|
||||
|
||||
cframe->args[i] = buf + offset;
|
||||
|
||||
offset += objc_sizeof_type ([info getArgumentTypeAtIndex: i]);
|
||||
type = objc_skip_type_qualifiers (type);
|
||||
offset += objc_sizeof_type (type);
|
||||
|
||||
if (offset % align != 0)
|
||||
{
|
||||
|
|
|
@ -138,10 +138,12 @@ cifframe_from_signature (NSMethodSignature *info)
|
|||
have custom ffi_types with are allocated separately. We should allocate
|
||||
them in our cifframe so we don't leak memory. Or maybe we could
|
||||
cache structure types? */
|
||||
rtype = cifframe_type([info methodReturnType], NULL);
|
||||
rtype = cifframe_type(
|
||||
objc_skip_type_qualifiers ([info methodReturnType]), NULL);
|
||||
for (i = 0; i < numargs; i++)
|
||||
{
|
||||
arg_types[i] = cifframe_type([info getArgumentTypeAtIndex: i], NULL);
|
||||
arg_types[i] = cifframe_type(
|
||||
objc_skip_type_qualifiers([info getArgumentTypeAtIndex: i]), NULL);
|
||||
}
|
||||
|
||||
if (numargs > 0)
|
||||
|
@ -478,6 +480,7 @@ cifframe_type(const char *typePtr, const char **advance)
|
|||
BOOL
|
||||
cifframe_decode_arg (const char *type, void* buffer)
|
||||
{
|
||||
type = objc_skip_type_qualifiers (type);
|
||||
switch (*type)
|
||||
{
|
||||
case _C_CHR:
|
||||
|
@ -507,6 +510,7 @@ cifframe_decode_arg (const char *type, void* buffer)
|
|||
BOOL
|
||||
cifframe_encode_arg (const char *type, void* buffer)
|
||||
{
|
||||
type = objc_skip_type_qualifiers (type);
|
||||
switch (*type)
|
||||
{
|
||||
case _C_CHR:
|
||||
|
|
559
Source/mframe.m
559
Source/mframe.m
|
@ -1,559 +0,0 @@
|
|||
/** Implementation of functions for dissecting/making method calls
|
||||
Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: Oct 1994
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
/* These functions can be used for dissecting and making method calls
|
||||
for many different situations. They are used for distributed
|
||||
objects; they could also be used to make interfaces between
|
||||
Objective C and Scheme, Perl, Tcl, or other languages.
|
||||
|
||||
*/
|
||||
|
||||
/* Remove `inline' nested functions if they crash your compiler */
|
||||
//#define inline
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <mframe.h>
|
||||
|
||||
/* Deal with strrchr: */
|
||||
#if STDC_HEADERS || defined(HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
/* An ANSI string.h and pre-ANSI memory.h might conflict. */
|
||||
#if !STDC_HEADERS && defined(HAVE_MEMORY_H)
|
||||
#include <memory.h>
|
||||
#endif /* not STDC_HEADERS and HAVE_MEMORY_H */
|
||||
#define index strchr
|
||||
#define rindex strrchr
|
||||
#define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
|
||||
#define bzero(s, n) memset ((s), 0, (n))
|
||||
#else /* not STDC_HEADERS and not HAVE_STRING_H */
|
||||
#include <strings.h>
|
||||
/* memory.h and strings.h conflict on some systems. */
|
||||
#endif /* not STDC_HEADERS and not HAVE_STRING_H */
|
||||
|
||||
#include "Foundation/NSObjCRuntime.h"
|
||||
#include "Foundation/NSData.h"
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
|
||||
|
||||
|
||||
/* For encoding and decoding the method arguments, we have to know where
|
||||
to find things in the "argframe" as returned by __builtin_apply_args.
|
||||
|
||||
For some situations this is obvious just from the selector type
|
||||
encoding, but structures passed by value cause a problem because some
|
||||
architectures actually pass these by reference, i.e. use the
|
||||
structure-value-address mentioned in the gcc/config/_/_.h files.
|
||||
|
||||
These differences are not encoded in the selector types.
|
||||
|
||||
Below is my current guess for which architectures do this.
|
||||
xxx I really should do this properly by looking at the gcc config values.
|
||||
|
||||
I've also been told that some architectures may pass structures with
|
||||
sizef(structure) > sizeof(void*) by reference, but pass smaller ones by
|
||||
value. The code doesn't currently handle that case.
|
||||
*/
|
||||
|
||||
|
||||
char*
|
||||
mframe_build_signature(const char *typePtr, int *size, int *narg, char *buf)
|
||||
{
|
||||
MFRAME_ARGS cum;
|
||||
BOOL doMalloc = NO;
|
||||
const char *types;
|
||||
char *start;
|
||||
char *dest;
|
||||
int total = 0;
|
||||
int count = 0;
|
||||
|
||||
/*
|
||||
* If we have not been given a buffer - allocate space on the stack for
|
||||
* the largest concievable type encoding.
|
||||
*/
|
||||
if (buf == 0)
|
||||
{
|
||||
doMalloc = YES;
|
||||
buf = alloca((strlen(typePtr)+1)*16);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the return type info (including qualifiers) into the buffer.
|
||||
*/
|
||||
types = objc_skip_typespec(typePtr);
|
||||
strncpy(buf, typePtr, types - typePtr);
|
||||
buf[types-typePtr] = '\0';
|
||||
|
||||
/*
|
||||
* Point to the return type, initialise size of stack args, and skip
|
||||
* to the first argument.
|
||||
*/
|
||||
types = objc_skip_type_qualifiers(typePtr);
|
||||
MFRAME_INIT_ARGS(cum, types);
|
||||
types = objc_skip_typespec(types);
|
||||
if (*types == '+')
|
||||
{
|
||||
types++;
|
||||
}
|
||||
if (*types == '-')
|
||||
{
|
||||
types++;
|
||||
}
|
||||
while (isdigit(*types))
|
||||
{
|
||||
types++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Where to start putting encoding information - leave enough room for
|
||||
* the size of the stack args to be stored after the return type.
|
||||
*/
|
||||
start = &buf[strlen(buf)+10];
|
||||
dest = start;
|
||||
|
||||
/*
|
||||
* Now step through all the arguments - copy any type qualifiers, but
|
||||
* let the macro write all the other info into the buffer.
|
||||
*/
|
||||
while (types && *types)
|
||||
{
|
||||
const char *qual = types;
|
||||
|
||||
/*
|
||||
* If there are any type qualifiers - copy the through to the
|
||||
* destination.
|
||||
*/
|
||||
types = objc_skip_type_qualifiers(types);
|
||||
while (qual < types)
|
||||
{
|
||||
*dest++ = *qual++;
|
||||
}
|
||||
MFRAME_ARG_ENCODING(cum, types, total, dest);
|
||||
count++;
|
||||
}
|
||||
*dest = '\0';
|
||||
|
||||
/*
|
||||
* Write the total size of the stack arguments after the return type,
|
||||
* then copy the remaining type information to fill the gap.
|
||||
*/
|
||||
sprintf(&buf[strlen(buf)], "%d", total);
|
||||
dest = &buf[strlen(buf)];
|
||||
while (*start)
|
||||
{
|
||||
*dest++ = *start++;
|
||||
}
|
||||
*dest = '\0';
|
||||
|
||||
/*
|
||||
* If we have written into a local buffer - we need to allocate memory
|
||||
* in which to return our result.
|
||||
*/
|
||||
if (doMalloc)
|
||||
{
|
||||
char *tmp = NSZoneMalloc(NSDefaultMallocZone(), dest - buf + 1);
|
||||
|
||||
strcpy(tmp, buf);
|
||||
buf = tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the caller wants to know the total size of the stack and/or the
|
||||
* number of arguments, return them in the appropriate variables.
|
||||
*/
|
||||
if (size)
|
||||
{
|
||||
*size = total;
|
||||
}
|
||||
if (narg)
|
||||
{
|
||||
*narg = count;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
/* Step through method encoding information extracting details.
|
||||
* If outTypes is non-nul then we copy the argument type into
|
||||
* the buffer as a nul terminated string and use the values in
|
||||
* this buffer as the types in info, rather than pointers to
|
||||
* positions in typePtr
|
||||
*/
|
||||
const char *
|
||||
mframe_next_arg(const char *typePtr, NSArgumentInfo *info, char *outTypes)
|
||||
{
|
||||
NSArgumentInfo local;
|
||||
BOOL flag;
|
||||
BOOL negative = NO;
|
||||
|
||||
if (info == 0)
|
||||
{
|
||||
info = &local;
|
||||
}
|
||||
/*
|
||||
* Skip past any type qualifiers - if the caller wants them, return them.
|
||||
*/
|
||||
flag = YES;
|
||||
info->qual = 0;
|
||||
while (flag)
|
||||
{
|
||||
switch (*typePtr)
|
||||
{
|
||||
case _C_CONST: info->qual |= _F_CONST; break;
|
||||
case _C_IN: info->qual |= _F_IN; break;
|
||||
case _C_INOUT: info->qual |= _F_INOUT; break;
|
||||
case _C_OUT: info->qual |= _F_OUT; break;
|
||||
case _C_BYCOPY: info->qual |= _F_BYCOPY; break;
|
||||
#ifdef _C_BYREF
|
||||
case _C_BYREF: info->qual |= _F_BYREF; break;
|
||||
#endif
|
||||
case _C_ONEWAY: info->qual |= _F_ONEWAY; break;
|
||||
#ifdef _C_GCINVISIBLE
|
||||
case _C_GCINVISIBLE: info->qual |= _F_GCINVISIBLE; break;
|
||||
#endif
|
||||
default: flag = NO;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
typePtr++;
|
||||
}
|
||||
}
|
||||
|
||||
info->type = typePtr;
|
||||
|
||||
/*
|
||||
* Scan for size and alignment information.
|
||||
*/
|
||||
switch (*typePtr++)
|
||||
{
|
||||
case _C_ID:
|
||||
info->size = sizeof(id);
|
||||
info->align = __alignof__(id);
|
||||
break;
|
||||
|
||||
case _C_CLASS:
|
||||
info->size = sizeof(Class);
|
||||
info->align = __alignof__(Class);
|
||||
break;
|
||||
|
||||
case _C_SEL:
|
||||
info->size = sizeof(SEL);
|
||||
info->align = __alignof__(SEL);
|
||||
break;
|
||||
|
||||
case _C_CHR:
|
||||
info->size = sizeof(char);
|
||||
info->align = __alignof__(char);
|
||||
break;
|
||||
|
||||
case _C_UCHR:
|
||||
info->size = sizeof(unsigned char);
|
||||
info->align = __alignof__(unsigned char);
|
||||
break;
|
||||
|
||||
case _C_SHT:
|
||||
info->size = sizeof(short);
|
||||
info->align = __alignof__(short);
|
||||
break;
|
||||
|
||||
case _C_USHT:
|
||||
info->size = sizeof(unsigned short);
|
||||
info->align = __alignof__(unsigned short);
|
||||
break;
|
||||
|
||||
case _C_INT:
|
||||
info->size = sizeof(int);
|
||||
info->align = __alignof__(int);
|
||||
break;
|
||||
|
||||
case _C_UINT:
|
||||
info->size = sizeof(unsigned int);
|
||||
info->align = __alignof__(unsigned int);
|
||||
break;
|
||||
|
||||
case _C_LNG:
|
||||
info->size = sizeof(long);
|
||||
info->align = __alignof__(long);
|
||||
break;
|
||||
|
||||
case _C_ULNG:
|
||||
info->size = sizeof(unsigned long);
|
||||
info->align = __alignof__(unsigned long);
|
||||
break;
|
||||
|
||||
case _C_LNG_LNG:
|
||||
info->size = sizeof(long long);
|
||||
info->align = __alignof__(long long);
|
||||
break;
|
||||
|
||||
case _C_ULNG_LNG:
|
||||
info->size = sizeof(unsigned long long);
|
||||
info->align = __alignof__(unsigned long long);
|
||||
break;
|
||||
|
||||
case _C_FLT:
|
||||
info->size = sizeof(float);
|
||||
info->align = __alignof__(float);
|
||||
break;
|
||||
|
||||
case _C_DBL:
|
||||
info->size = sizeof(double);
|
||||
info->align = __alignof__(double);
|
||||
break;
|
||||
|
||||
case _C_PTR:
|
||||
info->size = sizeof(char*);
|
||||
info->align = __alignof__(char*);
|
||||
if (*typePtr == '?')
|
||||
{
|
||||
typePtr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
typePtr = objc_skip_typespec(typePtr);
|
||||
}
|
||||
break;
|
||||
|
||||
case _C_ATOM:
|
||||
case _C_CHARPTR:
|
||||
info->size = sizeof(char*);
|
||||
info->align = __alignof__(char*);
|
||||
break;
|
||||
|
||||
case _C_ARY_B:
|
||||
{
|
||||
int length = atoi(typePtr);
|
||||
|
||||
while (isdigit(*typePtr))
|
||||
{
|
||||
typePtr++;
|
||||
}
|
||||
typePtr = mframe_next_arg(typePtr, &local, 0);
|
||||
info->size = length * ROUND(local.size, local.align);
|
||||
info->align = local.align;
|
||||
typePtr++; /* Skip end-of-array */
|
||||
}
|
||||
break;
|
||||
|
||||
case _C_STRUCT_B:
|
||||
{
|
||||
unsigned int acc_size = 0;
|
||||
unsigned int def_align = objc_alignof_type(typePtr-1);
|
||||
unsigned int acc_align = def_align;
|
||||
const char *ptr = typePtr;
|
||||
|
||||
/*
|
||||
* Skip "<name>=" stuff.
|
||||
*/
|
||||
while (*ptr != _C_STRUCT_E && *ptr != '=') ptr++;
|
||||
if (*ptr == '=') typePtr = ptr;
|
||||
typePtr++;
|
||||
|
||||
/*
|
||||
* Base structure alignment on first element.
|
||||
*/
|
||||
if (*typePtr != _C_STRUCT_E)
|
||||
{
|
||||
typePtr = mframe_next_arg(typePtr, &local, 0);
|
||||
if (typePtr == 0)
|
||||
{
|
||||
return 0; /* error */
|
||||
}
|
||||
acc_size = ROUND(acc_size, local.align);
|
||||
acc_size += local.size;
|
||||
acc_align = MAX(local.align, def_align);
|
||||
}
|
||||
/*
|
||||
* Continue accumulating structure size
|
||||
* and adjust alignment if necessary
|
||||
*/
|
||||
while (*typePtr != _C_STRUCT_E)
|
||||
{
|
||||
typePtr = mframe_next_arg(typePtr, &local, 0);
|
||||
if (typePtr == 0)
|
||||
{
|
||||
return 0; /* error */
|
||||
}
|
||||
acc_size = ROUND(acc_size, local.align);
|
||||
acc_size += local.size;
|
||||
acc_align = MAX(local.align, acc_align);
|
||||
}
|
||||
/*
|
||||
* Size must be a multiple of alignment
|
||||
*/
|
||||
if (acc_size % acc_align != 0)
|
||||
{
|
||||
acc_size += acc_align - acc_size % acc_align;
|
||||
}
|
||||
info->size = acc_size;
|
||||
info->align = acc_align;
|
||||
typePtr++; /* Skip end-of-struct */
|
||||
}
|
||||
break;
|
||||
|
||||
case _C_UNION_B:
|
||||
{
|
||||
unsigned int max_size = 0;
|
||||
unsigned int max_align = 0;
|
||||
|
||||
/*
|
||||
* Skip "<name>=" stuff.
|
||||
*/
|
||||
while (*typePtr != _C_UNION_E)
|
||||
{
|
||||
if (*typePtr++ == '=')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (*typePtr != _C_UNION_E)
|
||||
{
|
||||
typePtr = mframe_next_arg(typePtr, &local, 0);
|
||||
if (typePtr == 0)
|
||||
{
|
||||
return 0; /* error */
|
||||
}
|
||||
max_size = MAX(max_size, local.size);
|
||||
max_align = MAX(max_align, local.align);
|
||||
}
|
||||
info->size = max_size;
|
||||
info->align = max_align;
|
||||
typePtr++; /* Skip end-of-union */
|
||||
}
|
||||
break;
|
||||
|
||||
case _C_VOID:
|
||||
info->size = 0;
|
||||
info->align = __alignof__(char*);
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (typePtr == 0)
|
||||
{ /* Error condition. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Copy tye type information into the buffer if provided.
|
||||
*/
|
||||
if (outTypes != 0)
|
||||
{
|
||||
unsigned len = typePtr - info->type;
|
||||
|
||||
strncpy(outTypes, info->type, len);
|
||||
outTypes[len] = '\0';
|
||||
info->type = outTypes;
|
||||
}
|
||||
|
||||
/*
|
||||
* May tell the caller if the item is stored in a register.
|
||||
*/
|
||||
if (*typePtr == '+')
|
||||
{
|
||||
typePtr++;
|
||||
info->isReg = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->isReg = NO;
|
||||
}
|
||||
/*
|
||||
* Cope with negative offsets.
|
||||
*/
|
||||
if (*typePtr == '-')
|
||||
{
|
||||
typePtr++;
|
||||
negative = YES;
|
||||
}
|
||||
/*
|
||||
* May tell the caller what the stack/register offset is for
|
||||
* this argument.
|
||||
*/
|
||||
info->offset = 0;
|
||||
while (isdigit(*typePtr))
|
||||
{
|
||||
info->offset = info->offset * 10 + (*typePtr++ - '0');
|
||||
}
|
||||
if (negative == YES)
|
||||
{
|
||||
info->offset = -info->offset;
|
||||
}
|
||||
|
||||
return typePtr;
|
||||
}
|
||||
|
||||
|
||||
/* Return the number of arguments that the method MTH expects. Note
|
||||
that all methods need two implicit arguments `self' and `_cmd'. */
|
||||
|
||||
int
|
||||
method_types_get_number_of_arguments (const char *type)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (*type)
|
||||
{
|
||||
type = objc_skip_argspec (type);
|
||||
i += 1;
|
||||
}
|
||||
return i - 1;
|
||||
}
|
||||
|
||||
|
||||
/* Return the size of the argument block needed on the stack to invoke
|
||||
the method MTH. This may be zero, if all arguments are passed in
|
||||
registers. */
|
||||
|
||||
int
|
||||
method_types_get_size_of_stack_arguments (const char *type)
|
||||
{
|
||||
type = objc_skip_typespec (type);
|
||||
return atoi (type);
|
||||
}
|
||||
|
||||
int
|
||||
method_types_get_size_of_register_arguments(const char *types)
|
||||
{
|
||||
const char* type = strrchr(types, '+');
|
||||
|
||||
if (type)
|
||||
{
|
||||
return atoi(++type) + sizeof(void*);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
config.log
|
||||
config.status
|
|
@ -1,156 +0,0 @@
|
|||
|
||||
This directory contains files used for the 'mframe' software in gstep-base.
|
||||
|
||||
These files are part of the GNUstep Base Library.
|
||||
|
||||
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
The code in this directory was written by
|
||||
Richard Frith-Macdonald <richard@brainstorm.co.uk>.
|
||||
Inspiration for (and some of the code of) this software came from the
|
||||
original mframe.m by Andrew McCallum, the gcc compiler, and the
|
||||
libFoundation software by Ovidiu Predescu and Mircea Oancea.
|
||||
The algorithms used are copied from gcc and are copyright the Free
|
||||
Software Foundation. Many code fragments are derived from gcc either
|
||||
directly or by way of libFoundation.
|
||||
|
||||
The sections of code (and comments) to do with the MFRAME_ARG_ENCODING()
|
||||
macro for sparc, hppa and powerpc were derived in part from libFoundation
|
||||
(for which, much thanks) avoiding the need to extract the relevent details
|
||||
directly from the gcc source in these cases. The originals from which
|
||||
these fragments came the additional credit/copyright -
|
||||
|
||||
Copyright (C) 1995, 1996, 1998 Ovidiu Predescu and Mircea Oancea.
|
||||
All rights reserved.
|
||||
|
||||
Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
|
||||
|
||||
This file is part of libFoundation.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
We disclaim all warranties with regard to this software, including all
|
||||
implied warranties of merchantability and fitness, in no event shall
|
||||
we be liable for any special, indirect or consequential damages or any
|
||||
damages whatsoever resulting from loss of use, data or profits, whether in
|
||||
an action of contract, negligence or other tortious action, arising out of
|
||||
or in connection with the use or performance of this software.
|
||||
|
||||
|
||||
Purpose -
|
||||
|
||||
The files in these directories are used by the configuration script to build
|
||||
a machine/operating-system specific 'mframe.h' file containing macros used
|
||||
to access stack frames.
|
||||
The 'mframe.h' file is simply built by wrapping a system dependent file
|
||||
between mframe.head and mframe.foot
|
||||
|
||||
Advice on porting -
|
||||
|
||||
See unknown/generic for an example of the following macros
|
||||
|
||||
MFRAME_STACK_STRUCT
|
||||
This should be defined to 1 if functions return structures by value
|
||||
using the method where the caller places a pointer on the stack.
|
||||
Define this to 0 otherwise (eg. when the pointer to the structure is
|
||||
passed in a register).
|
||||
|
||||
MFRAME_SMALL_STRUCT
|
||||
This is the size of the largest structure returned by value on
|
||||
the stack. Normally gcc returns structures of up to 8 bytes on
|
||||
the stack. If your system never returns structures on the stack,
|
||||
set this to zero rather than 8.
|
||||
NB. If __builtin_apply_args() always returns an argframe for
|
||||
structure return via pointer, you should also define this to zero.
|
||||
|
||||
MFRAME_STRUCT_BYREF
|
||||
This should be defined to 1 if structure arguments are passed in
|
||||
the stack frame by reference, 0 otherwise.
|
||||
|
||||
MFRAME_ARGS_SIZE
|
||||
This must be set to the value computed by the apply_args_size()
|
||||
function in expr.c in the gcc source. It is the size of the
|
||||
area of memory allocated in which to pass arguments to a function.
|
||||
If you can't figure out how to determine this (hack expr.c to print
|
||||
the result of the function the first time it's called) - try using a
|
||||
value like 128 - which will probably be far larger than required
|
||||
(and therefore somewhat inefficient) but will most likely work.
|
||||
|
||||
MFRAME_RESULT_SIZE
|
||||
This must be set to the value computed by the apply_result_size()
|
||||
function in expr.c in the gcc source. It is the size of the area
|
||||
of memory allocated in which to return a value from a function.
|
||||
If you can't figure out how to determine this (hack expr.c to print
|
||||
the result of the function the first time it's called) - try using a
|
||||
value like 128 - which will probably be far larger than required
|
||||
(and therefore somewhat inefficient) but will most likely work.
|
||||
|
||||
MFRAME_FLT_IN_FRAME_AS_DBL
|
||||
This should be defined as 1 if float parameters to functions and
|
||||
objective-c methods are passed on the stack as double values.
|
||||
Otherwise it should not be defined.
|
||||
|
||||
MFRAME_STRUCT_ADDR(ARGFRAME,TYPES)
|
||||
If a function returns a structure by copying it into a location
|
||||
whose address is set by the caller, this macro must return that
|
||||
address within the argframe.
|
||||
Otherwise the macro must return zero.
|
||||
|
||||
MFRAME_ARGS
|
||||
This macro should define a data type to be used for recording
|
||||
information about the arguments list of a method.
|
||||
See 'CUMULATIVE_ARGS' in the configuration file for your system
|
||||
in gcc for a parallel example.
|
||||
|
||||
MFRAME_INIT_ARGS(CUM, RTYPE)
|
||||
This macro is used to initialise a variable (CUM) of the type
|
||||
defined by MFRAME_ARGS. The RTYPE value is the type encoding for the
|
||||
method return type, it is needed so that CUM can take int account any
|
||||
invisible first argument used for returning structures by value.
|
||||
See 'INIT_CUMULATIVE_ARGS' in the configuration file for your system
|
||||
in gcc for a parallel example.
|
||||
|
||||
MFRAME_ARG_ENCODING(CUM,TYPES,STACK,DEST)
|
||||
This macro is used to to determine the encoding of arguments.
|
||||
You will have to write this macro for your system by examining the
|
||||
gcc source code to determine how the compiler does this on your
|
||||
system - look for the usage of CUMULATIVE_ARGS an INIT_CUMULATIVE_ARGS
|
||||
in the configuration files for your hardware and operating system in
|
||||
the gcc (or egcs) source, and make your macro mirror it's operation.
|
||||
|
||||
Before initial entry,
|
||||
CUM should have been initialised using the MFRAME_INIT_ARGS() macro,
|
||||
TYPES should be a (const char*) variable initialised to a
|
||||
type-encoding string listing the arguments of a function/method,
|
||||
STACK should be an integer variable of value 0 in which the size of
|
||||
the stack arguments will be accumulated,
|
||||
DEST should be a (char*) variable initialised to a pointer to a
|
||||
buffer into which the full type encoding will be written.
|
||||
After each use of the macro, TYPES is advanced to point to the next
|
||||
argument, and DEST is advanced to point after the encoding of the
|
||||
previous argument.
|
||||
Of course, you must ensure that the buffer pointed to by DEST is
|
||||
large enough so that it does not overflow!
|
||||
You will be safe if your buffer is at least ten times as big as
|
||||
the type-encoding string you start from.
|
||||
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
/*
|
||||
* First six arguments are passed in registers with small (< sizeof(void*))
|
||||
* values occupying the space of a pointer.
|
||||
* If the method returns a structure, it's address is passed as an invisible
|
||||
* first argument.
|
||||
*/
|
||||
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 104
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
#define MFRAME_FLT_IN_FRAME_AS_DBL 0
|
||||
|
||||
/*
|
||||
* Structures are passed by reference as an invisible first argument, so
|
||||
* they go in the first space on the stack.
|
||||
*/
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
((void**)(ARGS))[1] : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
((void**)(ARGS))[1] = (ADDR);})
|
||||
|
||||
/*
|
||||
* Declare a type for keeping track of the arguments processed.
|
||||
*/
|
||||
typedef struct alpha_args {
|
||||
int reg_pos;
|
||||
int stk_pos;
|
||||
} MFRAME_ARGS;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize a variable to keep track of argument info while processing a
|
||||
* method. Keeps count of the offset of arguments on the stack.
|
||||
* This offset is adjusted to take account of an invisible first argument
|
||||
* used to return structures.
|
||||
*/
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).reg_pos = (*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || \
|
||||
*(RTYPE)==_C_ARY_B) ? 16 : 8; \
|
||||
(CUM).stk_pos = 0; \
|
||||
})
|
||||
|
||||
/*
|
||||
* Define maximum register offset - after this, stuff goes on the stack.
|
||||
*/
|
||||
#define ALPHAMAXR 56
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align, size; \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
align = objc_alignof_type (type); \
|
||||
size = objc_sizeof_type (type); \
|
||||
size = ROUND(size, sizeof(void*)); \
|
||||
\
|
||||
if ((CUM).reg_pos + size > ALPHAMAXR) (CUM).reg_pos = ALPHAMAXR; \
|
||||
if ((CUM).reg_pos == ALPHAMAXR) \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stk_pos); \
|
||||
(CUM).stk_pos += size; \
|
||||
(STACK) = (CUM).stk_pos; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, (CUM).reg_pos); \
|
||||
(CUM).reg_pos += size; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
if (*(TYPE) == '-') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
})
|
|
@ -1,87 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
/*
|
||||
* First six arguments are passed in registers with small (< sizeof(void*))
|
||||
* values occupying the space of a pointer.
|
||||
* If the method returns a structure, it's address is passed as an invisible
|
||||
* first argument.
|
||||
*/
|
||||
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 104
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
#define MFRAME_FLT_IN_FRAME_AS_DBL 0
|
||||
|
||||
/*
|
||||
* Structures are passed by reference as an invisible first argument, so
|
||||
* they go in the first space on the stack.
|
||||
*/
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
((void**)(ARGS))[1] : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
((void**)(ARGS))[1] = (ADDR);})
|
||||
|
||||
/*
|
||||
* Declare a type for keeping track of the arguments processed.
|
||||
*/
|
||||
typedef struct alpha_args {
|
||||
int reg_pos;
|
||||
int stk_pos;
|
||||
} MFRAME_ARGS;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize a variable to keep track of argument info while processing a
|
||||
* method. Keeps count of the offset of arguments on the stack.
|
||||
* This offset is adjusted to take account of an invisible first argument
|
||||
* used to return structures.
|
||||
*/
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).reg_pos = (*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || \
|
||||
*(RTYPE)==_C_ARY_B) ? 16 : 8; \
|
||||
(CUM).stk_pos = 0; \
|
||||
})
|
||||
|
||||
/*
|
||||
* Define maximum register offset - after this, stuff goes on the stack.
|
||||
*/
|
||||
#define ALPHAMAXR 56
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align, size; \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
align = objc_alignof_type (type); \
|
||||
size = objc_sizeof_type (type); \
|
||||
size = ROUND(size, sizeof(void*)); \
|
||||
\
|
||||
if ((CUM).reg_pos + size > ALPHAMAXR) (CUM).reg_pos = ALPHAMAXR; \
|
||||
if ((CUM).reg_pos == ALPHAMAXR) \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stk_pos); \
|
||||
(CUM).stk_pos += size; \
|
||||
(STACK) = (CUM).stk_pos; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, (CUM).reg_pos); \
|
||||
(CUM).reg_pos += size; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
})
|
1956
Source/mframe/configure
vendored
1956
Source/mframe/configure
vendored
File diff suppressed because it is too large
Load diff
|
@ -1,84 +0,0 @@
|
|||
# configure.in for mframe software
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
# Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
#
|
||||
# Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
#
|
||||
# This file is part of the GNUstep project
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([mframe.head])
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use config.guess, config.sub and install-sh provided by gnustep-make
|
||||
#--------------------------------------------------------------------
|
||||
AC_CONFIG_AUX_DIR($GNUSTEP_MAKEFILES)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Determine the host, build, and target systems
|
||||
#--------------------------------------------------------------------
|
||||
AC_CANONICAL_TARGET([])
|
||||
|
||||
dnl Checking CPU and Operating-System information for mframe.h
|
||||
|
||||
case "$target_cpu" in
|
||||
alpha*) target_cpu=alpha;;
|
||||
hppa*) target_cpu=hppa;;
|
||||
i[[3456]]86*) target_cpu=i386;;
|
||||
sparc64*) target_cpu=sparc64;;
|
||||
sparc*) target_cpu=sparc;;
|
||||
esac
|
||||
|
||||
case "$target_os" in
|
||||
freebsd*) target_os=freebsd;;
|
||||
openbsd*) target_os=openbsd;;
|
||||
darwin*) target_os=darwin;;
|
||||
esac
|
||||
|
||||
|
||||
if test -d $target_cpu -a "`echo $target_cpu/*`" != "$target_cpu/*"
|
||||
then
|
||||
my_dir=$target_cpu
|
||||
else
|
||||
echo '*************** Warning ****************'
|
||||
echo The 'mframe' software has not been ported to $target_cpu.
|
||||
echo Using information from unknown.
|
||||
echo '****************************************'
|
||||
my_dir=unknown
|
||||
fi
|
||||
|
||||
if test -f $my_dir/$target_os
|
||||
then
|
||||
my_path=$my_dir/$target_os
|
||||
echo Using information from $my_path.
|
||||
else
|
||||
echo '*************** Warning ****************'
|
||||
echo The 'mframe' software has not been ported to $target_cpu-$target_os.
|
||||
echo Using information from $my_dir/generic.
|
||||
echo '****************************************'
|
||||
my_path=$my_dir/generic
|
||||
fi
|
||||
|
||||
rm -f mframe.h
|
||||
echo "/***************** WARNING ****************" > mframe.h
|
||||
echo "* DO NOT EDIT THIS FILE DIRECTLY - IT IS *" >> mframe.h
|
||||
echo "* GENERATED AUTOMATICALLY BY THE CONFIG *" >> mframe.h
|
||||
echo "* PROCESS IN THE 'mframe' SUBDIRECTORY. *" >> mframe.h
|
||||
echo "****************** WARNING ***************/" >> mframe.h
|
||||
cat mframe.head $my_path mframe.foot >> mframe.h
|
||||
|
||||
AC_OUTPUT
|
|
@ -1,56 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 1
|
||||
#define MFRAME_STRUCT_BYREF 1
|
||||
#define MFRAME_SMALL_STRUCT 8
|
||||
#define MFRAME_ARGS_SIZE 56
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
**(void***)(ARGS) : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
**(void***)(ARGS) = (ADDR);})
|
||||
|
||||
#define MFRAME_ARGS int
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
((CUM) = (*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || \
|
||||
*(RTYPE)==_C_ARY_B) ? sizeof(void*) : 0)
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
\
|
||||
(CUM) = ROUND((CUM), align); \
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
if (*(TYPE) == '-') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if ((*type==_C_STRUCT_B || *type==_C_UNION_B || *type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM) + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(STACK) = (CUM) + size; \
|
||||
} \
|
||||
((((CUM) & 01) && ((size+3)/4) > 1) && (CUM)++); \
|
||||
(CUM) += ((size+3)/4); \
|
||||
})
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 8
|
||||
#define MFRAME_RESULT_SIZE 116
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)((ARGS)->arg_regs + sizeof(void*)) : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)((ARGS)->arg_regs + sizeof(void*)) = (ADDR);})
|
||||
|
||||
#define MFRAME_ARGS int
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) ((CUM) = 0)
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
(CUM) = ROUND((CUM), __alignof__(int)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
|
||||
if (*(TYPE) == '+') (TYPE)++; \
|
||||
if (*(TYPE) == '-') (TYPE)++; \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if ((*type==_C_STRUCT_B||*type==_C_UNION_B||*type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM) + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
size = sizeof(int); \
|
||||
} \
|
||||
(STACK) = (CUM) + size; \
|
||||
} \
|
||||
(CUM) += size; \
|
||||
})
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 8
|
||||
#define MFRAME_RESULT_SIZE 116
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)((ARGS)->arg_regs + sizeof(void*)) : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)((ARGS)->arg_regs + sizeof(void*)) = (ADDR);})
|
||||
|
||||
#define MFRAME_ARGS int
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) ((CUM) = 0)
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
(CUM) = ROUND((CUM), __alignof__(int)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
|
||||
if (*(TYPE) == '+') (TYPE)++; \
|
||||
if (*(TYPE) == '-') (TYPE)++; \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if ((*type==_C_STRUCT_B||*type==_C_UNION_B||*type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM) + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
size = sizeof(int); \
|
||||
} \
|
||||
(STACK) = (CUM) + size; \
|
||||
} \
|
||||
(CUM) += size; \
|
||||
})
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 1
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 8
|
||||
#define MFRAME_RESULT_SIZE 116
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)(ARGS)->arg_ptr : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)(ARGS)->arg_ptr = (ADDR);})
|
||||
|
||||
#define MFRAME_ARGS int
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) ((CUM) = 0)
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
(CUM) = ROUND((CUM), __alignof__(int)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
|
||||
if (*(TYPE) == '+') (TYPE)++; \
|
||||
if (*(TYPE) == '-') (TYPE)++; \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if ((*type==_C_STRUCT_B||*type==_C_UNION_B||*type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM) + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
size = sizeof(int); \
|
||||
} \
|
||||
(STACK) = (CUM) + size; \
|
||||
} \
|
||||
(CUM) += size; \
|
||||
})
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 1
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 8
|
||||
#define MFRAME_RESULT_SIZE 116
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)(ARGS)->arg_ptr : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)(ARGS)->arg_ptr = (ADDR);})
|
||||
|
||||
#define MFRAME_ARGS int
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) ((CUM) = 0)
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
(CUM) = ROUND((CUM), __alignof__(int)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
|
||||
if (*(TYPE) == '+') (TYPE)++; \
|
||||
if (*(TYPE) == '-') (TYPE)++; \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if ((*type==_C_STRUCT_B||*type==_C_UNION_B||*type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM) + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
size = sizeof(int); \
|
||||
} \
|
||||
(STACK) = (CUM) + size; \
|
||||
} \
|
||||
(CUM) += size; \
|
||||
})
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 8
|
||||
#define MFRAME_RESULT_SIZE 116
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)((ARGS)->arg_regs + sizeof(void*)) : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)((ARGS)->arg_regs + sizeof(void*)) = (ADDR);})
|
||||
|
||||
#define MFRAME_ARGS int
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) ((CUM) = 0)
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
(CUM) = ROUND((CUM), __alignof__(int)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
|
||||
if (*(TYPE) == '+') (TYPE)++; \
|
||||
if (*(TYPE) == '-') (TYPE)++; \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if ((*type==_C_STRUCT_B||*type==_C_UNION_B||*type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM) + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
size = sizeof(int); \
|
||||
} \
|
||||
(STACK) = (CUM) + size; \
|
||||
} \
|
||||
(CUM) += size; \
|
||||
})
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 8
|
||||
#define MFRAME_RESULT_SIZE 116
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)(ARGS)->arg_ptr : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)(ARGS)->arg_ptr = (ADDR);})
|
||||
|
||||
#define MFRAME_ARGS int
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) ((CUM) = 0)
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
(CUM) = ROUND((CUM), __alignof__(int)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
|
||||
if (*(TYPE) == '+') (TYPE)++; \
|
||||
if (*(TYPE) == '-') (TYPE)++; \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if ((*type==_C_STRUCT_B||*type==_C_UNION_B||*type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM) + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
size = sizeof(int); \
|
||||
} \
|
||||
(STACK) = (CUM) + size; \
|
||||
} \
|
||||
(CUM) += size; \
|
||||
})
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 8
|
||||
#define MFRAME_RESULT_SIZE 116
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)(ARGS)->arg_ptr : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)(ARGS)->arg_ptr = (ADDR);})
|
||||
|
||||
#define MFRAME_ARGS int
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) ((CUM) = 0)
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
(CUM) = ROUND((CUM), __alignof__(int)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
|
||||
if (*(TYPE) == '+') (TYPE)++; \
|
||||
if (*(TYPE) == '-') (TYPE)++; \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if ((*type==_C_STRUCT_B||*type==_C_UNION_B||*type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM) + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
size = sizeof(int); \
|
||||
} \
|
||||
(STACK) = (CUM) + size; \
|
||||
} \
|
||||
(CUM) += size; \
|
||||
})
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
|
||||
inline static void*
|
||||
mframe_arg_addr(arglist_t argf, NSArgumentInfo *info)
|
||||
{
|
||||
int offset = info->offset;
|
||||
#if WORDS_BIGENDIAN
|
||||
if (info->size < sizeof(int))
|
||||
{
|
||||
offset += sizeof(int) - info->size;
|
||||
}
|
||||
#endif
|
||||
#if NeXT_RUNTIME
|
||||
return marg_getRef(argf, offset, void);
|
||||
#else
|
||||
if (info->isReg)
|
||||
{
|
||||
return(argf->arg_regs + offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(argf->arg_ptr + offset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
inline static void
|
||||
mframe_get_arg(arglist_t argf, NSArgumentInfo *info, void* buffer)
|
||||
{
|
||||
#if MFRAME_STRUCT_BYREF || MFRAME_FLT_IN_FRAME_AS_DBL
|
||||
const char *typ = info->type;
|
||||
#endif
|
||||
#if MFRAME_STRUCT_BYREF
|
||||
|
||||
/*
|
||||
* If structures are passed in the stack frame by reference - we need
|
||||
* to copy the actual structure, rather than it's pointer.
|
||||
*/
|
||||
if (*typ == _C_STRUCT_B || *typ == _C_UNION_B || *typ == _C_ARY_B)
|
||||
{
|
||||
memcpy(buffer, *(void**)mframe_arg_addr(argf, info), info->size);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if MFRAME_FLT_IN_FRAME_AS_DBL
|
||||
if (*typ == _C_FLT)
|
||||
{
|
||||
*(float*)buffer = (float)*(double*)mframe_arg_addr(argf, info);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
memcpy(buffer, mframe_arg_addr(argf, info), info->size);
|
||||
}
|
||||
|
||||
inline static void
|
||||
mframe_set_arg(arglist_t argf, NSArgumentInfo *info, void* buffer)
|
||||
{
|
||||
#if MFRAME_STRUCT_BYREF || MFRAME_FLT_IN_FRAME_AS_DBL
|
||||
const char *typ = info->type;
|
||||
#endif
|
||||
#if MFRAME_STRUCT_BYREF
|
||||
|
||||
/*
|
||||
* If structures are passed in the stack frame by reference - we need
|
||||
* to copy a pointer onto the stack rather than the actual structure.
|
||||
*/
|
||||
if (*typ == _C_STRUCT_B || *typ == _C_UNION_B || *typ == _C_ARY_B)
|
||||
{
|
||||
memcpy(mframe_arg_addr(argf, info), &buffer, sizeof(void*));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if MFRAME_FLT_IN_FRAME_AS_DBL
|
||||
if (*typ == _C_FLT)
|
||||
{
|
||||
*(double*)mframe_arg_addr(argf, info) = *(float*)buffer;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
memcpy(mframe_arg_addr(argf, info), buffer, info->size);
|
||||
}
|
||||
|
||||
inline static void
|
||||
mframe_cpy_arg(arglist_t dst, arglist_t src, NSArgumentInfo *info)
|
||||
{
|
||||
#if MFRAME_STRUCT_BYREF
|
||||
const char *typ = info->type;
|
||||
|
||||
/*
|
||||
* If structures are passed in the stack frame by reference - we need
|
||||
* to copy a pointer onto the stack rather than the actual structure.
|
||||
*/
|
||||
if (*typ == _C_STRUCT_B || *typ == _C_UNION_B || *typ == _C_ARY_B)
|
||||
{
|
||||
memcpy(mframe_arg_addr(dst, info), mframe_arg_addr(src, info), sizeof(void*));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
memcpy(mframe_arg_addr(dst, info), mframe_arg_addr(src, info), info->size);
|
||||
}
|
||||
|
||||
#endif /* __mframe_h_GNUSTEP_BASE_INCLUDE */
|
|
@ -1,65 +0,0 @@
|
|||
/* Interface for functions that dissect/make method calls
|
||||
Copyright (C) 1994, 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: Oct 1994
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __mframe_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __mframe_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include "GNUstepBase/preface.h"
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "GNUstepBase/DistributedObjects.h"
|
||||
|
||||
/* For NSArgumentInfo we include NSMethodSignature.h */
|
||||
#include "Foundation/NSMethodSignature.h"
|
||||
|
||||
#if NeXT_runtime
|
||||
typedef union {
|
||||
char *arg_ptr;
|
||||
char arg_regs[sizeof (char*)];
|
||||
} *arglist_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Step through method encoding information extracting details.
|
||||
*/
|
||||
const char *
|
||||
mframe_next_arg(const char *typePtr, NSArgumentInfo *info, char *outTypes);
|
||||
|
||||
/*
|
||||
* Generate method encoding with stack/register offsets from a simple
|
||||
* type encoding string. Store results in 'buf' or allocate memory
|
||||
* using objc_malloc() if 'buf' is a nul pointer.
|
||||
*/
|
||||
char*
|
||||
mframe_build_signature(const char *typePtr, int *size, int *narg, char *buf);
|
||||
|
||||
|
||||
#define ROUND(V, A) \
|
||||
({ typeof(V) __v=(V); typeof(A) __a=(A); \
|
||||
__a*((__v+__a-1)/__a); })
|
||||
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
/*
|
||||
* The first eight words of non-FP are in registers (offset 4 in frame).
|
||||
* The first 13 FP args are in registers (offset 40 in frame).
|
||||
* If the method returns a structure, it's address is passed as an invisible
|
||||
* first argument, so only seven words of non-FP are passed in the registers.
|
||||
* Structures are always passed by reference.
|
||||
* Floats are placed in the frame as doubles.
|
||||
*/
|
||||
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 144
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
#define MFRAME_FLT_IN_FRAME_AS_DBL 1
|
||||
|
||||
/*
|
||||
* Structures are passed by reference as an invisible first argument, so
|
||||
* they go in the first register space for non-FP arguments - at offset 4.
|
||||
*/
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)(((char*)(ARGS))+4): (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)(((char*)(ARGS))+4) = (ADDR);})
|
||||
|
||||
/*
|
||||
* Typedef for structure to keep track of argument info while processing
|
||||
* a method.
|
||||
*/
|
||||
typedef struct rs6000_args
|
||||
{
|
||||
int int_args; /* Number of integer arguments so far. */
|
||||
int float_args; /* Number of FP arguments so far. */
|
||||
int regs_position; /* The current position for non-FP args. */
|
||||
int stack_position; /* The current position in the stack frame. */
|
||||
} MFRAME_ARGS;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize a variable to keep track of argument info while processing a
|
||||
* method. Keeps count of the number of arguments of each type seen and
|
||||
* the current offset in the non-FP registers. This offset is adjusted
|
||||
* to take account of an invisible first argument used to return structures.
|
||||
*/
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).int_args = 0; \
|
||||
(CUM).float_args = 0; \
|
||||
(CUM).stack_position = 0; \
|
||||
(CUM).regs_position = \
|
||||
((*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || *(RTYPE)==_C_ARY_B) ? \
|
||||
sizeof(void*) : 4); \
|
||||
})
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
if (*type == _C_FLT || *type == _C_DBL) \
|
||||
{ \
|
||||
if (++(CUM).float_args > 13) \
|
||||
{ \
|
||||
(CUM).stack_position += ROUND ((CUM).stack_position, \
|
||||
__alignof__(double)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stack_position); \
|
||||
(STACK) = ROUND ((CUM).stack_position, sizeof(double)); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, \
|
||||
40 + sizeof (double) * ((CUM).float_args - 1)); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int align, size; \
|
||||
\
|
||||
if (*type == _C_STRUCT_B || *type == _C_UNION_B || *type == _C_ARY_B) \
|
||||
{ \
|
||||
align = __alignof__(void*); \
|
||||
size = sizeof (void*); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
align = __alignof__(int); \
|
||||
size = objc_sizeof_type (type); \
|
||||
} \
|
||||
\
|
||||
if (++(CUM).int_args > 8) \
|
||||
{ \
|
||||
(CUM).stack_position += ROUND ((CUM).stack_position, align); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stack_position); \
|
||||
(STACK) = ROUND ((CUM).stack_position, size); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(CUM).regs_position = ROUND((CUM).regs_position, align); \
|
||||
sprintf(dest, "%.*s+%d", (TYPE)-type, type, (CUM).regs_position); \
|
||||
(CUM).regs_position += ROUND (size, align); \
|
||||
} \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
if (*(TYPE) == '-') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
})
|
|
@ -1,121 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
/*
|
||||
* The first eight words of non-FP are in registers (offset 4 in frame).
|
||||
* The first 13 FP args are in registers (offset 40 in frame).
|
||||
* If the method returns a structure, it's address is passed as an invisible
|
||||
* first argument, so only seven words of non-FP are passed in the registers.
|
||||
* Structures are always passed by reference.
|
||||
* Floats are placed in the frame as doubles.
|
||||
*/
|
||||
|
||||
#define MFRAME_STRUCT_BYREF 1
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 144
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
#define MFRAME_FLT_IN_FRAME_AS_DBL 1
|
||||
|
||||
/*
|
||||
* Structures are passed by reference as an invisible first argument, so
|
||||
* they go in the first register space for non-FP arguments - at offset 4.
|
||||
*/
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)(((char*)(ARGS))+4): (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)(((char*)(ARGS))+4) = (ADDR);})
|
||||
|
||||
/*
|
||||
* Typedef for structure to keep track of argument info while processing
|
||||
* a method.
|
||||
*/
|
||||
typedef struct rs6000_args
|
||||
{
|
||||
int int_args; /* Number of integer arguments so far. */
|
||||
int float_args; /* Number of FP arguments so far. */
|
||||
int regs_position; /* The current position for non-FP args. */
|
||||
int stack_position; /* The current position in the stack frame. */
|
||||
} MFRAME_ARGS;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize a variable to keep track of argument info while processing a
|
||||
* method. Keeps count of the number of arguments of each type seen and
|
||||
* the current offset in the non-FP registers. This offset is adjusted
|
||||
* to take account of an invisible first argument used to return structures.
|
||||
*/
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).int_args = 0; \
|
||||
(CUM).float_args = 0; \
|
||||
(CUM).stack_position = 0; \
|
||||
(CUM).regs_position = \
|
||||
((*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || *(RTYPE)==_C_ARY_B) ? \
|
||||
sizeof(void*) : 4); \
|
||||
})
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
if (*type == _C_FLT || *type == _C_DBL) \
|
||||
{ \
|
||||
if (++(CUM).float_args > 13) \
|
||||
{ \
|
||||
(CUM).stack_position += ROUND ((CUM).stack_position, \
|
||||
__alignof__(double)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stack_position); \
|
||||
(STACK) = ROUND ((CUM).stack_position, sizeof(double)); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, \
|
||||
40 + sizeof (double) * ((CUM).float_args - 1)); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int align, size; \
|
||||
\
|
||||
if (*type == _C_STRUCT_B || *type == _C_UNION_B || *type == _C_ARY_B) \
|
||||
{ \
|
||||
align = __alignof__(void*); \
|
||||
size = sizeof (void*); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
align = __alignof__(int); \
|
||||
size = objc_sizeof_type (type); \
|
||||
} \
|
||||
\
|
||||
if (++(CUM).int_args > 8) \
|
||||
{ \
|
||||
(CUM).stack_position += ROUND ((CUM).stack_position, align); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stack_position); \
|
||||
(STACK) = ROUND ((CUM).stack_position, size); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(CUM).regs_position = ROUND((CUM).regs_position, align); \
|
||||
sprintf(dest, "%.*s+%d", (TYPE)-type, type, (CUM).regs_position); \
|
||||
(CUM).regs_position += ROUND (size, align); \
|
||||
} \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
if (*(TYPE) == '-') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
})
|
|
@ -1,123 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
/*
|
||||
* The first eight words of non-FP are in registers (offset 4 in frame).
|
||||
* The first 13 FP args are in registers (offset 40 in frame).
|
||||
* If the method returns a structure, it's address is passed as an invisible
|
||||
* first argument, so only seven words of non-FP are passed in the registers.
|
||||
* Structures are always passed by reference.
|
||||
* Floats are placed in the frame as doubles.
|
||||
*/
|
||||
|
||||
#define MFRAME_STRUCT_BYREF 1
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 144
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
#define MFRAME_FLT_IN_FRAME_AS_DBL 1
|
||||
|
||||
/*
|
||||
* Structures are passed by reference as an invisible first argument, so
|
||||
* they go in the first register space for non-FP arguments - at offset 4.
|
||||
*/
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)(((char*)(ARGS))+4): (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)(((char*)(ARGS))+4) = (ADDR);})
|
||||
|
||||
/*
|
||||
* Typedef for structure to keep track of argument info while processing
|
||||
* a method.
|
||||
*/
|
||||
typedef struct rs6000_args
|
||||
{
|
||||
int int_args; /* Number of integer arguments so far. */
|
||||
int float_args; /* Number of FP arguments so far. */
|
||||
int regs_position; /* The current position for non-FP args. */
|
||||
int stack_position; /* The current position in the stack frame. */
|
||||
} MFRAME_ARGS;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize a variable to keep track of argument info while processing a
|
||||
* method. Keeps count of the number of arguments of each type seen and
|
||||
* the current offset in the non-FP registers. This offset is adjusted
|
||||
* to take account of an invisible first argument used to return structures.
|
||||
*/
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).int_args = 0; \
|
||||
(CUM).float_args = 0; \
|
||||
(CUM).stack_position = 0; \
|
||||
(CUM).regs_position = \
|
||||
((*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || *(RTYPE)==_C_ARY_B) ? \
|
||||
sizeof(void*) : 4); \
|
||||
})
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
if (*type == _C_FLT || *type == _C_DBL) \
|
||||
{ \
|
||||
if (++(CUM).float_args > 13) \
|
||||
{ \
|
||||
(CUM).stack_position += ROUND ((CUM).stack_position, \
|
||||
__alignof__(double)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stack_position); \
|
||||
(STACK) = ROUND ((CUM).stack_position, sizeof(double)); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, \
|
||||
40 + sizeof (double) * ((CUM).float_args - 1)); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int align, size; \
|
||||
\
|
||||
if (*type == _C_STRUCT_B || *type == _C_UNION_B || *type == _C_ARY_B) \
|
||||
{ \
|
||||
align = __alignof__(void*); \
|
||||
size = sizeof (void*); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
align = __alignof__(int); \
|
||||
size = objc_sizeof_type (type); \
|
||||
} \
|
||||
\
|
||||
if (++(CUM).int_args > 8) \
|
||||
{ \
|
||||
(CUM).stack_position += ROUND ((CUM).stack_position, align); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stack_position); \
|
||||
(STACK) = ROUND ((CUM).stack_position, size); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(CUM).regs_position = ROUND((CUM).regs_position, align); \
|
||||
/* FIXME: This mostly accounts for the addition in mframe_arg_addr \
|
||||
due to WORDS_BIGENDIAN */ \
|
||||
if (*type == _C_STRUCT_B && objc_sizeof_type(type) < sizeof(int)) \
|
||||
(CUM).regs_position -= sizeof(int) - objc_sizeof_type(type); \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, (CUM).regs_position); \
|
||||
if (*type == _C_STRUCT_B && objc_sizeof_type(type) < sizeof(int)) \
|
||||
(CUM).regs_position += sizeof(int) - objc_sizeof_type(type); \
|
||||
(CUM).regs_position += ROUND (size, align); \
|
||||
} \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
})
|
|
@ -1,123 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
/*
|
||||
* The first eight words of non-FP are in registers (offset 4 in frame).
|
||||
* The first 13 FP args are in registers (offset 40 in frame).
|
||||
* If the method returns a structure, it's address is passed as an invisible
|
||||
* first argument, so only seven words of non-FP are passed in the registers.
|
||||
* Structures are always passed by reference.
|
||||
* Floats are placed in the frame as doubles.
|
||||
*/
|
||||
|
||||
#define MFRAME_STRUCT_BYREF 1
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 144
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
#define MFRAME_FLT_IN_FRAME_AS_DBL 1
|
||||
|
||||
/*
|
||||
* Structures are passed by reference as an invisible first argument, so
|
||||
* they go in the first register space for non-FP arguments - at offset 4.
|
||||
*/
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)(((char*)(ARGS))+4): (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)(((char*)(ARGS))+4) = (ADDR);})
|
||||
|
||||
/*
|
||||
* Typedef for structure to keep track of argument info while processing
|
||||
* a method.
|
||||
*/
|
||||
typedef struct rs6000_args
|
||||
{
|
||||
int int_args; /* Number of integer arguments so far. */
|
||||
int float_args; /* Number of FP arguments so far. */
|
||||
int regs_position; /* The current position for non-FP args. */
|
||||
int stack_position; /* The current position in the stack frame. */
|
||||
} MFRAME_ARGS;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize a variable to keep track of argument info while processing a
|
||||
* method. Keeps count of the number of arguments of each type seen and
|
||||
* the current offset in the non-FP registers. This offset is adjusted
|
||||
* to take account of an invisible first argument used to return structures.
|
||||
*/
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).int_args = 0; \
|
||||
(CUM).float_args = 0; \
|
||||
(CUM).stack_position = 0; \
|
||||
(CUM).regs_position = \
|
||||
((*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || *(RTYPE)==_C_ARY_B) ? \
|
||||
4 + sizeof(void*) : 4); \
|
||||
})
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
if (*type == _C_FLT || *type == _C_DBL) \
|
||||
{ \
|
||||
if (++(CUM).float_args > 13) \
|
||||
{ \
|
||||
(CUM).stack_position += ROUND ((CUM).stack_position, \
|
||||
__alignof__(double)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stack_position); \
|
||||
(STACK) = ROUND ((CUM).stack_position, sizeof(double)); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, \
|
||||
40 + sizeof (double) * ((CUM).float_args - 1)); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int align, size; \
|
||||
\
|
||||
if (*type == _C_STRUCT_B || *type == _C_UNION_B || *type == _C_ARY_B) \
|
||||
{ \
|
||||
align = __alignof__(void*); \
|
||||
size = sizeof (void*); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
align = __alignof__(int); \
|
||||
size = objc_sizeof_type (type); \
|
||||
} \
|
||||
\
|
||||
if (++(CUM).int_args > 8) \
|
||||
{ \
|
||||
(CUM).stack_position += ROUND ((CUM).stack_position, align); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).stack_position); \
|
||||
(STACK) = ROUND ((CUM).stack_position, size); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(CUM).regs_position = ROUND((CUM).regs_position, align); \
|
||||
/* FIXME: This mostly accounts for the addition in mframe_arg_addr \
|
||||
due to WORDS_BIGENDIAN */ \
|
||||
if (*type == _C_STRUCT_B && objc_sizeof_type(type) < sizeof(int)) \
|
||||
(CUM).regs_position -= sizeof(int) - objc_sizeof_type(type); \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, (CUM).regs_position); \
|
||||
if (*type == _C_STRUCT_B && objc_sizeof_type(type) < sizeof(int)) \
|
||||
(CUM).regs_position += sizeof(int) - objc_sizeof_type(type); \
|
||||
(CUM).regs_position += ROUND (size, align); \
|
||||
} \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
})
|
|
@ -1,93 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 1
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 32
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)): (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)) = (ADDR);})
|
||||
|
||||
#define IN_REGS 0
|
||||
#define ON_STACK 1
|
||||
|
||||
struct sparc_args {
|
||||
int offsets[2]; /* 0 for args in regs, 1 for the rest of args on stack */
|
||||
int onStack;
|
||||
};
|
||||
|
||||
#define MFRAME_ARGS struct sparc_args
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).offsets[0] = 8; /* encoding in regs starts from 8 */ \
|
||||
(CUM).offsets[1] = 20; /* encoding on stack starts from 20 or 24 */ \
|
||||
(CUM).onStack = NO; \
|
||||
})
|
||||
|
||||
#define GET_SPARC_ARG_LOCATION(CUM, CSTRING_TYPE, TYPESIZE) \
|
||||
((CUM).onStack \
|
||||
? ON_STACK \
|
||||
: ((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 8 \
|
||||
? (((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 4 \
|
||||
? 0 : ((CUM).offsets[ON_STACK] += 4)),\
|
||||
IN_REGS) \
|
||||
: ((CUM).onStack = YES, ON_STACK)))
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
int locn = GET_SPARC_ARG_LOCATION(CUM, type, size); \
|
||||
\
|
||||
(CUM).offsets[locn] = ROUND((CUM).offsets[locn], align); \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
(CUM).offsets[locn] += sizeof(int) - ROUND(size, align); \
|
||||
} \
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
if (locn == IN_REGS) \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
if (*(TYPE) == '-') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (locn == ON_STACK) \
|
||||
{ \
|
||||
if ((*type==_C_STRUCT_B || *type==_C_UNION_B || *type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + size; \
|
||||
} \
|
||||
} \
|
||||
(CUM).offsets[locn] += \
|
||||
size < sizeof(int) \
|
||||
? ROUND(size, align) \
|
||||
: ROUND(size, sizeof(void*)); \
|
||||
})
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 1
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 32
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)): (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)) = (ADDR);})
|
||||
|
||||
#define IN_REGS 0
|
||||
#define ON_STACK 1
|
||||
|
||||
struct sparc_args {
|
||||
int offsets[2]; /* 0 for args in regs, 1 for the rest of args on stack */
|
||||
int onStack;
|
||||
};
|
||||
|
||||
#define MFRAME_ARGS struct sparc_args
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).offsets[0] = 8; /* encoding in regs starts from 8 */ \
|
||||
(CUM).offsets[1] = 20; /* encoding on stack starts from 20 or 24 */ \
|
||||
(CUM).onStack = NO; \
|
||||
})
|
||||
|
||||
#define GET_SPARC_ARG_LOCATION(CUM, CSTRING_TYPE, TYPESIZE) \
|
||||
((CUM).onStack \
|
||||
? ON_STACK \
|
||||
: ((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 8 \
|
||||
? (((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 4 \
|
||||
? 0 : ((CUM).offsets[ON_STACK] += 4)),\
|
||||
IN_REGS) \
|
||||
: ((CUM).onStack = YES, ON_STACK)))
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
int locn = GET_SPARC_ARG_LOCATION(CUM, type, size); \
|
||||
\
|
||||
(CUM).offsets[locn] = ROUND((CUM).offsets[locn], align); \
|
||||
if (size < sizeof(int)) \
|
||||
(CUM).offsets[locn] -= (sizeof(int) - size); \
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
if (locn == IN_REGS) \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (locn == ON_STACK) \
|
||||
{ \
|
||||
if ((*type==_C_STRUCT_B || *type==_C_UNION_B || *type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + size; \
|
||||
} \
|
||||
} \
|
||||
(CUM).offsets[locn] += \
|
||||
size < sizeof(int) \
|
||||
? ROUND(size, align) \
|
||||
: ROUND(size, sizeof(void*)); \
|
||||
})
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 1
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 32
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)): (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)) = (ADDR);})
|
||||
|
||||
#define IN_REGS 0
|
||||
#define ON_STACK 1
|
||||
|
||||
struct sparc_args {
|
||||
int offsets[2]; /* 0 for args in regs, 1 for the rest of args on stack */
|
||||
int onStack;
|
||||
};
|
||||
|
||||
#define MFRAME_ARGS struct sparc_args
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).offsets[0] = 8; /* encoding in regs starts from 8 */ \
|
||||
(CUM).offsets[1] = 20; /* encoding on stack starts from 20 or 24 */ \
|
||||
(CUM).onStack = NO; \
|
||||
})
|
||||
|
||||
#define GET_SPARC_ARG_LOCATION(CUM, CSTRING_TYPE, TYPESIZE) \
|
||||
((CUM).onStack \
|
||||
? ON_STACK \
|
||||
: ((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 8 \
|
||||
? (((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 4 \
|
||||
? 0 : ((CUM).offsets[ON_STACK] += 4)),\
|
||||
IN_REGS) \
|
||||
: ((CUM).onStack = YES, ON_STACK)))
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
int locn = GET_SPARC_ARG_LOCATION(CUM, type, size); \
|
||||
\
|
||||
(CUM).offsets[locn] = ROUND((CUM).offsets[locn], align); \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
(CUM).offsets[locn] += sizeof(int) - ROUND(size, align); \
|
||||
} \
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
if (locn == IN_REGS) \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (locn == ON_STACK) \
|
||||
{ \
|
||||
if ((*type==_C_STRUCT_B || *type==_C_UNION_B || *type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + size; \
|
||||
} \
|
||||
} \
|
||||
(CUM).offsets[locn] += \
|
||||
size < sizeof(int) \
|
||||
? ROUND(size, align) \
|
||||
: ROUND(size, sizeof(void*)); \
|
||||
})
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 1
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 32
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)): (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)) = (ADDR);})
|
||||
|
||||
#define IN_REGS 0
|
||||
#define ON_STACK 1
|
||||
|
||||
struct sparc_args {
|
||||
int offsets[2]; /* 0 for args in regs, 1 for the rest of args on stack */
|
||||
int onStack;
|
||||
};
|
||||
|
||||
#define MFRAME_ARGS struct sparc_args
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).offsets[0] = 8; /* encoding in regs starts from 8 */ \
|
||||
(CUM).offsets[1] = 20; /* encoding on stack starts from 20 or 24 */ \
|
||||
(CUM).onStack = NO; \
|
||||
})
|
||||
|
||||
#define GET_SPARC_ARG_LOCATION(CUM, CSTRING_TYPE, TYPESIZE) \
|
||||
((CUM).onStack \
|
||||
? ON_STACK \
|
||||
: ((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 8 \
|
||||
? (((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 4 \
|
||||
? 0 : ((CUM).offsets[ON_STACK] += 4)),\
|
||||
IN_REGS) \
|
||||
: ((CUM).onStack = YES, ON_STACK)))
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
int locn = GET_SPARC_ARG_LOCATION(CUM, type, size); \
|
||||
\
|
||||
(CUM).offsets[locn] = ROUND((CUM).offsets[locn], align); \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
(CUM).offsets[locn] += sizeof(int) - ROUND(size, align); \
|
||||
} \
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
if (locn == IN_REGS) \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
if (*(TYPE) == '-') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (locn == ON_STACK) \
|
||||
{ \
|
||||
if ((*type==_C_STRUCT_B || *type==_C_UNION_B || *type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + size; \
|
||||
} \
|
||||
} \
|
||||
(CUM).offsets[locn] += \
|
||||
size < sizeof(int) \
|
||||
? ROUND(size, align) \
|
||||
: ROUND(size, sizeof(void*)); \
|
||||
})
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 0
|
||||
#define MFRAME_ARGS_SIZE 32
|
||||
#define MFRAME_RESULT_SIZE 16
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)): (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \
|
||||
*(void**)((ARGS)->arg_regs+sizeof(void*)) = (ADDR);})
|
||||
|
||||
#define IN_REGS 0
|
||||
#define ON_STACK 1
|
||||
|
||||
struct sparc_args {
|
||||
int offsets[2]; /* 0 for args in regs, 1 for the rest of args on stack */
|
||||
int onStack;
|
||||
};
|
||||
|
||||
#define MFRAME_ARGS struct sparc_args
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
|
||||
({ \
|
||||
(CUM).offsets[0] = 8; /* encoding in regs starts from 8 */ \
|
||||
(CUM).offsets[1] = 20; /* encoding on stack starts from 20 or 24 */ \
|
||||
(CUM).onStack = NO; \
|
||||
})
|
||||
|
||||
#define GET_SPARC_ARG_LOCATION(CUM, CSTRING_TYPE, TYPESIZE) \
|
||||
((CUM).onStack \
|
||||
? ON_STACK \
|
||||
: ((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 8 \
|
||||
? (((CUM).offsets[IN_REGS] + TYPESIZE <= 6 * sizeof(int) + 4 \
|
||||
? 0 : ((CUM).offsets[ON_STACK] += 4)),\
|
||||
IN_REGS) \
|
||||
: ((CUM).onStack = YES, ON_STACK)))
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
int locn = GET_SPARC_ARG_LOCATION(CUM, type, size); \
|
||||
\
|
||||
(CUM).offsets[locn] = ROUND((CUM).offsets[locn], align); \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
(CUM).offsets[locn] += sizeof(int) - ROUND(size, align); \
|
||||
} \
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
if (locn == IN_REGS) \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s+%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM).offsets[locn]); \
|
||||
} \
|
||||
if (*(TYPE) == '+') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
if (*(TYPE) == '-') \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if (locn == ON_STACK) \
|
||||
{ \
|
||||
if ((*type==_C_STRUCT_B || *type==_C_UNION_B || *type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(STACK) = (CUM).offsets[ON_STACK] + size; \
|
||||
} \
|
||||
} \
|
||||
(CUM).offsets[locn] += \
|
||||
size < sizeof(int) \
|
||||
? ROUND(size, align) \
|
||||
: ROUND(size, sizeof(void*)); \
|
||||
})
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/* See ../README for copyright */
|
||||
|
||||
#define MFRAME_STACK_STRUCT 0
|
||||
#define MFRAME_STRUCT_BYREF 0
|
||||
#define MFRAME_SMALL_STRUCT 8
|
||||
#define MFRAME_ARGS_SIZE 128
|
||||
#define MFRAME_RESULT_SIZE 128
|
||||
|
||||
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
|
||||
(((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) && \
|
||||
objc_sizeof_type(TYPES) > MFRAME_SMALL_STRUCT) ? \
|
||||
*(void**)((ARGS)->arg_ptr + sizeof(void*)) : (void*)0)
|
||||
|
||||
#define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
|
||||
({if ((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || \
|
||||
*(TYPES)==_C_ARY_B) && \
|
||||
objc_sizeof_type(TYPES) > MFRAME_SMALL_STRUCT) \
|
||||
*(void**)((ARGS)->arg_ptr + sizeof(void*)) = (ADDR);})
|
||||
|
||||
#define MFRAME_ARGS int
|
||||
|
||||
#define MFRAME_INIT_ARGS(CUM, RTYPE) ((CUM) = 0)
|
||||
|
||||
#define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
|
||||
({ \
|
||||
const char* type = (TYPE); \
|
||||
int align = objc_alignof_type(type); \
|
||||
int size = objc_sizeof_type(type); \
|
||||
\
|
||||
(TYPE) = objc_skip_typespec(type); \
|
||||
(CUM) = ROUND((CUM), __alignof__(int)); \
|
||||
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
|
||||
if (*(TYPE) == '+') (TYPE)++; \
|
||||
if (*(TYPE) == '-') (TYPE)++; \
|
||||
while (isdigit(*(TYPE))) \
|
||||
{ \
|
||||
(TYPE)++; \
|
||||
} \
|
||||
(DEST)=&(DEST)[strlen(DEST)]; \
|
||||
if ((*type==_C_STRUCT_B||*type==_C_UNION_B||*type==_C_ARY_B)) \
|
||||
{ \
|
||||
(STACK) = (CUM) + ROUND(size, align); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (size < sizeof(int)) \
|
||||
{ \
|
||||
size = sizeof(int); \
|
||||
} \
|
||||
(STACK) = (CUM) + size; \
|
||||
} \
|
||||
(CUM) += size; \
|
||||
})
|
||||
|
4
configure
vendored
4
configure
vendored
|
@ -17895,6 +17895,10 @@ else
|
|||
enable_libffi=$do_enable_libffi
|
||||
fi;
|
||||
|
||||
if test $enable_libffi = no; then
|
||||
do_enable_libffcall=yes
|
||||
fi
|
||||
|
||||
# Check whether --enable-ffcall or --disable-ffcall was given.
|
||||
if test "${enable_ffcall+set}" = set; then
|
||||
enableval="$enable_ffcall"
|
||||
|
|
|
@ -1350,6 +1350,10 @@ AC_ARG_ENABLE(libffi,
|
|||
[ --enable-libffi Enable use of libffi library],,
|
||||
enable_libffi=$do_enable_libffi)
|
||||
|
||||
if test $enable_libffi = no; then
|
||||
do_enable_libffcall=yes
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(ffcall,
|
||||
[ --enable-ffcall Enable use of ffcall library],,
|
||||
enable_ffcall=$do_enable_libffcall)
|
||||
|
|
Loading…
Reference in a new issue