mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 14:50:19 +02:00
* throw.c: Added #include "stackchk.h"
(scm_catch): Changed SCM_DEFER_INTS --> SCM_REDEFER_INTS and SCM_ALLOW_INTS --> SCM_REALLOW_INTS. This is so that scm_catch can be used in scm_call_with_new_root; Added reenabling of stack checking when catching a throw.
This commit is contained in:
parent
317607b0df
commit
7f759d7993
1 changed files with 10 additions and 7 deletions
|
@ -51,6 +51,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#endif
|
#endif
|
||||||
#include "continuations.h"
|
#include "continuations.h"
|
||||||
|
#include "stackchk.h"
|
||||||
|
|
||||||
#include "throw.h"
|
#include "throw.h"
|
||||||
|
|
||||||
|
@ -115,7 +116,7 @@ make_jmpbuf ()
|
||||||
{
|
{
|
||||||
SCM answer;
|
SCM answer;
|
||||||
SCM_NEWCELL (answer);
|
SCM_NEWCELL (answer);
|
||||||
SCM_DEFER_INTS;
|
SCM_REDEFER_INTS;
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_EXTENSIONS
|
#ifdef DEBUG_EXTENSIONS
|
||||||
char *mem = scm_must_malloc (sizeof (scm_cell), "jb");
|
char *mem = scm_must_malloc (sizeof (scm_cell), "jb");
|
||||||
|
@ -125,11 +126,10 @@ make_jmpbuf ()
|
||||||
SETJBJMPBUF(answer, (jmp_buf *)0);
|
SETJBJMPBUF(answer, (jmp_buf *)0);
|
||||||
DEACTIVATEJB(answer);
|
DEACTIVATEJB(answer);
|
||||||
}
|
}
|
||||||
SCM_ALLOW_INTS;
|
SCM_REALLOW_INTS;
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct jmp_buf_and_retval /* use only on the stack, in scm_catch */
|
struct jmp_buf_and_retval /* use only on the stack, in scm_catch */
|
||||||
{
|
{
|
||||||
jmp_buf buf; /* must be first */
|
jmp_buf buf; /* must be first */
|
||||||
|
@ -162,10 +162,13 @@ scm_catch (tag, thunk, handler)
|
||||||
SCM throw_tag;
|
SCM throw_tag;
|
||||||
SCM throw_args;
|
SCM throw_args;
|
||||||
|
|
||||||
SCM_DEFER_INTS;
|
#ifdef STACK_CHECKING
|
||||||
|
scm_stack_checking_enabled_p = SCM_STACK_CHECKING_P;
|
||||||
|
#endif
|
||||||
|
SCM_REDEFER_INTS;
|
||||||
DEACTIVATEJB (jmpbuf);
|
DEACTIVATEJB (jmpbuf);
|
||||||
scm_dynwinds = SCM_CDR (scm_dynwinds);
|
scm_dynwinds = SCM_CDR (scm_dynwinds);
|
||||||
SCM_ALLOW_INTS;
|
SCM_REALLOW_INTS;
|
||||||
throw_args = jbr.retval;
|
throw_args = jbr.retval;
|
||||||
throw_tag = jbr.throw_tag;
|
throw_tag = jbr.throw_tag;
|
||||||
jbr.throw_tag = SCM_EOL;
|
jbr.throw_tag = SCM_EOL;
|
||||||
|
@ -178,10 +181,10 @@ scm_catch (tag, thunk, handler)
|
||||||
answer = scm_apply (thunk,
|
answer = scm_apply (thunk,
|
||||||
((tag == SCM_BOOL_F) ? scm_cons (jmpbuf, SCM_EOL) : SCM_EOL),
|
((tag == SCM_BOOL_F) ? scm_cons (jmpbuf, SCM_EOL) : SCM_EOL),
|
||||||
SCM_EOL);
|
SCM_EOL);
|
||||||
SCM_DEFER_INTS;
|
SCM_REDEFER_INTS;
|
||||||
DEACTIVATEJB (jmpbuf);
|
DEACTIVATEJB (jmpbuf);
|
||||||
scm_dynwinds = SCM_CDR (scm_dynwinds);
|
scm_dynwinds = SCM_CDR (scm_dynwinds);
|
||||||
SCM_ALLOW_INTS;
|
SCM_REALLOW_INTS;
|
||||||
}
|
}
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue