Tidied indents

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3151 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1998-11-02 09:38:25 +00:00
parent 776f91d7ec
commit af00f419e8
11 changed files with 388 additions and 265 deletions

View file

@ -19,12 +19,12 @@
The code in this directory was written by
Richard Frith-Macdonald <richard@brainstorm.co.uk>.
Inspiration for this software came from the original mframe.m by
Andrew McCallum, and the libFoundation software by Ovidiu Predescu and
Mircea Oancea, while the algorithms used are copied from gcc and are
copyright the Free Software Foundation. Many code fragments are derived
from gcc by way of libFoundation.
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.
These files are used by the configuration script to build a
machine/operating-system specific 'mframe.m' file containing macros used
@ -52,7 +52,7 @@ MFRAME_SMALL_STRUCT
structure return via pointe, you should also define this to zero.
MFRAME_STRUCT_BYREF
This should be defined to 1 if structure aprguments are passed
This should be defined to 1 if structure arguments are passed
by reference, 0 otherwise.
MFRAME_ARGS_SIZE
@ -71,6 +71,11 @@ MFRAME_RESULT_SIZE
value like 128 - which will probably be far larger than required
(and therefore somewhat inefficient) but will msot 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

View file

@ -28,13 +28,23 @@
(CUM) = ROUND((CUM), align); \
(TYPE) = objc_skip_typespec(type); \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
if (*(TYPE) == '+') (TYPE)++; \
while (isdigit(*(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); \
})

View file

@ -29,12 +29,19 @@
(TYPE) = objc_skip_typespec(type); \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
if (*(TYPE) == '+') (TYPE)++; \
while (isdigit(*(TYPE))) (TYPE)++; \
while (isdigit(*(TYPE))) \
{ \
(TYPE)++; \
} \
(DEST)=&(DEST)[strlen(DEST)]; \
if ((*type==_C_STRUCT_B||*type==_C_UNION_B||*type==_C_ARY_B)&&size>2) \
{ \
(STACK) = (CUM) + ROUND(size, align); \
} \
else \
{ \
(STACK) = (CUM) + size; \
} \
(CUM) += ROUND(size, sizeof(void*)); \
})

View file

@ -28,13 +28,23 @@
(CUM) = ROUND((CUM), align); \
(TYPE) = objc_skip_typespec(type); \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
if (*(TYPE) == '+') (TYPE)++; \
while (isdigit(*(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)&&size>2) \
{ \
(STACK) = (CUM) + ROUND(size, align); \
} \
else \
{ \
(STACK) = (CUM) + size; \
} \
(CUM) += ROUND(size, sizeof(void*)); \
})

View file

@ -28,13 +28,23 @@
(CUM) = ROUND((CUM), align); \
(TYPE) = objc_skip_typespec(type); \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
if (*(TYPE) == '+') (TYPE)++; \
while (isdigit(*(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)&&size>2) \
{ \
(STACK) = (CUM) + ROUND(size, align); \
} \
else \
{ \
(STACK) = (CUM) + size; \
} \
(CUM) += ROUND(size, sizeof(void*)); \
})

View file

@ -28,13 +28,23 @@
(CUM) = ROUND((CUM), align); \
(TYPE) = objc_skip_typespec(type); \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
if (*(TYPE) == '+') (TYPE)++; \
while (isdigit(*(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)&&size>2) \
{ \
(STACK) = (CUM) + ROUND(size, align); \
} \
else \
{ \
(STACK) = (CUM) + size; \
} \
(CUM) += ROUND(size, sizeof(void*)); \
})

View file

@ -5,13 +5,19 @@ 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 (info->isReg)
{
return(argf->arg_regs + offset);
}
else
{
return(argf->arg_ptr + offset);
}
}
inline static void
mframe_get_arg(arglist_t argf, NSArgumentInfo *info, void* buffer)
@ -23,10 +29,18 @@ mframe_get_arg(arglist_t argf, NSArgumentInfo *info, void* buffer)
* 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) {
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);
}
@ -41,10 +55,18 @@ mframe_set_arg(arglist_t argf, NSArgumentInfo *info, void* buffer)
* 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) {
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);
}
@ -59,7 +81,8 @@ mframe_cpy_arg(arglist_t dst, arglist_t src, NSArgumentInfo *info)
* 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) {
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

View file

@ -1,5 +1,5 @@
/* Interface for functions that dissect/make method calls
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
Copyright (C) 1994, 1996, 1998 Free Software Foundation, Inc.
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
Created: Oct 1994

View file

@ -24,9 +24,11 @@ struct sparc_args {
#define MFRAME_ARGS struct sparc_args
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
({ (CUM).offsets[0] = 8; /* encoding in regs starts from 8 */ \
({ \
(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; })
(CUM).onStack = NO; \
})
#define GET_SPARC_ARG_LOCATION(CUM, CSTRING_TYPE, TYPESIZE) \
((CUM).onStack \
@ -46,21 +48,38 @@ struct sparc_args {
\
(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)++; \
} \
if (*(TYPE) == '+') \
{ \
(TYPE)++; \
} \
while (isdigit(*(TYPE))) \
{ \
(TYPE)++; \
} \
(DEST)=&(DEST)[strlen(DEST)]; \
if (locn == ON_STACK) { \
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) \

View file

@ -24,9 +24,11 @@ struct sparc_args {
#define MFRAME_ARGS struct sparc_args
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
({ (CUM).offsets[0] = 8; /* encoding in regs starts from 8 */ \
({ \
(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; })
(CUM).onStack = NO; \
})
#define GET_SPARC_ARG_LOCATION(CUM, CSTRING_TYPE, TYPESIZE) \
((CUM).onStack \
@ -46,21 +48,38 @@ struct sparc_args {
\
(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)++; \
} \
if (*(TYPE) == '+') \
{ \
(TYPE)++; \
} \
while (isdigit(*(TYPE))) \
{ \
(TYPE)++; \
} \
(DEST)=&(DEST)[strlen(DEST)]; \
if (locn == ON_STACK) { \
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) \

View file

@ -33,13 +33,23 @@
(CUM) = ROUND((CUM), align); \
(TYPE) = objc_skip_typespec(type); \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
if (*(TYPE) == '+') (TYPE)++; \
while (isdigit(*(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) += ROUND(size, sizeof(void*)); \
})