be more careful about marking attributed variables:
- only mark unbound attributed variables in first step. - remove deterministic bindings for those variables. - mark non-deterministic bindings at mark_trail.
This commit is contained in:
parent
17ba194c1e
commit
05f93cd4e6
37
C/heapgc.c
37
C/heapgc.c
@ -1594,11 +1594,26 @@ mark_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
mark_att_var(CELL *hp)
|
||||||
|
{
|
||||||
|
int relpos = ((CELL *)Yap_GlobalBase-hp)%3;
|
||||||
|
attvar_record *attv = (attvar_record *)(hp-relpos);
|
||||||
|
mark_external_reference2(&attv->Done);
|
||||||
|
mark_external_reference2(&attv->Value);
|
||||||
|
mark_external_reference2(&attv->Atts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B)
|
mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B)
|
||||||
{
|
{
|
||||||
#ifdef EASY_SHUNTING
|
#ifdef EASY_SHUNTING
|
||||||
tr_fr_ptr begsTR = NULL, endsTR = NULL;
|
tr_fr_ptr begsTR = NULL, endsTR = NULL;
|
||||||
|
#endif
|
||||||
|
#ifdef COROUTINING
|
||||||
|
CELL *detatt = NULL;
|
||||||
#endif
|
#endif
|
||||||
cont *old_cont_top0 = cont_top0;
|
cont *old_cont_top0 = cont_top0;
|
||||||
|
|
||||||
@ -1633,6 +1648,14 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
|
|||||||
RESET_VARIABLE(&TrailVal(trail_base));
|
RESET_VARIABLE(&TrailVal(trail_base));
|
||||||
#endif
|
#endif
|
||||||
discard_trail_entries++;
|
discard_trail_entries++;
|
||||||
|
} else {
|
||||||
|
if ( hp > (CELL*)Yap_GlobalBase && hp < H0) {
|
||||||
|
if (!detatt || hp >= detatt) {
|
||||||
|
mark_att_var(hp);
|
||||||
|
} else {
|
||||||
|
trail_cell = TrailTerm(trail_base) = (CELL)trail_base;
|
||||||
|
discard_trail_entries++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (trail_cell == (CELL)trail_base)
|
if (trail_cell == (CELL)trail_base)
|
||||||
discard_trail_entries++;
|
discard_trail_entries++;
|
||||||
@ -1641,6 +1664,7 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
|
|||||||
mark_external_reference(&TrailVal(trail_base));
|
mark_external_reference(&TrailVal(trail_base));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
#ifdef EASY_SHUNTING
|
#ifdef EASY_SHUNTING
|
||||||
if (hp < gc_H && hp >= H0) {
|
if (hp < gc_H && hp >= H0) {
|
||||||
tr_fr_ptr nsTR = (tr_fr_ptr)cont_top0;
|
tr_fr_ptr nsTR = (tr_fr_ptr)cont_top0;
|
||||||
@ -1685,6 +1709,16 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
|
|||||||
*/
|
*/
|
||||||
if (cptr < (CELL *)gc_B && cptr >= gc_H) {
|
if (cptr < (CELL *)gc_B && cptr >= gc_H) {
|
||||||
goto remove_trash_entry;
|
goto remove_trash_entry;
|
||||||
|
} else if (!detatt && cptr == RepAppl(DelayedVars)+1) {
|
||||||
|
detatt = cptr;
|
||||||
|
} else if (cptr > (CELL*)Yap_GlobalBase && cptr < H0) {
|
||||||
|
/* MABINDING that should be recovered */
|
||||||
|
if (detatt && cptr >= detatt) {
|
||||||
|
goto remove_trash_entry;
|
||||||
|
} else {
|
||||||
|
/* This attributed variable is still in play */
|
||||||
|
mark_att_var(cptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!gc_lookup_ma_var(cptr, trail_base)) {
|
if (!gc_lookup_ma_var(cptr, trail_base)) {
|
||||||
/* check whether this is the first time we see it*/
|
/* check whether this is the first time we see it*/
|
||||||
@ -1809,10 +1843,13 @@ mark_delays(attvar_record *top, attvar_record *bottom)
|
|||||||
{
|
{
|
||||||
attvar_record *attv = (attvar_record *)top;
|
attvar_record *attv = (attvar_record *)top;
|
||||||
for (; attv < bottom; attv++) {
|
for (; attv < bottom; attv++) {
|
||||||
|
/* only mark what is accessible */
|
||||||
|
if (IsVarTerm(attv->Done) && IsUnboundVar(&attv->Done)) {
|
||||||
mark_external_reference2(&attv->Done);
|
mark_external_reference2(&attv->Done);
|
||||||
mark_external_reference2(&attv->Value);
|
mark_external_reference2(&attv->Value);
|
||||||
mark_external_reference2(&attv->Atts);
|
mark_external_reference2(&attv->Atts);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define mark_delays(T,B)
|
#define mark_delays(T,B)
|
||||||
|
Reference in New Issue
Block a user