all tests passes

parent 21a3487a
......@@ -35,6 +35,12 @@ struct gp_stack
SCM gp_setup;
};
static inline is_cs(SCM num, struct gp_stack *gp)
{
SCM *i = NUM2PTR(num);
return (i >= gp->gp_cons_stack) && (i < gp->gp_nncs);
}
static inline struct gp_stack *get_gp(SCM s)
{
if(SCM_CONSP(s))
......
......@@ -239,8 +239,8 @@ static inline void gp_unwind0(SCM *ci, SCM *si, SCM *cs, struct gp_stack *gp)
{
// ------------------- Code for stack pointers -----------------
if(2 & SCM_UNPACK(*i))
{
if(2 & SCM_UNPACK(*(i-1)))
{
if((2 & SCM_UNPACK(*(i-1))) && is_cs(*i,gp))
{
SCM *cs2 = NUM2PTR(*i);
if(i-1 < gp->gp_ci)
......@@ -950,7 +950,8 @@ static void gp_restore_state(SCM data, struct gp_stack *gp)
{
gp_debug0("m > n\n");
ci_x = gp->gp_ci - (m - n) - 1;
if( (2 & SCM_UNPACK(ci_x[1])) && (2 & SCM_UNPACK(ci_x[0])))
if( (2 & SCM_UNPACK(ci_x[1])) && (2 & SCM_UNPACK(ci_x[0]))
&& is_cs(ci_x[1],gp))
{
gp_debug0("potential reference split");
ci_x --;
......@@ -983,6 +984,9 @@ static void gp_restore_state(SCM data, struct gp_stack *gp)
ci = gp_get_branch(&pp_x, ci_x, gp);
gp_debug0("unwind\n");
if((2 & SCM_UNPACK(ci[0])) && (2 & SCM_UNPACK(ci[1])) && is_cs(ci[1], gp))
scm_misc_error("gp_restore_state","split start of unwind",SCM_EOL);
gp_unwind0(ci + 1, si, cs, gp);
gp_debug0("rewind\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment