Initial port

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3640 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-02-02 12:02:14 +00:00
parent f519dfe15c
commit 81535be65e
3 changed files with 63 additions and 24 deletions

View file

@ -1,3 +1,8 @@
Tue Feb 2 11:20:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/mframe/alpha/linux-gnu: First 'real' port to alpha.
* Source/mframe/alpha/generic: ditto
1999-02-01 Adam Fedor <fedor@gnu.org>
* Source/UnixFileHandle.m: Switch include of netinet/in.h.

View file

@ -1,8 +1,8 @@
/* See ../README for copyright */
/*
* All arguments are passed on the stack with small (< sizeof(void*)) values
* occupying the space of a pointer.
* 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.
*/
@ -19,16 +19,19 @@
*/
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
*(void**)(ARGS) : (void*)0)
((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) = (ADDR);})
((void**)(ARGS))[1] = (ADDR);})
/*
* Declare a type for keeping track of the arguments processed.
*/
typedef int MFRAME_ARGS;
typedef struct alpha_args {
int reg_pos;
int stk_pos;
} MFRAME_ARGS;
/*
@ -40,11 +43,16 @@ typedef int MFRAME_ARGS;
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
({ \
(CUM) = \
((*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || *(RTYPE)==_C_ARY_B) ? \
sizeof(void*) : 0); \
(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); \
@ -53,11 +61,20 @@ typedef int MFRAME_ARGS;
(TYPE) = objc_skip_typespec(type); \
align = objc_alignof_type (type); \
size = objc_sizeof_type (type); \
size = ROUND(size, sizeof(void*)); \
\
(CUM) = ROUND ((CUM), align); \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
(STACK) = (CUM) + size; \
(CUM) += 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) == '+') \
{ \

View file

@ -1,8 +1,8 @@
/* See ../README for copyright */
/*
* All arguments are passed on the stack with small (< sizeof(void*)) values
* occupying the space of a pointer.
* 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.
*/
@ -19,16 +19,19 @@
*/
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \
*(void**)(ARGS) : (void*)0)
((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) = (ADDR);})
((void**)(ARGS))[1] = (ADDR);})
/*
* Declare a type for keeping track of the arguments processed.
*/
typedef int MFRAME_ARGS;
typedef struct alpha_args {
int reg_pos;
int stk_pos;
} MFRAME_ARGS;
/*
@ -40,11 +43,16 @@ typedef int MFRAME_ARGS;
#define MFRAME_INIT_ARGS(CUM, RTYPE) \
({ \
(CUM) = \
((*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || *(RTYPE)==_C_ARY_B) ? \
sizeof(void*) : 0); \
(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); \
@ -53,11 +61,20 @@ typedef int MFRAME_ARGS;
(TYPE) = objc_skip_typespec(type); \
align = objc_alignof_type (type); \
size = objc_sizeof_type (type); \
size = ROUND(size, sizeof(void*)); \
\
(CUM) = ROUND ((CUM), align); \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \
(STACK) = (CUM) + size; \
(CUM) += 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) == '+') \
{ \