From 28ba64be9496347f6d2c3d5732fe91dd0ddb13d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Fri, 7 May 2010 23:49:20 +0100 Subject: [PATCH] fix garbage collector for attributed variables. --- C/heapgc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/C/heapgc.c b/C/heapgc.c index cf9f7c079..5a98f1e3e 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -1650,11 +1650,24 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B } else { if (trail_cell == (CELL)trail_base) discard_trail_entries++; -#ifdef FROZEN_STACKS else { + /* This is a bit of a mess: when I find an attributed variable that was bound + nondeterministically, I know that after backtracking it will be back to be an unbound variable. + The ideal solution would be to unbind all variables. The current solution is to + remark it as an attributed variable */ + if (IsAttVar(hp) && !UNMARKED_MARK(hp-1,Yap_bp)) { + total_marked++; + PUSH_POINTER(hp-1); + if (hp-1 < HGEN) { + total_oldies++; + } + mark_variable(hp+1); + mark_variable(hp+2); + } +#ifdef FROZEN_STACKS mark_external_reference(&TrailVal(trail_base)); - } #endif + } #ifdef EASY_SHUNTING if (hp < gc_H && hp >= H0 && !MARKED_PTR(hp)) { tr_fr_ptr nsTR = (tr_fr_ptr)cont_top0;