Skip to content

Commit

Permalink
WIP, re issue #305
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed Aug 16, 2024
1 parent 958374c commit d47e704
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,11 @@ static void reuse_frame(query *q, const clause *cl)

frame *f = GET_CURR_FRAME();
f->initial_slots = f->actual_slots = cl->nbr_vars;
f->has_local_vars = cl->has_local_vars;
f->no_tco = q->no_tco;
f->chgen = ++q->chgen;
f->heap_nbr = q->st.heap_nbr;
f->hp = q->st.hp;
f->overflow = 0;

const frame *newf = GET_FRAME(q->st.fp);
Expand Down Expand Up @@ -898,7 +902,7 @@ static bool resume_frame(query *q)

if (q->pl->opt
&& (!f->has_local_vars || !q->in_call)
&& !f->no_tco
&& !f->no_tco && 0
&& (q->st.fp == (q->st.curr_frame + 1))
&& (!q->cp || !resume_any_choices(q, f))
) {
Expand Down
4 changes: 3 additions & 1 deletion src/unify.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ static void set_var(query *q, const cell *c, pl_idx c_ctx, cell *v, pl_idx v_ctx
if (is_var(v)) {
make_ref(&e->c, v->var_nbr, v_ctx);

if (c_ctx == q->st.fp) {
if ((c_ctx != q->st.curr_frame) && (v_ctx == q->st.curr_frame)) {
q->no_tco = true;
} else if (v_ctx == q->st.fp) {
q->no_tco = true;
}
} else if (is_compound(v)) {
Expand Down

0 comments on commit d47e704

Please sign in to comment.