fix garbage collection for delays (report from Bart Demoen).

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@663 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-10-29 17:23:32 +00:00
parent ace4b58e5b
commit 6d8c592775
3 changed files with 28 additions and 4 deletions

View File

@ -403,7 +403,7 @@ mark_sus_record(sus_record *sg)
#ifdef MULTI_ASSIGNMENT_VARIABLES #ifdef MULTI_ASSIGNMENT_VARIABLES
total_marked++; total_marked++;
if (!IsAtomTerm((CELL)(sg->NS))) if (!IsAtomTerm((CELL)(sg->NS)))
mark_suspended_goal((CELL *)(sg->NS)); mark_sus_record(sg->NS);
MARK(((CELL *)&(sg->NS))); MARK(((CELL *)&(sg->NS)));
#endif #endif
} }
@ -417,6 +417,26 @@ static void mark_suspended_goal(CELL *orig)
} }
void
mark_all_suspended_goals(void)
{
sus_record *sg = GetSVarList();
if (sg == NULL)
return;
/* okay, we are on top of the list of variables. Let's burn rubber!
*/
while (sg != (sus_record *)TermNil) {
CELL tmp;
mark_sus_record(sg);
tmp = (CELL)(sg->NS);
if (MARKED(tmp))
sg = (sus_record *)UNMARK_CELL(tmp);
else
sg = (sus_record *)tmp;
}
}
/* /*
This routine does most of the work. It is called after This routine does most of the work. It is called after

View File

@ -2890,6 +2890,9 @@ marking_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max)
cont_top = (cont *)db_vec; cont_top = (cont *)db_vec;
/* These two must be marked first so that our trail optimisation won't lose /* These two must be marked first so that our trail optimisation won't lose
values */ values */
#ifdef COROUTINING
mark_all_suspended_goals();
#endif
mark_regs(old_TR); /* active registers & trail */ mark_regs(old_TR); /* active registers & trail */
#ifdef COROUTINING #ifdef COROUTINING
mark_delays(max); mark_delays(max);
@ -2967,7 +2970,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
int gc_verbose = is_gc_verbose(); int gc_verbose = is_gc_verbose();
tr_fr_ptr old_TR; tr_fr_ptr old_TR;
Int m_time, c_time, time_start, gc_time; Int m_time, c_time, time_start, gc_time;
#ifdef COROUTINING #if COROUTINING
CELL *max = (CELL *)ReadTimedVar(DelayedVars); CELL *max = (CELL *)ReadTimedVar(DelayedVars);
#else #else
CELL *max = NULL; CELL *max = NULL;
@ -2976,7 +2979,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
int gc_trace = FALSE; int gc_trace = FALSE;
#if COROUTINING #if COROUTINING
if (H0 - (CELL *)ReadTimedVar(DelayedVars) < 1024+(2*NUM_OF_ATTS)) { if (H0 - max < 1024+(2*NUM_OF_ATTS)) {
if (!growglobal(&current_env)) { if (!growglobal(&current_env)) {
Error(SYSTEM_ERROR, TermNil, ErrorMessage); Error(SYSTEM_ERROR, TermNil, ErrorMessage);
return FALSE; return FALSE;

View File

@ -10,7 +10,7 @@
* File: Yap.proto * * File: Yap.proto *
* mods: * * mods: *
* comments: Function declarations for YAP * * comments: Function declarations for YAP *
* version: $Id: Yapproto.h,v 1.25 2002-10-21 22:14:28 vsc Exp $ * * version: $Id: Yapproto.h,v 1.26 2002-10-29 17:23:32 vsc Exp $ *
*************************************************************************/ *************************************************************************/
/* prototype file for Yap */ /* prototype file for Yap */
@ -143,6 +143,7 @@ void STD_PROTO(InitCoroutPreds,(void));
#ifdef COROUTINING #ifdef COROUTINING
Term STD_PROTO(ListOfWokenGoals,(void)); Term STD_PROTO(ListOfWokenGoals,(void));
void STD_PROTO(WakeUp,(CELL *)); void STD_PROTO(WakeUp,(CELL *));
void STD_PROTO(mark_all_suspended_goals,(void));
#endif #endif
/* dbase.c */ /* dbase.c */