From bd236557b1616de25f68d2da5f14a420f93050a6 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 19 Aug 2003 19:25:35 +0000 Subject: [PATCH] elk (3.0-11) unstable; urgency=low * Fixed a compilation issue in src/load-dl.c:Load_Lib(). * Fixed more pointer/integer type confusions, used ptrdiff_t where possible. * Fixed a register mangling issue in heap.c:Visit_GC_List() and heap.c:Visit_Wind() (Really fixes #59893). -- Samuel Hocevar Fri, 4 Apr 2003 02:48:29 +0200 git-svn-id: svn://svn.zoy.org/elk/trunk@5 55e467fa-43c5-0310-a8a2-de718669efc6 --- config/system | 2 +- debian/changelog | 9 +++++++++ include/misc.h | 6 +++--- include/object.h | 13 ++++++++----- src/env.c | 4 ++-- src/heap-gen.c | 16 ++++++++-------- src/heap.c | 4 ++-- 7 files changed, 33 insertions(+), 21 deletions(-) diff --git a/config/system b/config/system index 5917d71..9d2c582 100644 --- a/config/system +++ b/config/system @@ -295,7 +295,7 @@ ld=ld # The C compiler flags used for all files. -cflags='-Wall -O2 -I/usr/include/libelf' +cflags='-g -Wall -O2 -I/usr/include/libelf' # Are extra C compiler flags (such as -D_NO_PROTO) required to compile diff --git a/debian/changelog b/debian/changelog index 90454e4..8629e39 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +elk (3.0-11) unstable; urgency=low + + * Fixed a compilation issue in src/load-dl.c:Load_Lib(). + * Fixed more pointer/integer type confusions, used ptrdiff_t where possible. + * Fixed a register mangling issue in heap.c:Visit_GC_List() and + heap.c:Visit_Wind() (Really fixes #59893). + + -- Samuel Hocevar Fri, 4 Apr 2003 02:48:29 +0200 + elk (3.0-10) unstable; urgency=low * Updated debhelper build dependency to >>3.0.0. diff --git a/include/misc.h b/include/misc.h index efbb167..8c5da4a 100644 --- a/include/misc.h +++ b/include/misc.h @@ -38,13 +38,13 @@ extern Object False2; /* Align heap addresses */ #ifdef ALIGN_8BYTE -# define ALIGN(ptr) ((ptr) = (char *)(((long)(ptr) + 7) & ~7)) +# define ALIGN(ptr) ((ptr) = (void *)(((ptrdiff_t)(ptr) + 7) & ~7)) #else -# define ALIGN(ptr) ((ptr) = (char *)(((long)(ptr) + 3) & ~3)) +# define ALIGN(ptr) ((ptr) = (void *)(((ptrdiff_t)(ptr) + 3) & ~3)) #endif /* Normalize stack addresses */ -#define NORM(addr) ((long)(addr) + delta) +#define NORM(addr) ((ptrdiff_t)(addr) + delta) /* Used in special forms: */ diff --git a/include/object.h b/include/object.h index 37b097c..43439ce 100644 --- a/include/object.h +++ b/include/object.h @@ -2,8 +2,11 @@ * data types. */ +#include +#include + typedef struct { - unsigned long int data; + int64_t data; int tag; } Object; @@ -21,9 +24,9 @@ typedef struct { #define FIXNUM(x) ((int)(x).data) #define CHAR(x) ((int)(x).data) -#define POINTER(x) ((x).data) -#define SETPOINTER(x,p) ((x).data = (unsigned long int)(p)) -#define SET(x,t,p) ((x).tag = (int)t << 1, (x).data = (unsigned long int)(p)) +#define POINTER(x) ((void *)(ptrdiff_t)(x).data) +#define SETPOINTER(x,p) ((x).data = (ptrdiff_t)(void *)(p)) +#define SET(x,t,p) ((x).tag = (int)t << 1, (x).data = (p)) #define ISCONST(x) ((x).tag & CONSTBIT) #define SETCONST(x) ((x).tag |= CONSTBIT) @@ -207,7 +210,7 @@ struct S_Control { Object gcsave; /* vector */ WIND *firstwind, *lastwind; int tailcall; - unsigned int delta; + ptrdiff_t delta; #ifdef GENERATIONAL_GC int reloc; #endif diff --git a/src/env.c b/src/env.c index 33c963d..49e5d02 100644 --- a/src/env.c +++ b/src/env.c @@ -8,8 +8,8 @@ void Memoize_Frame (Object); void Memoize_Frames (Object, Object); void Forget_Frame (Object); -#define Env_To_List(env, list) SET((list), T_Pair, POINTER(env)) -#define List_To_Env(list, env) SET((env), T_Environment, POINTER(list)) +#define Env_To_List(env, list) SET((list), T_Pair, (ptrdiff_t)POINTER(env)) +#define List_To_Env(list, env) SET((env), T_Environment, (ptrdiff_t)POINTER(list)) Object The_Environment, Global_Environment; diff --git a/src/heap-gen.c b/src/heap-gen.c index 2b9bddd..13bb574 100644 --- a/src/heap-gen.c +++ b/src/heap-gen.c @@ -508,7 +508,7 @@ void Make_Heap (int size) { else aligned_heap_ptr = heap_ptr; - SET(heap_obj, 0, aligned_heap_ptr); + SET(heap_obj, 0, (ptrdiff_t)aligned_heap_ptr); #ifdef ARRAY_BROKEN pagebase = ((gcptr_t)POINTER (heap_obj)) / PAGEBYTES; @@ -600,7 +600,7 @@ static int ExpandHeap (char *reason) { else aligned_heap_ptr = heap_ptr; - SET(heap_obj, 0, aligned_heap_ptr); + SET(heap_obj, 0, (ptrdiff_t)aligned_heap_ptr); new_first = firstpage; new_last = lastpage; @@ -911,7 +911,7 @@ Object Alloc_Object (size, type, konst) { MAKE_HEADER (*current_freep, s, type); current_freep++; *current_freep = Null; - SET (obj, type, current_freep); + SET (obj, type, (ptrdiff_t)current_freep); if (big) current_freep = (Object*)0, current_free = 0; else @@ -1018,7 +1018,7 @@ int Visit (register Object *cp) { if (WAS_FORWARDED (*cp)) { if (pageaddr != 0) PROTECT (pageaddr); - MAKEOBJ (*cp, tag, POINTER(*obj_ptr)); + MAKEOBJ (*cp, tag, (ptrdiff_t)POINTER(*obj_ptr)); if (konst) SETCONST (*cp); return 0; @@ -1091,8 +1091,8 @@ do_forward: MAKE_HEADER (*forward_freep, objwords, tag); forward_freep++; memcpy (forward_freep, obj_ptr, (objwords-1)*sizeof(Object)); - SET (*obj_ptr, T_Broken_Heart, forward_freep); - MAKEOBJ (*cp, tag, forward_freep); + SET (*obj_ptr, T_Broken_Heart, (ptrdiff_t)forward_freep); + MAKEOBJ (*cp, tag, (ptrdiff_t)forward_freep); if (konst) SETCONST (*cp); forward_freep += (objwords - 1); @@ -1135,7 +1135,7 @@ static void ScanPage (Object *currentp, Object *nextcp) { * words. */ - SET(obj, t, cp); + SET(obj, t, (ptrdiff_t)cp); switch (t) { case T_Symbol: @@ -1540,7 +1540,7 @@ static void General_Collect (int initiate) { fpage = next (fpage); } current_freep = (Object *)PHYSPAGE (fpage); - SET(obj, 0, current_freep); + SET(obj, 0, (ptrdiff_t)current_freep); current_freepage = OBJ_TO_PAGE (obj); /* advance spaces. Then forward all objects directly accessible diff --git a/src/heap.c b/src/heap.c index 73b1517..dfb5525 100644 --- a/src/heap.c +++ b/src/heap.c @@ -55,7 +55,7 @@ void Call_After_GC () { p->func(); } -void Visit_GC_List (GCNODE *list, int delta) { +void Visit_GC_List (GCNODE *list, ptrdiff_t delta) { register GCNODE *gp, *p; register int n; register Object *vec; @@ -72,7 +72,7 @@ void Visit_GC_List (GCNODE *list, int delta) { } } -void Visit_Wind (WIND *list, unsigned int delta) { +void Visit_Wind (WIND *list, ptrdiff_t delta) { register WIND *wp, *p; for (wp = list; wp; wp = p->next) {