1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 16:00:22 +02:00

* __scm.h (SCM_STACK_PTR): New macro. (Cast argument through

(void *) in order to avoid an aliasing warning; thanks to Bruce
Korb.)

* stackchk.h (SCM_STACK_OVERFLOW_P): Use SCM_STACK_PTR.

* threads.c (suspend, launch_thread, scm_threads_mark_stacks): Use
SCM_STACK_PTR.

* threads.c (scm_threads_mark_stacks): Bugfix: Changed
thread->base --> t->base.

* eval.c (SCM_CEVAL): Don't cast argument of SCM_STACK_OVERFLOW_P.
This commit is contained in:
Mikael Djurfeldt 2003-05-22 09:16:33 +00:00
parent d97f609a4a
commit 79f55b7c6b
5 changed files with 32 additions and 14 deletions

View file

@ -1,3 +1,19 @@
2003-05-22 Mikael Djurfeldt <djurfeldt@nada.kth.se>
* __scm.h (SCM_STACK_PTR): New macro. (Cast argument through
(void *) in order to avoid an aliasing warning; thanks to Bruce
Korb.)
* stackchk.h (SCM_STACK_OVERFLOW_P): Use SCM_STACK_PTR.
* threads.c (suspend, launch_thread, scm_threads_mark_stacks): Use
SCM_STACK_PTR.
* threads.c (scm_threads_mark_stacks): Bugfix: Changed
thread->base --> t->base.
* eval.c (SCM_CEVAL): Don't cast argument of SCM_STACK_OVERFLOW_P.
2003-05-20 Marius Vollmer <marius.vollmer@uni-dortmund.de>
* deprecated.h, deprecated.c (scm_makstr, scm_makfromstr,

View file

@ -3,7 +3,7 @@
#ifndef SCM___SCM_H
#define SCM___SCM_H
/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002, 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -394,6 +394,10 @@ typedef short SCM_STACKITEM;
#else
typedef long SCM_STACKITEM;
#endif
/* Cast pointer through (void *) in order to avoid compiler warnings
when strict aliasing is enabled */
#define SCM_STACK_PTR(ptr) ((SCM_STACKITEM *) (void *) (ptr))
#define SCM_ASYNC_TICK /*fixme* should change names */ \

View file

@ -1962,8 +1962,7 @@ SCM_CEVAL (SCM x, SCM env)
scm_last_debug_frame = &debug;
#endif
#ifdef EVAL_STACK_CHECKING
if (scm_stack_checking_enabled_p
&& SCM_STACK_OVERFLOW_P ((SCM_STACKITEM *) &proc))
if (scm_stack_checking_enabled_p && SCM_STACK_OVERFLOW_P (&proc))
{
#ifdef DEVAL
debug.info->e.exp = x;

View file

@ -3,7 +3,7 @@
#ifndef SCM_STACKCHK_H
#define SCM_STACKCHK_H
/* Copyright (C) 1995,1996,1998,2000 Free Software Foundation, Inc.
/* Copyright (C) 1995,1996,1998,2000, 2003 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -36,10 +36,12 @@
#ifdef STACK_CHECKING
# if SCM_STACK_GROWS_UP
# define SCM_STACK_OVERFLOW_P(s)\
(s > ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) + SCM_STACK_LIMIT))
(SCM_STACK_PTR (s) \
> ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) + SCM_STACK_LIMIT))
# else
# define SCM_STACK_OVERFLOW_P(s)\
(s < ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) - SCM_STACK_LIMIT))
(SCM_STACK_PTR (s) \
< ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) - SCM_STACK_LIMIT))
# endif
# define SCM_CHECK_STACK\
{\

View file

@ -216,7 +216,7 @@ suspend ()
scm_thread *c = SCM_CURRENT_THREAD;
/* record top of stack for the GC */
c->top = (SCM_STACKITEM *)&c;
c->top = SCM_STACK_PTR (&c);
/* save registers. */
SCM_FLUSH_REGISTER_WINDOWS;
setjmp (c->regs);
@ -331,7 +331,7 @@ really_launch (SCM_STACKITEM *base, launch_data *data)
static void *
launch_thread (void *p)
{
really_launch ((SCM_STACKITEM *)&p, (launch_data *)p);
really_launch (SCM_STACK_PTR (&p), (launch_data *) p);
return 0;
}
@ -952,8 +952,7 @@ scm_threads_mark_stacks (void)
/* stack_len is long rather than sizet in order to guarantee
that &stack_len is long aligned */
#if SCM_STACK_GROWS_UP
stack_len = ((SCM_STACKITEM *) (&t) -
(SCM_STACKITEM *) thread->base);
stack_len = SCM_STACK_PTR (&t) - t->base;
/* Protect from the C stack. This must be the first marking
* done because it provides information about what objects
@ -973,8 +972,7 @@ scm_threads_mark_stacks (void)
scm_mark_locations (((size_t) t->base,
(sizet) stack_len));
#else
stack_len = ((SCM_STACKITEM *) t->base -
(SCM_STACKITEM *) (&t));
stack_len = t->base - SCM_STACK_PTR (&t);
/* Protect from the C stack. This must be the first marking
* done because it provides information about what objects
@ -991,8 +989,7 @@ scm_threads_mark_stacks (void)
((size_t) sizeof scm_save_regs_gc_mark
/ sizeof (SCM_STACKITEM)));
scm_mark_locations ((SCM_STACKITEM *) &t,
stack_len);
scm_mark_locations (SCM_STACK_PTR (&t), stack_len);
#endif
}
else