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 <sam@zoy.org>  Fri,  4 Apr 2003 02:48:29 +0200


git-svn-id: svn://svn.zoy.org/elk/trunk@5 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-08-19 19:25:35 +00:00
parent 141bca2769
commit bd236557b1
7 changed files with 33 additions and 21 deletions

View File

@ -295,7 +295,7 @@ ld=ld
# The C compiler flags used for all files. # 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 # Are extra C compiler flags (such as -D_NO_PROTO) required to compile

9
debian/changelog vendored
View File

@ -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 <sam@zoy.org> Fri, 4 Apr 2003 02:48:29 +0200
elk (3.0-10) unstable; urgency=low elk (3.0-10) unstable; urgency=low
* Updated debhelper build dependency to >>3.0.0. * Updated debhelper build dependency to >>3.0.0.

View File

@ -38,13 +38,13 @@ extern Object False2;
/* Align heap addresses */ /* Align heap addresses */
#ifdef ALIGN_8BYTE #ifdef ALIGN_8BYTE
# define ALIGN(ptr) ((ptr) = (char *)(((long)(ptr) + 7) & ~7)) # define ALIGN(ptr) ((ptr) = (void *)(((ptrdiff_t)(ptr) + 7) & ~7))
#else #else
# define ALIGN(ptr) ((ptr) = (char *)(((long)(ptr) + 3) & ~3)) # define ALIGN(ptr) ((ptr) = (void *)(((ptrdiff_t)(ptr) + 3) & ~3))
#endif #endif
/* Normalize stack addresses */ /* Normalize stack addresses */
#define NORM(addr) ((long)(addr) + delta) #define NORM(addr) ((ptrdiff_t)(addr) + delta)
/* Used in special forms: */ /* Used in special forms: */

View File

@ -2,8 +2,11 @@
* data types. * data types.
*/ */
#include <stdint.h>
#include <malloc.h>
typedef struct { typedef struct {
unsigned long int data; int64_t data;
int tag; int tag;
} Object; } Object;
@ -21,9 +24,9 @@ typedef struct {
#define FIXNUM(x) ((int)(x).data) #define FIXNUM(x) ((int)(x).data)
#define CHAR(x) ((int)(x).data) #define CHAR(x) ((int)(x).data)
#define POINTER(x) ((x).data) #define POINTER(x) ((void *)(ptrdiff_t)(x).data)
#define SETPOINTER(x,p) ((x).data = (unsigned long int)(p)) #define SETPOINTER(x,p) ((x).data = (ptrdiff_t)(void *)(p))
#define SET(x,t,p) ((x).tag = (int)t << 1, (x).data = (unsigned long int)(p)) #define SET(x,t,p) ((x).tag = (int)t << 1, (x).data = (p))
#define ISCONST(x) ((x).tag & CONSTBIT) #define ISCONST(x) ((x).tag & CONSTBIT)
#define SETCONST(x) ((x).tag |= CONSTBIT) #define SETCONST(x) ((x).tag |= CONSTBIT)
@ -207,7 +210,7 @@ struct S_Control {
Object gcsave; /* vector */ Object gcsave; /* vector */
WIND *firstwind, *lastwind; WIND *firstwind, *lastwind;
int tailcall; int tailcall;
unsigned int delta; ptrdiff_t delta;
#ifdef GENERATIONAL_GC #ifdef GENERATIONAL_GC
int reloc; int reloc;
#endif #endif

View File

@ -8,8 +8,8 @@ void Memoize_Frame (Object);
void Memoize_Frames (Object, Object); void Memoize_Frames (Object, Object);
void Forget_Frame (Object); void Forget_Frame (Object);
#define Env_To_List(env, list) SET((list), T_Pair, POINTER(env)) #define Env_To_List(env, list) SET((list), T_Pair, (ptrdiff_t)POINTER(env))
#define List_To_Env(list, env) SET((env), T_Environment, POINTER(list)) #define List_To_Env(list, env) SET((env), T_Environment, (ptrdiff_t)POINTER(list))
Object The_Environment, Global_Environment; Object The_Environment, Global_Environment;

View File

@ -508,7 +508,7 @@ void Make_Heap (int size) {
else else
aligned_heap_ptr = heap_ptr; aligned_heap_ptr = heap_ptr;
SET(heap_obj, 0, aligned_heap_ptr); SET(heap_obj, 0, (ptrdiff_t)aligned_heap_ptr);
#ifdef ARRAY_BROKEN #ifdef ARRAY_BROKEN
pagebase = ((gcptr_t)POINTER (heap_obj)) / PAGEBYTES; pagebase = ((gcptr_t)POINTER (heap_obj)) / PAGEBYTES;
@ -600,7 +600,7 @@ static int ExpandHeap (char *reason) {
else else
aligned_heap_ptr = heap_ptr; 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_first = firstpage;
new_last = lastpage; new_last = lastpage;
@ -911,7 +911,7 @@ Object Alloc_Object (size, type, konst) {
MAKE_HEADER (*current_freep, s, type); MAKE_HEADER (*current_freep, s, type);
current_freep++; current_freep++;
*current_freep = Null; *current_freep = Null;
SET (obj, type, current_freep); SET (obj, type, (ptrdiff_t)current_freep);
if (big) if (big)
current_freep = (Object*)0, current_free = 0; current_freep = (Object*)0, current_free = 0;
else else
@ -1018,7 +1018,7 @@ int Visit (register Object *cp) {
if (WAS_FORWARDED (*cp)) { if (WAS_FORWARDED (*cp)) {
if (pageaddr != 0) if (pageaddr != 0)
PROTECT (pageaddr); PROTECT (pageaddr);
MAKEOBJ (*cp, tag, POINTER(*obj_ptr)); MAKEOBJ (*cp, tag, (ptrdiff_t)POINTER(*obj_ptr));
if (konst) if (konst)
SETCONST (*cp); SETCONST (*cp);
return 0; return 0;
@ -1091,8 +1091,8 @@ do_forward:
MAKE_HEADER (*forward_freep, objwords, tag); MAKE_HEADER (*forward_freep, objwords, tag);
forward_freep++; forward_freep++;
memcpy (forward_freep, obj_ptr, (objwords-1)*sizeof(Object)); memcpy (forward_freep, obj_ptr, (objwords-1)*sizeof(Object));
SET (*obj_ptr, T_Broken_Heart, forward_freep); SET (*obj_ptr, T_Broken_Heart, (ptrdiff_t)forward_freep);
MAKEOBJ (*cp, tag, forward_freep); MAKEOBJ (*cp, tag, (ptrdiff_t)forward_freep);
if (konst) if (konst)
SETCONST (*cp); SETCONST (*cp);
forward_freep += (objwords - 1); forward_freep += (objwords - 1);
@ -1135,7 +1135,7 @@ static void ScanPage (Object *currentp, Object *nextcp) {
* words. * words.
*/ */
SET(obj, t, cp); SET(obj, t, (ptrdiff_t)cp);
switch (t) { switch (t) {
case T_Symbol: case T_Symbol:
@ -1540,7 +1540,7 @@ static void General_Collect (int initiate) {
fpage = next (fpage); fpage = next (fpage);
} }
current_freep = (Object *)PHYSPAGE (fpage); current_freep = (Object *)PHYSPAGE (fpage);
SET(obj, 0, current_freep); SET(obj, 0, (ptrdiff_t)current_freep);
current_freepage = OBJ_TO_PAGE (obj); current_freepage = OBJ_TO_PAGE (obj);
/* advance spaces. Then forward all objects directly accessible /* advance spaces. Then forward all objects directly accessible

View File

@ -55,7 +55,7 @@ void Call_After_GC () {
p->func(); p->func();
} }
void Visit_GC_List (GCNODE *list, int delta) { void Visit_GC_List (GCNODE *list, ptrdiff_t delta) {
register GCNODE *gp, *p; register GCNODE *gp, *p;
register int n; register int n;
register Object *vec; 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; register WIND *wp, *p;
for (wp = list; wp; wp = p->next) { for (wp = list; wp; wp = p->next) {