agc should not be called from gc
agc should not crash on tabled execution. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1851 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
		
							
								
								
									
										24
									
								
								C/agc.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								C/agc.c
									
									
									
									
									
								
							@@ -227,18 +227,20 @@ mark_atoms(void)
 | 
			
		||||
static void
 | 
			
		||||
mark_trail(void)
 | 
			
		||||
{
 | 
			
		||||
  register CELL *pt;
 | 
			
		||||
  register tr_fr_ptr pt;
 | 
			
		||||
 | 
			
		||||
  pt = (CELL *)TR;
 | 
			
		||||
  pt = TR;
 | 
			
		||||
  /* moving the trail is simple */
 | 
			
		||||
  while (pt != (CELL *)Yap_TrailBase) {
 | 
			
		||||
    register CELL reg = pt[-1];
 | 
			
		||||
    pt--;
 | 
			
		||||
  while (pt != (tr_fr_ptr)Yap_TrailBase) {
 | 
			
		||||
    CELL reg = TrailTerm(pt-1);
 | 
			
		||||
 | 
			
		||||
    if (!IsVarTerm(reg)) {
 | 
			
		||||
      if (IsAtomTerm(reg)) {
 | 
			
		||||
	MarkAtomEntry(RepAtom(AtomOfTerm(reg)));
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pt--;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -254,12 +256,16 @@ mark_local(void)
 | 
			
		||||
    CELL reg = *--pt;
 | 
			
		||||
 | 
			
		||||
    if (!IsVarTerm(reg)) {
 | 
			
		||||
      if (IsAtomTerm(reg)) {
 | 
			
		||||
      if (IsAtomTerm(reg)
 | 
			
		||||
#if TABLING
 | 
			
		||||
	  /* assume we cannot have atoms on first page,
 | 
			
		||||
	     so this must be an arity
 | 
			
		||||
	  */
 | 
			
		||||
	  && reg > Yap_page_size
 | 
			
		||||
#endif
 | 
			
		||||
	  ) {
 | 
			
		||||
	MarkAtomEntry(RepAtom(AtomOfTerm(reg)));
 | 
			
		||||
      }
 | 
			
		||||
    } else if (IsApplTerm(reg)) {
 | 
			
		||||
      Functor f = FunctorOfTerm(reg);
 | 
			
		||||
      FuncAdjust(f);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3772,7 +3772,6 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop)
 | 
			
		||||
      (ASP-H0)*sizeof(CELL) > gc_lim &&
 | 
			
		||||
      H-H0 > (LCL0-ASP)/2) {
 | 
			
		||||
    effectiveness = do_gc(predarity, current_env, nextop);
 | 
			
		||||
    Yap_atom_gc();
 | 
			
		||||
    if (effectiveness < 0)
 | 
			
		||||
      return FALSE;
 | 
			
		||||
    if (effectiveness > 90) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user