fix garbage collector and fix LeaveGoal
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1945 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
a5406ccc02
commit
642b498728
@ -10,8 +10,11 @@
|
||||
* File: c_interface.c *
|
||||
* comments: c_interface primitives definition *
|
||||
* *
|
||||
* Last rev: $Date: 2007-09-04 10:34:54 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2007-10-05 18:24:30 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.96 2007/09/04 10:34:54 vsc
|
||||
* Improve SWI interface emulation.
|
||||
*
|
||||
* Revision 1.95 2007/06/04 12:28:01 vsc
|
||||
* interface speedups
|
||||
* bad error message in X is foo>>2.
|
||||
@ -1273,7 +1276,7 @@ YAP_LeaveGoal(int backtrack, YAP_dogoalinfo *dgi)
|
||||
choiceptr myB;
|
||||
|
||||
myB = (choiceptr)(LCL0-dgi->b);
|
||||
if (B > myB) {
|
||||
if (B >= myB) {
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef YAPOR
|
||||
|
4
C/exec.c
4
C/exec.c
@ -1989,14 +1989,14 @@ Yap_InitYaamRegs(void)
|
||||
/* for slots to work */
|
||||
Yap_StartSlots();
|
||||
GlobalArena = TermNil;
|
||||
#if COROUTINING
|
||||
h0var = MkVarTerm();
|
||||
#if COROUTINING
|
||||
DelayedVars = Yap_NewTimedVar(h0var);
|
||||
WokenGoals = Yap_NewTimedVar(TermNil);
|
||||
AttsMutableList = Yap_NewTimedVar(h0var);
|
||||
GlobalDelayArena = TermNil;
|
||||
#endif
|
||||
GcGeneration = Yap_NewTimedVar(MkIntTerm(0));
|
||||
GcGeneration = Yap_NewTimedVar(h0var);
|
||||
GcCurrentPhase = 0L;
|
||||
GcPhase = Yap_NewTimedVar(MkIntTerm(GcCurrentPhase));
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
|
15
C/heapgc.c
15
C/heapgc.c
@ -3065,6 +3065,8 @@ compact_heap(void)
|
||||
, &depfr
|
||||
#endif
|
||||
);
|
||||
if (GcCalls==355)
|
||||
fprintf(stderr,"Start=%p,%p %d\n",H-1,H0,H-H0);
|
||||
for (current = H - 1; current >= start_from; current--) {
|
||||
if (MARKED_PTR(current)) {
|
||||
CELL ccell = UNMARK_CELL(*current);
|
||||
@ -3491,6 +3493,10 @@ compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max)
|
||||
total_marked += total_oldies;
|
||||
}
|
||||
} else {
|
||||
if (GcCalls==355) {
|
||||
fprintf(stderr,"Start=%p,%pn %ld, %ld\n",H0,HGEN, total_oldies, total_marked);
|
||||
|
||||
}
|
||||
if (HGEN != H0) {
|
||||
CurrentH0 = H0;
|
||||
H0 = HGEN;
|
||||
@ -3682,7 +3688,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
iptop = (CELL_PTR *)H;
|
||||
#endif
|
||||
/* get the number of active registers */
|
||||
HGEN = H0+IntegerOfTerm(Yap_ReadTimedVar(GcGeneration));
|
||||
HGEN = VarOfTerm(Yap_ReadTimedVar(GcGeneration));
|
||||
|
||||
gc_phase = (UInt)IntegerOfTerm(Yap_ReadTimedVar(GcPhase));
|
||||
/* old HGEN are not very reliable, but still may have data to recover */
|
||||
@ -3738,7 +3744,10 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
pop_registers(predarity, nextop);
|
||||
TR = new_TR;
|
||||
/* fprintf(Yap_stderr,"NEW HGEN %ld (%ld)\n", H-H0, HGEN-H0);*/
|
||||
Yap_UpdateTimedVar(GcGeneration, MkIntegerTerm(H-H0));
|
||||
{
|
||||
Term t = MkVarTerm();
|
||||
Yap_UpdateTimedVar(GcGeneration, t);
|
||||
}
|
||||
Yap_UpdateTimedVar(GcPhase, MkIntegerTerm(GcCurrentPhase));
|
||||
c_time = Yap_cputime();
|
||||
if (gc_verbose) {
|
||||
@ -3830,7 +3839,7 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop)
|
||||
if (gc_margin < gc_lim)
|
||||
gc_margin = gc_lim;
|
||||
GcCalls++;
|
||||
HGEN = H0+IntegerOfTerm(Yap_ReadTimedVar(GcGeneration));
|
||||
HGEN = VarOfTerm(Yap_ReadTimedVar(GcGeneration));
|
||||
if (gc_on && !(Yap_PrologMode & InErrorMode) &&
|
||||
/* make sure there is a point in collecting the heap */
|
||||
(ASP-H0)*sizeof(CELL) > gc_lim &&
|
||||
|
@ -17,6 +17,10 @@
|
||||
|
||||
<h2>Yap-5.1.3:</h2>
|
||||
<ul>
|
||||
<li> FIXED: fix YAP_LeaveGoal() (obs from Trevor Walker).</li>
|
||||
<li> FIXED: gc generation should not be an integer: otherwise it can
|
||||
be misled by global growth.</li>
|
||||
<li> FIXED: sub_atom 0 should work.</li>
|
||||
<li> FIXED: have has table of preds with repeated functors (obs from
|
||||
Bernd Gutmann).</li>
|
||||
<li> FIXED: major bugs in encoding support (obs from
|
||||
|
@ -9684,15 +9684,14 @@ process. An interface to the @t{getpid} function.
|
||||
Interface with @var{tmpnam}: create an unique file and unify its name
|
||||
with @var{File}.
|
||||
|
||||
@item
|
||||
exec(+@var{Command},[+@var{InputStream},+@var{OutputStream},+@var{ErrorStream}],-@var{Status})
|
||||
@item exec(+@var{Command},[+@var{InputStream},+@var{OutputStream},+@var{ErrorStream}],-@var{PID})
|
||||
@findex exec/3
|
||||
@syindex exec/3
|
||||
@cnindex exec/3
|
||||
Execute command @var{Command} with its streams connected to
|
||||
@var{InputStream}, @var{OutputStream}, and @var{ErrorStream}. The result
|
||||
for the command is returned in @var{Status}. The command is executed by
|
||||
the default shell @code{bin/sh -c} in Unix.
|
||||
@var{InputStream}, @var{OutputStream}, and @var{ErrorStream}. The
|
||||
process that executes the command is returned as @var{PID}. The
|
||||
command is executed by the default shell @code{bin/sh -c} in Unix.
|
||||
|
||||
The following example demonstrates the use of @code{exec/3} to send a
|
||||
command and process its output:
|
||||
|
@ -8,8 +8,11 @@
|
||||
* *
|
||||
**************************************************************************
|
||||
* *
|
||||
* $Id: sys.c,v 1.32 2007-05-07 12:11:39 vsc Exp $ *
|
||||
* $Id: sys.c,v 1.33 2007-10-05 18:24:30 vsc Exp $ *
|
||||
* mods: $Log: not supported by cvs2svn $
|
||||
* mods: Revision 1.32 2007/05/07 12:11:39 vsc
|
||||
* mods: fix mktime fix
|
||||
* mods:
|
||||
* mods: Revision 1.31 2007/05/07 11:21:29 vsc
|
||||
* mods: mktime needs to know if daylight time savings are on
|
||||
* mods: (obs from Bernd Gutmann).
|
||||
@ -750,7 +753,7 @@ do_shell(void)
|
||||
strcpy(buf, YAP_AtomName(YAP_AtomOfTerm(YAP_ARG1)));
|
||||
strcpy(buf, YAP_AtomName(YAP_AtomOfTerm(YAP_ARG2)));
|
||||
strcpy(buf, " ");
|
||||
strcpy(bug, YAP_AtomName(YAP_AtomOfTerm(YAP_ARG3)));
|
||||
strcpy(buf, YAP_AtomName(YAP_AtomOfTerm(YAP_ARG3)));
|
||||
#endif
|
||||
sys = system(buf);
|
||||
YAP_FreeSpaceFromYap(buf);
|
||||
|
@ -713,7 +713,7 @@ sub_atom(At, Bef, Size, After, SubAt) :-
|
||||
Size is Size0+1.
|
||||
|
||||
'$sub_atom_needs_int'(V,_) :- var(V), !.
|
||||
'$sub_atom_needs_int'(I,_) :- integer(I), I > 0, !.
|
||||
'$sub_atom_needs_int'(I,_) :- integer(I), I >= 0, !.
|
||||
'$sub_atom_needs_int'(I,ErrorTerm) :- integer(I), !,
|
||||
'$do_error'(domain_error(not_less_than_zero,I),ErrorTerm).
|
||||
'$sub_atom_needs_int'(I,ErrorTerm) :-
|
||||
|
@ -874,6 +874,8 @@ stream_property(Stream, Props) :-
|
||||
'$check_stream_props'(Prop, [Prop]).
|
||||
|
||||
|
||||
%
|
||||
|
||||
'$process_stream_properties'([], _, _, _).
|
||||
'$process_stream_properties'([file_name(F)|Props], Stream, F, Mode) :-
|
||||
'$process_stream_properties'(Props, Stream, F, Mode).
|
||||
|
Reference in New Issue
Block a user