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 1999-02-02 12:02:14 +00:00
parent a64f5e21b9
commit 11745d811a
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> 1999-02-01 Adam Fedor <fedor@gnu.org>
* Source/UnixFileHandle.m: Switch include of netinet/in.h. * Source/UnixFileHandle.m: Switch include of netinet/in.h.

View file

@ -1,8 +1,8 @@
/* See ../README for copyright */ /* See ../README for copyright */
/* /*
* All arguments are passed on the stack with small (< sizeof(void*)) values * First six arguments are passed in registers with small (< sizeof(void*))
* occupying the space of a pointer. * values occupying the space of a pointer.
* If the method returns a structure, it's address is passed as an invisible * If the method returns a structure, it's address is passed as an invisible
* first argument. * first argument.
*/ */
@ -19,16 +19,19 @@
*/ */
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \ #define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \ ((*(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) \ #define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \ ({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. * 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) \ #define MFRAME_INIT_ARGS(CUM, RTYPE) \
({ \ ({ \
(CUM) = \ (CUM).reg_pos = (*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || \
((*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || *(RTYPE)==_C_ARY_B) ? \ *(RTYPE)==_C_ARY_B) ? 16 : 8; \
sizeof(void*) : 0); \ (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) \ #define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
({ \ ({ \
const char* type = (TYPE); \ const char* type = (TYPE); \
@ -53,11 +61,20 @@ typedef int MFRAME_ARGS;
(TYPE) = objc_skip_typespec(type); \ (TYPE) = objc_skip_typespec(type); \
align = objc_alignof_type (type); \ align = objc_alignof_type (type); \
size = objc_sizeof_type (type); \ size = objc_sizeof_type (type); \
size = ROUND(size, sizeof(void*)); \
\ \
(CUM) = ROUND ((CUM), align); \ if ((CUM).reg_pos + size > ALPHAMAXR) (CUM).reg_pos = ALPHAMAXR; \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \ if ((CUM).reg_pos == ALPHAMAXR) \
(STACK) = (CUM) + size; \ { \
(CUM) += ROUND(size, sizeof(void*)); \ 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)]; \ (DEST)=&(DEST)[strlen(DEST)]; \
if (*(TYPE) == '+') \ if (*(TYPE) == '+') \
{ \ { \

View file

@ -1,8 +1,8 @@
/* See ../README for copyright */ /* See ../README for copyright */
/* /*
* All arguments are passed on the stack with small (< sizeof(void*)) values * First six arguments are passed in registers with small (< sizeof(void*))
* occupying the space of a pointer. * values occupying the space of a pointer.
* If the method returns a structure, it's address is passed as an invisible * If the method returns a structure, it's address is passed as an invisible
* first argument. * first argument.
*/ */
@ -19,16 +19,19 @@
*/ */
#define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \ #define MFRAME_GET_STRUCT_ADDR(ARGS, TYPES) \
((*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) ? \ ((*(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) \ #define MFRAME_SET_STRUCT_ADDR(ARGS, TYPES, ADDR) \
({if (*(TYPES)==_C_STRUCT_B || *(TYPES)==_C_UNION_B || *(TYPES)==_C_ARY_B) \ ({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. * 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) \ #define MFRAME_INIT_ARGS(CUM, RTYPE) \
({ \ ({ \
(CUM) = \ (CUM).reg_pos = (*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || \
((*(RTYPE)==_C_STRUCT_B || *(RTYPE)==_C_UNION_B || *(RTYPE)==_C_ARY_B) ? \ *(RTYPE)==_C_ARY_B) ? 16 : 8; \
sizeof(void*) : 0); \ (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) \ #define MFRAME_ARG_ENCODING(CUM, TYPE, STACK, DEST) \
({ \ ({ \
const char* type = (TYPE); \ const char* type = (TYPE); \
@ -53,11 +61,20 @@ typedef int MFRAME_ARGS;
(TYPE) = objc_skip_typespec(type); \ (TYPE) = objc_skip_typespec(type); \
align = objc_alignof_type (type); \ align = objc_alignof_type (type); \
size = objc_sizeof_type (type); \ size = objc_sizeof_type (type); \
size = ROUND(size, sizeof(void*)); \
\ \
(CUM) = ROUND ((CUM), align); \ if ((CUM).reg_pos + size > ALPHAMAXR) (CUM).reg_pos = ALPHAMAXR; \
sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \ if ((CUM).reg_pos == ALPHAMAXR) \
(STACK) = (CUM) + size; \ { \
(CUM) += ROUND(size, sizeof(void*)); \ 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)]; \ (DEST)=&(DEST)[strlen(DEST)]; \
if (*(TYPE) == '+') \ if (*(TYPE) == '+') \
{ \ { \