From 47e595a624ef409a97803e6ca516b3528888789f Mon Sep 17 00:00:00 2001 From: vsc Date: Thu, 26 Apr 2001 14:44:43 +0000 Subject: [PATCH] small fixes gc improvements WIN32 library fixes git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@18 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/heapgc.c | 38 +++++++++++++++++++++++++++++++++++++- Makefile.in | 4 ++-- changes4.3.html | 5 ++++- docs/yap.tex | 31 ++++++++++++++++++++----------- library/lists.yap | 4 ++++ library/regex/Makefile.in | 2 +- library/regex/regexp.c | 2 +- library/regex/utils.h | 2 +- library/ugraphs.yap | 2 +- 9 files changed, 71 insertions(+), 19 deletions(-) diff --git a/C/heapgc.c b/C/heapgc.c index 76df6ea10..aed9e7641 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -147,6 +147,8 @@ STATIC_PROTO(Int p_gc, (void)); #ifdef SIMPLE_SHUNTING static choiceptr current_B; + +static tr_fr_ptr sTR; #endif STATIC_PROTO(void push_registers, (Int, yamop *)); @@ -739,6 +741,10 @@ mark_variable(CELL_PTR current) current = next; } } + } else if (IsVarTerm(cnext) && UNMARK_CELL(cnext) != (CELL)next) { + /* This step is possible because we clean up the trail */ + *current = UNMARK_CELL(cnext); + total_marked--; } else #endif /* what I'd do without variable shunting */ @@ -1035,7 +1041,6 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B RESET_VARIABLE(&TrailVal(trail_ptr)); #endif #else - printf("should be doing early reset\n"); /* if I have no early reset I have to follow the trail chain */ mark_external_reference(&TrailTerm(trail_ptr)); UNMARK(&TrailTerm(trail_ptr)); @@ -1046,6 +1051,17 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B The point of doing so is to have dynamic arrays */ mark_external_reference(hp); } +#ifdef SIMPLE_SHUNTING + if (hp < gc_H && hp >= H0) { + CELL *cptr = (CELL *)trail_cell; + + TrailTerm(sTR) = *hp; + TrailTerm(sTR+1) = trail_cell; + sTR += 2; + RESET_VARIABLE(cptr); + MARK(cptr); + } +#endif #ifdef FROZEN_REGS mark_external_reference(&TrailVal(trail_ptr)); #endif @@ -2138,6 +2154,16 @@ compact_heap(void) } +#ifdef SIMPLE_SHUNTING +static void +set_conditionals(CELL *TRo) { + while (sTR != TRo) { + CELL *cptr = (CELL *)TrailTerm(sTR-1); + *cptr = TrailTerm(sTR-2); + sTR -= 2; + } +} +#endif /* @@ -2150,6 +2176,9 @@ marking_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max) { #ifdef SIMPLE_SHUNTING + tr_fr_ptr TRo; + sTR = (tr_fr_ptr)PreAllocCodeSpace(); + TRo = sTR; current_B = B; #endif init_dbtable(old_TR); @@ -2162,6 +2191,10 @@ marking_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max) /* active environments */ mark_environments(current_env, EnvSize(curp), EnvBMap((CELL *)curp)); mark_choicepoints(B, old_TR); /* choicepoints, and environs */ +#ifdef SIMPLE_SHUNTING + set_conditionals(TRo); + ReleasePreAllocCodeSpace((ADDR)sTR); +#endif } #ifdef COROUTINING @@ -2244,6 +2277,9 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop) YP_fprintf(YP_stderr, "[gc]\n"); } else if (gc_verbose) { YP_fprintf(YP_stderr, "[GC] Start of garbage collection %d:\n", gc_calls); +#ifndef EARLY_RESET + YP_fprintf(YP_stderr, "[GC] no early reset in trail\n"); +#endif YP_fprintf(YP_stderr, "[GC] Global: %8ld cells (%p-%p)\n", (long int)heap_cells,H0,H); YP_fprintf(YP_stderr, "[GC] Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); YP_fprintf(YP_stderr, "[GC] Trail:%8ld cells (%p-%p)\n", diff --git a/Makefile.in b/Makefile.in index 48b87f598..c23960dd4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -467,8 +467,8 @@ install_mingw32: $(INSTALL) $(srcdir)/include/c_interface.h $(DESTDIR)$(INCLUDEDIR)/c_interface.h $(INSTALL) config.h $(INCLUDEDIR)/config.h (cd $(srcdir) ; tar cf - library) | (cd $(DESTDIR)$(YAPLIBDIR) ; tar xf -) - $(INSTALL_DATA) $(srcdir)/LGPL/icon_address.pl $(DESTDIR)$(YAPLIBDIR)/library - $(INSTALL_DATA) $(srcdir)/LGPL/pillow.pl $(DESTDIR)$(YAPLIBDIR)/library + $(INSTALL_DATA) $(srcdir)/LGPL/pillow/icon_address.pl $(DESTDIR)$(YAPLIBDIR)/library + $(INSTALL_DATA) $(srcdir)/LGPL/pillow/pillow.pl $(DESTDIR)$(YAPLIBDIR)/library (cd $(srcdir)/CLPQR ; tar cf - .) | (cd $(DESTDIR)$(YAPLIBDIR)/library ; tar xf -) (cd $(srcdir)/CHR ; tar cf - .) | (cd $(DESTDIR)$(YAPLIBDIR)/library ; tar xf -) (cd library/regex; make install_mingw32) diff --git a/changes4.3.html b/changes4.3.html index 51cda48b8..6e0466092 100644 --- a/changes4.3.html +++ b/changes4.3.html @@ -6,6 +6,9 @@

Yap-4.3.19: