small fixes

gc improvements
WIN32 library fixes


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@18 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2001-04-26 14:44:43 +00:00
parent 6f3d55651c
commit 47e595a624
9 changed files with 71 additions and 19 deletions

View File

@ -147,6 +147,8 @@ STATIC_PROTO(Int p_gc, (void));
#ifdef SIMPLE_SHUNTING #ifdef SIMPLE_SHUNTING
static choiceptr current_B; static choiceptr current_B;
static tr_fr_ptr sTR;
#endif #endif
STATIC_PROTO(void push_registers, (Int, yamop *)); STATIC_PROTO(void push_registers, (Int, yamop *));
@ -739,6 +741,10 @@ mark_variable(CELL_PTR current)
current = next; 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 } else
#endif #endif
/* what I'd do without variable shunting */ /* 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)); RESET_VARIABLE(&TrailVal(trail_ptr));
#endif #endif
#else #else
printf("should be doing early reset\n");
/* if I have no early reset I have to follow the trail chain */ /* if I have no early reset I have to follow the trail chain */
mark_external_reference(&TrailTerm(trail_ptr)); mark_external_reference(&TrailTerm(trail_ptr));
UNMARK(&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 */ The point of doing so is to have dynamic arrays */
mark_external_reference(hp); 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 #ifdef FROZEN_REGS
mark_external_reference(&TrailVal(trail_ptr)); mark_external_reference(&TrailVal(trail_ptr));
#endif #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 #ifdef SIMPLE_SHUNTING
tr_fr_ptr TRo;
sTR = (tr_fr_ptr)PreAllocCodeSpace();
TRo = sTR;
current_B = B; current_B = B;
#endif #endif
init_dbtable(old_TR); init_dbtable(old_TR);
@ -2162,6 +2191,10 @@ marking_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max)
/* active environments */ /* active environments */
mark_environments(current_env, EnvSize(curp), EnvBMap((CELL *)curp)); mark_environments(current_env, EnvSize(curp), EnvBMap((CELL *)curp));
mark_choicepoints(B, old_TR); /* choicepoints, and environs */ mark_choicepoints(B, old_TR); /* choicepoints, and environs */
#ifdef SIMPLE_SHUNTING
set_conditionals(TRo);
ReleasePreAllocCodeSpace((ADDR)sTR);
#endif
} }
#ifdef COROUTINING #ifdef COROUTINING
@ -2244,6 +2277,9 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
YP_fprintf(YP_stderr, "[gc]\n"); YP_fprintf(YP_stderr, "[gc]\n");
} else if (gc_verbose) { } else if (gc_verbose) {
YP_fprintf(YP_stderr, "[GC] Start of garbage collection %d:\n", gc_calls); 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] 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] Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
YP_fprintf(YP_stderr, "[GC] Trail:%8ld cells (%p-%p)\n", YP_fprintf(YP_stderr, "[GC] Trail:%8ld cells (%p-%p)\n",

View File

@ -467,8 +467,8 @@ install_mingw32:
$(INSTALL) $(srcdir)/include/c_interface.h $(DESTDIR)$(INCLUDEDIR)/c_interface.h $(INSTALL) $(srcdir)/include/c_interface.h $(DESTDIR)$(INCLUDEDIR)/c_interface.h
$(INSTALL) config.h $(INCLUDEDIR)/config.h $(INSTALL) config.h $(INCLUDEDIR)/config.h
(cd $(srcdir) ; tar cf - library) | (cd $(DESTDIR)$(YAPLIBDIR) ; tar xf -) (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/icon_address.pl $(DESTDIR)$(YAPLIBDIR)/library
$(INSTALL_DATA) $(srcdir)/LGPL/pillow.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)/CLPQR ; tar cf - .) | (cd $(DESTDIR)$(YAPLIBDIR)/library ; tar xf -)
(cd $(srcdir)/CHR ; 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) (cd library/regex; make install_mingw32)

View File

@ -6,6 +6,9 @@
<H2 ALIGN=CENTER>Yap-4.3.19:</H2> <H2 ALIGN=CENTER>Yap-4.3.19:</H2>
<UL> <UL>
<LI> FIXED: change first two arguments of add_vertices/3 for
SICStus compatibility (report from Nicos Angelopoulos).
<LI> NEW: sum_list/2 (request from Nicos Angelopoulos).
<LI> FIXED: ord_union/2 should not use use merge/3 but instead <LI> FIXED: ord_union/2 should not use use merge/3 but instead
ord_union/3 (report from Nicos Angelopoulos). ord_union/3 (report from Nicos Angelopoulos).
<LI> FIXED: statistics/0 should report to user_error (report from Nicos <LI> FIXED: statistics/0 should report to user_error (report from Nicos
@ -13,7 +16,7 @@
<LI> FIXED: database could copy compiled floats,longs, and bigs <LI> FIXED: database could copy compiled floats,longs, and bigs
to Heap, later crashing the garbage collector (report from Nicos to Heap, later crashing the garbage collector (report from Nicos
Angelopoulos). Angelopoulos).
<LI> NEW: if/3. <LI> NEW: if/3 (request from Nicos Angelopoulos)..
<LI> SPEEDUP: inline functor(S) -> Na,Ar. <LI> SPEEDUP: inline functor(S) -> Na,Ar.
<LI> SPEEDUP: inline functor(Na,Ar) -> S. <LI> SPEEDUP: inline functor(Na,Ar) -> S.
<LI> FIXED: pillow installation path. <LI> FIXED: pillow installation path.

View File

@ -4601,7 +4601,7 @@ currently defined atoms by backtracking.
@cyindex current_predicate/1 @cyindex current_predicate/1
@var{F} is the predicate indicator for a currently defined user or @var{F} is the predicate indicator for a currently defined user or
library predicate. @var{F} is of the form @var{Na/Ar}, where the atom library predicate. @var{F} is of the form @var{Na/Ar}, where the atom
@var{A} is the name of the predicate, and @var{Ar} its arity. @var{Na} is the name of the predicate, and @var{Ar} its arity.
@item current_predicate(@var{A},@var{P}) @item current_predicate(@var{A},@var{P})
@findex current_predicate/2 @findex current_predicate/2
@ -6524,11 +6524,19 @@ True when both @code{append(_,Sublist,S)} and @code{append(S,_,List)} hold.
@cnindex suffix/2 @cnindex suffix/2
Holds when @code{append(_,Suffix,List)} holds. Holds when @code{append(_,Suffix,List)} holds.
@item sum_list(?@var{Numbers}, ?@var{Total})
@findex sum_list/2
@snindex sum_list/2
@cnindex sum_list/2
True when @var{Numbers} is a list of integers, and @var{Total} is their sum.
@item sumlist(?@var{Numbers}, ?@var{Total}) @item sumlist(?@var{Numbers}, ?@var{Total})
@findex sumlist/2 @findex sumlist/2
@syindex sumlist/2 @syindex sumlist/2
@cnindex sumlist/2 @cnindex sumlist/2
True when @var{Numbers} is a list of integers, and @var{Total} is their sum. True when @var{Numbers} is a list of integers, and @var{Total} is their
sum. The same as @code{sum_list/2}, please do use @code{sum_list/2}
instead.
@end table @end table
@ -6581,10 +6589,10 @@ Removing @var{Element} from @var{Set1} returns @var{Set2}.
@cnindex ord_disjoint/2 @cnindex ord_disjoint/2
Holds when the two ordered sets have no element in common. Holds when the two ordered sets have no element in common.
@item ord_element(+@var{Element}, +@var{Set}) @item ord_member(+@var{Element}, +@var{Set})
@findex ord_element/2 @findex ord_member/2
@syindex ord_element/2 @syindex ord_member/2
@cnindex ord_element/2 @cnindex ord_member/2
Holds when @var{Element} is a member of @var{Set}. Holds when @var{Element} is a member of @var{Set}.
@item ord_insert(+@var{Set1}, +@var{Element}, ?@var{Set2}) @item ord_insert(+@var{Set1}, +@var{Element}, ?@var{Set2})
@ -7425,16 +7433,17 @@ Unify @var{Edges} with all edges appearing in graph
L = [1,2,3,4,5] L = [1,2,3,4,5]
@end example @end example
@item add_vertices(+@var{Vertices}, +@var{Graph}, -@var{NewGraph}) @item add_vertices(+@var{Graph}, +@var{Vertices}, -@var{NewGraph})
@findex add_vertices/3 @findex add_vertices/3
@syindex add_vertices/3 @syindex add_vertices/3
@cnindex add_vertices/3 @cnindex add_vertices/3
Unify @var{NewGraph} with a new graph obtained by adding the list of Unify @var{NewGraph} with a new graph obtained by adding the list of
vertices @var{Vertices} to the graph @var{Graph}. In the next example: vertices @var{Vertices} to the graph @var{Graph}. In the next example:
@example @example
?- add_vertices([0,2,9,10,11], ?- add_vertices([1-[3,5],2-[4],3-[],4-[5],
[1-[3,5],2-[4],3-[],4-[5], 5-[],6-[],7-[],8-[]],
5-[],6-[],7-[],8-[]], NG). [0,2,9,10,11],
NG).
NG = [0-[],1-[3,5],2-[4],3-[],4-[5],5-[], NG = [0-[],1-[3,5],2-[4],3-[],4-[5],5-[],
6-[],7-[],8-[],9-[],10-[],11-[]] 6-[],7-[],8-[],9-[],10-[],11-[]]
@ -9189,7 +9198,7 @@ SICStus. In order to keep the users of the eval-quote variant happy, we
provide a source transformation package. It is activated via: provide a source transformation package. It is activated via:
@example @example
| ?- use.module(library('clpqr/expand')). | ?- use_module(library('clpqr/expand')).
@end example @end example
Loading the package puts you in a mode where the arithmetic functors Loading the package puts you in a mode where the arithmetic functors

View File

@ -22,6 +22,7 @@
select/3, select/3,
sublist/2, sublist/2,
substitute/4, substitute/4,
sum_list/2,
suffix/2, suffix/2,
sumlist/2, sumlist/2,
list_concat/2 list_concat/2
@ -262,6 +263,9 @@ suffix(Suffix, [_|List]) :-
sumlist(Numbers, Total) :- sumlist(Numbers, Total) :-
sumlist(Numbers, 0, Total). sumlist(Numbers, 0, Total).
sum_list(Numbers, Total) :-
sumlist(Numbers, 0, Total).
sumlist([], Total, Total). sumlist([], Total, Total).
sumlist([Head|Tail], Sofar, Total) :- sumlist([Head|Tail], Sofar, Total) :-
Next is Sofar+Head, Next is Sofar+Head,

View File

@ -88,7 +88,7 @@ regexec.so: regexec.o
# #
DLLTOOL=dlltool DLLTOOL=dlltool
DLLNAME=regexp.dll DLLNAME=regexp.dll
DLL_LIBS=-lcrtdll -L../.. -lWYap DLL_LIBS=-L /usr/lib/mingw -lcrtdll -L../.. -lWYap
BASE_FILE=regexp.base BASE_FILE=regexp.base
EXP_FILE=regexp.exp EXP_FILE=regexp.exp
DEF_FILE=$(srcdir)/regexp.def DEF_FILE=$(srcdir)/regexp.def

View File

@ -156,7 +156,7 @@ init_regexp(void)
UserCPredicate("check_regexp", regexp, 7); UserCPredicate("check_regexp", regexp, 7);
} }
#ifdef _WIN32 #if defined(_WIN32) || defined(__MINGW32__)
#include <windows.h> #include <windows.h>

View File

@ -38,7 +38,7 @@
*/ */
/* utility definitions */ /* utility definitions */
#ifdef _WIN32 #if defined(_WIN32) || defined(__MINGW32__)
#define DUPMAX ((unsigned int)-2) /* xxx is this right? */ #define DUPMAX ((unsigned int)-2) /* xxx is this right? */
#else #else
#define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */ #define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */

View File

@ -127,7 +127,7 @@ vertices_edges_to_ugraph(Vertices, Edges, Graph) :-
p_to_s_group(VertexSet, EdgeSet, Graph). p_to_s_group(VertexSet, EdgeSet, Graph).
add_vertices(Vertices, Graph, NewGraph) :- add_vertices(Graph, Vertices, NewGraph) :-
msort(Vertices, V1), msort(Vertices, V1),
add_vertices_to_s_graph(V1, Graph, NewGraph). add_vertices_to_s_graph(V1, Graph, NewGraph).