call garbage collection at every proceed.

don't try to expand indices on static predicates.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@876 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-09-24 23:53:48 +00:00
parent 1f2fb8284a
commit 99cfccfaf0
4 changed files with 43 additions and 17 deletions

View File

@ -2159,8 +2159,17 @@ Yap_absmi(int inp)
/* also, this is unusual in that I have already done deallocate,
so I don't need to redo it.
*/
NoStackDeallocate:
NoStackProceed:
if (CFREG == (CELL)(LCL0+2)) {
/*
we're not actually doing debugging here, just execute
instruction and go on.
*/
PREG = CPREG;
YREG = ENV;
#ifdef DEPTH_LIMIT
DEPTH = YREG[E_DEPTH];
#endif
JMPNext();
}
ASP = YREG;
@ -2557,12 +2566,19 @@ Yap_absmi(int inp)
JMPNext();
BOp(procceed, e);
PREG = CPREG;
YREG = ENV;
#ifdef DEPTH_LIMIT
DEPTH = YREG[E_DEPTH];
CACHE_Y_AS_ENV(YREG);
#ifndef NO_CHECKING
/* check stacks */
check_stack(NoStackProceed, H);
#endif
PREG = CPREG;
E_YREG = ENV;
#ifdef DEPTH_LIMIT
DEPTH = E_YREG[E_DEPTH];
#endif
WRITEBACK_Y_AS_ENV();
JMPNext();
ENDCACHE_Y_AS_ENV();
ENDBOp();
Op(allocate, e);
@ -2605,13 +2621,6 @@ Yap_absmi(int inp)
else
E_YREG = (CELL *) ((CELL) E_YREG + ENV_Size(CPREG));
#endif /* FROZEN_STACKS */
#ifndef NO_CHECKING
if (Yap_do_low_level_trace) {
fprintf(stderr, "H is %p, YENV is %p\n", H, YENV);
}
/* check stacks */
check_stack(NoStackDeallocate, H);
#endif
WRITEBACK_Y_AS_ENV();
ENDCACHE_Y_AS_ENV();
GONext();

View File

@ -553,7 +553,6 @@ static char *opformat[] =
"jump\t\t%l",
"jump\t\t%l",
"proceed",
"safe_proceed",
"call\t\t%p,%d,%z",
"execute\t\t%p",
"sys\t\t%p",

View File

@ -43,6 +43,10 @@ static Int tot_gc_recovered = 0; /* number of heap objects in all garbage c
/* in a single gc */
static unsigned long int total_marked; /* number of heap objects marked */
#ifdef COROUTINING
static unsigned long int total_smarked;
#endif
struct gc_ma_h_entry *live_list;
STATIC_PROTO(Int p_inform_gc, (void));
@ -876,15 +880,18 @@ mark_variable(CELL_PTR current)
current = next;
}
goto begin;
}
#ifdef DEBUG
else if (next < (CELL *)AtomBase || next < (CELL *)HeapTop)
} else if (next < (CELL *)AtomBase || next < (CELL *)HeapTop) {
fprintf(Yap_stderr, "ooops while marking %lx, %p at %p\n", (unsigned long int)ccur, current, next);
#endif
} else {
#ifdef COROUTING
total_smarked++;
#endif
#ifdef INSTRUMENT_GC
else
inc_var(current, next);
#endif
}
POP_CONTINUATION();
} else if (IsPairTerm(ccur)) {
#ifdef INSTRUMENT_GC
@ -2954,7 +2961,11 @@ compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max)
sweep_trail(B, old_TR);
#ifdef HYBRID_SCHEME
#ifdef DEBUG
if (total_marked != iptop-(CELL_PTR *)H && iptop < (CELL_PTR *)ASP -1024)
if (total_marked
#ifdef COROUTINING
-total_smarked
#endif
!= iptop-(CELL_PTR *)H && iptop < (CELL_PTR *)ASP -1024)
fprintf(Yap_stderr,"[GC] Oops on iptop-H (%ld) vs %ld\n", (unsigned long int)(iptop-(CELL_PTR *)H), total_marked);
#endif
if (iptop < (CELL_PTR *)ASP && 10*total_marked < H-H0) {
@ -3059,6 +3070,9 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
}
time_start = Yap_cputime();
total_marked = 0;
#ifdef COROUTING
total_smarked = 0;
#endif
discard_trail_entries = 0;
#ifdef HYBRID_SCHEME
iptop = (CELL_PTR *)H;

View File

@ -5427,6 +5427,10 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
path_stack_entry *stack, *sp;
int cb;
if (!(ap->PredFlags & LogUpdatePredFlag)) {
Yap_RemoveIndexation(ap);
return;
}
if ((cb = setjmp(Yap_CompilerBotch)) == 3) {
restore_machine_regs();
Yap_gcl(Yap_Error_Size, ap->ArityOfPE, ENV, CP);