mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
* __scm.h, stackchk.h, stackchk.c: Guile now performs stack
checking.
This commit is contained in:
parent
b7ff98ddd6
commit
39f1ef511c
2 changed files with 25 additions and 16 deletions
|
@ -48,14 +48,14 @@
|
||||||
/* {Stack Checking}
|
/* {Stack Checking}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef SCM_STACK_CHECK
|
#ifdef STACK_CHECKING
|
||||||
int scm_check_stack_p;
|
int scm_stack_checking_enabled_p;
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_report_stack_overflow ()
|
scm_report_stack_overflow ()
|
||||||
{
|
{
|
||||||
scm_check_stack_p = 0;
|
scm_stack_checking_enabled_p = 0;
|
||||||
scm_wta (SCM_UNDEFINED, (char *) STACK_SCM_OVSCM_FLOW, NULL);
|
scm_wta (SCM_UNDEFINED, (char *) SCM_STACK_OVFLOW, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -104,9 +104,5 @@ void
|
||||||
scm_init_stackchk ()
|
scm_init_stackchk ()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef SCM_STACK_CHECK
|
|
||||||
scm_check_stack_p = 1;
|
|
||||||
#endif
|
|
||||||
#include "stackchk.x"
|
#include "stackchk.x"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,33 +47,46 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SCM_STACK_LIMIT
|
/* With debug extensions we have the possibility to use the debug options
|
||||||
# define SCM_STACK_CHECK
|
* to disable stack checking.
|
||||||
|
*/
|
||||||
|
#ifdef DEBUG_EXTENSIONS
|
||||||
|
#define SCM_STACK_CHECKING_P SCM_STACK_LIMIT
|
||||||
|
#else
|
||||||
|
/* *fixme* This option should be settable also without debug extensions. */
|
||||||
|
#define SCM_STACK_LIMIT 100000
|
||||||
|
#define SCM_STACK_CHECKING_P 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STACK_CHECKING
|
||||||
# ifdef SCM_STACK_GROWS_UP
|
# ifdef SCM_STACK_GROWS_UP
|
||||||
# define SCM_STACK_OVERFLOW_P(s) (s - SCM_BASE (rootcont) > SCM_STACK_LIMIT * sizeof (SCM_STACKITEM))
|
# define SCM_STACK_OVERFLOW_P(s)\
|
||||||
|
(s - SCM_BASE (scm_rootcont) > SCM_STACK_LIMIT * sizeof (SCM_STACKITEM))
|
||||||
# else
|
# else
|
||||||
# define SCM_STACK_OVERFLOW_P(s) (SCM_BASE (rootcont) - s > SCM_STACK_LIMIT * sizeof (SCM_STACKITEM))
|
# define SCM_STACK_OVERFLOW_P(s)\
|
||||||
|
(SCM_BASE (scm_rootcont) - s > SCM_STACK_LIMIT * sizeof (SCM_STACKITEM))
|
||||||
# endif
|
# endif
|
||||||
# define SCM_CHECK_STACK\
|
# define SCM_CHECK_STACK\
|
||||||
{\
|
{\
|
||||||
SCM_STACKITEM stack;\
|
SCM_STACKITEM stack;\
|
||||||
if (SCM_STACK_OVERFLOW_P (&stack) && scm_check_stack_p)\
|
if (SCM_STACK_OVERFLOW_P (&stack) && scm_stack_checking_enabled_p)\
|
||||||
scm_report_stack_overflow ();\
|
scm_report_stack_overflow ();\
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define SCM_CHECK_STACK /**/
|
# define SCM_CHECK_STACK /**/
|
||||||
#endif /* def SCM_STACK_LIMIT */
|
#endif /* STACK_CHECKING */
|
||||||
|
|
||||||
|
extern int scm_stack_checking_enabled_p;
|
||||||
extern int scm_check_stack_p;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
|
extern void scm_report_stack_overflow (void);
|
||||||
extern long scm_stack_size (SCM_STACKITEM *start);
|
extern long scm_stack_size (SCM_STACKITEM *start);
|
||||||
extern void scm_stack_report (void);
|
extern void scm_stack_report (void);
|
||||||
extern void scm_init_stackchk (void);
|
extern void scm_init_stackchk (void);
|
||||||
|
|
||||||
#else /* STDC */
|
#else /* STDC */
|
||||||
|
extern void scm_report_stack_overflow ();
|
||||||
extern long scm_stack_size ();
|
extern long scm_stack_size ();
|
||||||
extern void scm_stack_report ();
|
extern void scm_stack_report ();
|
||||||
extern void scm_init_stackchk ();
|
extern void scm_init_stackchk ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue