From 2fe19533860fb9cc07fbd34a20a7775d04f41ca3 Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 14 Apr 2000 10:38:22 +0000 Subject: [PATCH] General stack info handling improvements git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6466 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ Source/NSData.m | 15 ++++++++------- Source/mframe.m | 21 +++++++++++++++++++-- Source/mframe/alpha/generic | 4 ++++ Source/mframe/hppa/generic | 4 ++++ Source/mframe/i386/generic | 1 + Source/mframe/powerpc/generic | 4 ++++ Source/mframe/sparc/generic | 4 ++++ Source/mframe/unknown/generic | 4 ++++ Source/objc-gnu2next.m | 3 +++ 10 files changed, 59 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc62c9ef9..bcb02247a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-04-14 Richard Frith-Macdonald + + * Source/mframe.m: Update to handle '-' in stack position information + in type encodings. + * Source/Invocation.m: ditto + * Source/objc-gnu2next.m: ditto + * Source/mframe/*/generic: ditto + 2000-04-08 Adam Fedor * Source/NSString.m: Include NSISOLatin2StringEncoding coding. diff --git a/Source/NSData.m b/Source/NSData.m index a52f54081..886c04846 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -74,6 +74,7 @@ #include #include #include +#include #include /* for memset() */ #include /* SEEK_* on SunOS 4 */ @@ -270,7 +271,7 @@ failure: } } -+ (NSData*) allocWithZone: (NSZone*)z ++ (id) allocWithZone: (NSZone*)z { return (NSData*)NSAllocateObject(dataMalloc, 0, z); } @@ -1176,7 +1177,7 @@ failure: @implementation NSMutableData -+ (NSData*) allocWithZone: (NSZone*)z ++ (id) allocWithZone: (NSZone*)z { return (NSData*)NSAllocateObject(mutableDataMalloc, 0, z); } @@ -1662,7 +1663,7 @@ failure: */ @implementation NSDataStatic -+ (NSData*) allocWithZone: (NSZone*)z ++ (id) allocWithZone: (NSZone*)z { return (NSData*)NSAllocateObject(self, 0, z); } @@ -2285,7 +2286,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) #if HAVE_MMAP @implementation NSDataMappedFile -+ (NSData*) allocWithZone: (NSZone*)z ++ (id) allocWithZone: (NSZone*)z { return (NSData*)NSAllocateObject([NSDataMappedFile class], 0, z); } @@ -2357,7 +2358,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) #if HAVE_SHMCTL @implementation NSDataShared -+ (NSData*) allocWithZone: (NSZone*)z ++ (id) allocWithZone: (NSZone*)z { return (NSData*)NSAllocateObject([NSDataShared class], 0, z); } @@ -2468,7 +2469,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) } } -+ (NSData*) allocWithZone: (NSZone*)z ++ (id) allocWithZone: (NSZone*)z { return (NSData*)NSAllocateObject(mutableDataMalloc, 0, z); } @@ -3043,7 +3044,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) #if HAVE_SHMCTL @implementation NSMutableDataShared -+ (NSData*) allocWithZone: (NSZone*)z ++ (id) allocWithZone: (NSZone*)z { return (NSData*)NSAllocateObject([NSMutableDataShared class], 0, z); } diff --git a/Source/mframe.m b/Source/mframe.m index d371455e8..f98055570 100644 --- a/Source/mframe.m +++ b/Source/mframe.m @@ -113,6 +113,10 @@ mframe_build_signature(const char *typePtr, int *size, int *narg, char *buf) { types++; } + if (*types == '-') + { + types++; + } while (isdigit(*types)) { types++; @@ -448,6 +452,8 @@ mframe_next_arg(const char *typePtr, NSArgumentInfo *info) */ if (info->type[0] != _C_PTR || info->type[1] == '?') { + BOOL negative = NO; + /* * May tell the caller if the item is stored in a register. */ @@ -456,11 +462,18 @@ mframe_next_arg(const char *typePtr, NSArgumentInfo *info) typePtr++; info->isReg = YES; } - else if (info->isReg) + 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. @@ -470,6 +483,10 @@ mframe_next_arg(const char *typePtr, NSArgumentInfo *info) { info->offset = info->offset * 10 + (*typePtr++ - '0'); } + if (negative == YES) + { + info->offset = -info->offset; + } } return typePtr; diff --git a/Source/mframe/alpha/generic b/Source/mframe/alpha/generic index 352c81617..9ce0ba1cb 100644 --- a/Source/mframe/alpha/generic +++ b/Source/mframe/alpha/generic @@ -80,6 +80,10 @@ typedef struct alpha_args { { \ (TYPE)++; \ } \ + if (*(TYPE) == '-') \ + { \ + (TYPE)++; \ + } \ while (isdigit(*(TYPE))) \ { \ (TYPE)++; \ diff --git a/Source/mframe/hppa/generic b/Source/mframe/hppa/generic index ab95092b6..32a98bbc9 100644 --- a/Source/mframe/hppa/generic +++ b/Source/mframe/hppa/generic @@ -33,6 +33,10 @@ { \ (TYPE)++; \ } \ + if (*(TYPE) == '-') \ + { \ + (TYPE)++; \ + } \ while (isdigit(*(TYPE))) \ { \ (TYPE)++; \ diff --git a/Source/mframe/i386/generic b/Source/mframe/i386/generic index 727429198..df30c136c 100644 --- a/Source/mframe/i386/generic +++ b/Source/mframe/i386/generic @@ -30,6 +30,7 @@ (TYPE) = objc_skip_typespec(type); \ sprintf((DEST), "%.*s%d", (TYPE)-type, type, (CUM)); \ if (*(TYPE) == '+') (TYPE)++; \ + if (*(TYPE) == '-') (TYPE)++; \ while (isdigit(*(TYPE))) \ { \ (TYPE)++; \ diff --git a/Source/mframe/powerpc/generic b/Source/mframe/powerpc/generic index 5e26fd890..f9004c42b 100644 --- a/Source/mframe/powerpc/generic +++ b/Source/mframe/powerpc/generic @@ -110,6 +110,10 @@ typedef struct rs6000_args { \ (TYPE)++; \ } \ + if (*(TYPE) == '-') \ + { \ + (TYPE)++; \ + } \ while (isdigit(*(TYPE))) \ { \ (TYPE)++; \ diff --git a/Source/mframe/sparc/generic b/Source/mframe/sparc/generic index 9ff52f41a..c906b7ad0 100644 --- a/Source/mframe/sparc/generic +++ b/Source/mframe/sparc/generic @@ -65,6 +65,10 @@ struct sparc_args { { \ (TYPE)++; \ } \ + if (*(TYPE) == '-') \ + { \ + (TYPE)++; \ + } \ while (isdigit(*(TYPE))) \ { \ (TYPE)++; \ diff --git a/Source/mframe/unknown/generic b/Source/mframe/unknown/generic index 51575f3ed..cebad6d9a 100644 --- a/Source/mframe/unknown/generic +++ b/Source/mframe/unknown/generic @@ -38,6 +38,10 @@ { \ (TYPE)++; \ } \ + if (*(TYPE) == '-') \ + { \ + (TYPE)++; \ + } \ while (isdigit(*(TYPE))) \ { \ (TYPE)++; \ diff --git a/Source/objc-gnu2next.m b/Source/objc-gnu2next.m index 6f2be145b..b2836e3cc 100644 --- a/Source/objc-gnu2next.m +++ b/Source/objc-gnu2next.m @@ -401,6 +401,7 @@ inline const char* objc_skip_offset (const char* type) { if (*type == '+') type++; + if (*type == '-') type++; while(isdigit(*++type)); return type; } @@ -507,7 +508,9 @@ sel_types_match (const char* t1, const char* t2) while (*t1 && *t2) { if (*t1 == '+') t1++; + if (*t1 == '-') t1++; if (*t2 == '+') t2++; + if (*t2 == '-') t2++; while (isdigit(*t1)) t1++; while (isdigit(*t2)) t2++; /* xxx Remove these next two lines when qualifiers are put in