diff --git a/C/cdmgr.c b/C/cdmgr.c index 33f063da4..aa58da3ff 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -1258,6 +1258,8 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code case _switch_on_cons: case _if_cons: case _go_on_cons: + /* make sure we don't leave dangling references to memory that is going to be removed */ + ipc->u.sssl.l = NULL; ipc = NEXTOP(ipc,sssl); break; case _op_fail: @@ -1272,12 +1274,6 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code } } -void -Yap_cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *sc) -{ - cleanup_dangling_indices(ipc, beg, end, sc); -} - static void decrease_log_indices(LogUpdIndex *c, yamop *suspend_code) { diff --git a/C/unify.c b/C/unify.c index 4e4b7b81d..fa202e011 100644 --- a/C/unify.c +++ b/C/unify.c @@ -36,6 +36,7 @@ int Yap_rational_tree_loop(CELL *pt0, CELL *pt0_end, CELL **to_visit, CELL **to_visit_max) { + CELL ** base = to_visit; rtree_loop: while (pt0 < pt0_end) { register CELL *ptd0; @@ -91,7 +92,7 @@ rtree_loop: derefa_body(d0, ptd0, rtree_loop_unk, rtree_loop_nvar); } /* Do we still have compound terms to visit */ - if (to_visit < (CELL **)to_visit_base) { + if (to_visit < base) { pt0 = to_visit[0]; pt0_end = to_visit[1]; *pt0 = (CELL)to_visit[2]; @@ -102,7 +103,7 @@ rtree_loop: cufail: /* we found an infinite term */ - while (to_visit < (CELL **)to_visit_base) { + while (to_visit < (CELL **)base) { CELL *pt0; pt0 = to_visit[0]; *pt0 = (CELL)to_visit[2]; diff --git a/H/clause.h b/H/clause.h index 484c4332d..09a7aa5aa 100644 --- a/H/clause.h +++ b/H/clause.h @@ -205,7 +205,6 @@ void STD_PROTO(Yap_IPred,(PredEntry *, UInt, yamop *)); int STD_PROTO(Yap_addclause,(Term,yamop *,int,Term,Term*)); void STD_PROTO(Yap_add_logupd_clause,(PredEntry *,LogUpdClause *,int)); void STD_PROTO(Yap_kill_iblock,(ClauseUnion *,ClauseUnion *,PredEntry *)); -void STD_PROTO(Yap_cleanup_dangling_indices,(yamop *,yamop *,yamop *,yamop *)); void STD_PROTO(Yap_EraseStaticClause,(StaticClause *, Term)); ClauseUnion *STD_PROTO(Yap_find_owner_index,(yamop *, PredEntry *)); diff --git a/H/rheap.h b/H/rheap.h index e69a712c0..deb009324 100755 --- a/H/rheap.h +++ b/H/rheap.h @@ -284,6 +284,9 @@ static void AdjustSwitchTable(op_numbers op, yamop *table, COUNT i) { CELL *startcode = (CELL *)table; + /* in case the table is already gone */ + if (!table) + return; switch (op) { case _switch_on_func: { diff --git a/H/sshift.h b/H/sshift.h index 6ac683f0a..9263b366c 100755 --- a/H/sshift.h +++ b/H/sshift.h @@ -659,7 +659,8 @@ inline EXTERN yamop *PtoOpAdjust (yamop *); inline EXTERN yamop * PtoOpAdjust (yamop * ptr) { - return (yamop *) (CharP (ptr) + HDiff); + if (ptr) + return (yamop *) (CharP (ptr) + HDiff); } inline EXTERN struct operator_entry *OpListAdjust (struct operator_entry *); diff --git a/library/c_alarms.yap b/library/c_alarms.yap index e238f1dae..b1b33ba30 100644 --- a/library/c_alarms.yap +++ b/library/c_alarms.yap @@ -9,8 +9,8 @@ % % Contributions to this file: % Author: Theofrastos Mantadelis -% $Date: 2011-02-01 18:36:41 +0100 (Tue, 01 Feb 2011) $ -% $Revision: 7 $ +% $Date: 2011-02-04 16:04:49 +0100 (Fri, 04 Feb 2011) $ +% $Revision: 11 $ % Contributions: The timer implementation is inspired by Bernd Gutmann's timers % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -394,4 +394,4 @@ timer_pause(Name, Elapsed):- retract('$timer'(Name, _, StartTime)), statistics(walltime, [EndTime, _]), Elapsed is EndTime - StartTime, - assert('$timer'(Name, paused, Elapsed)). + assertz('$timer'(Name, paused, Elapsed)). diff --git a/library/flags.yap b/library/flags.yap index 20d318bc1..f2a825623 100644 --- a/library/flags.yap +++ b/library/flags.yap @@ -10,8 +10,8 @@ % Contributions to this file: % Author: Theofrastos Mantadelis % Sugestions: Bernd Gutmann, Paulo Moura -% $Date: 2011-02-03 17:19:26 +0100 (Thu, 03 Feb 2011) $ -% $Revision: 9 $ +% $Date: 2011-02-04 16:06:56 +0100 (Fri, 04 Feb 2011) $ +% $Revision: 12 $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -357,8 +357,12 @@ in_interval_single(Type, (Min, Max)):- Min < Max, Max - Min > 0.0. -type_or_inf(_Type, (+inf)):- !. -type_or_inf(_Type, (-inf)):- !. +type_or_inf(Type, Value):- + nonvar(Type), nonvar(Value), + Value == (+inf), !. +type_or_inf(Type, Value):- + nonvar(Type), nonvar(Value), + Value == (-inf), !. type_or_inf(Type, Value):- call(Type, Value). in_interval(Type, [Interval|_Rest], Value):- diff --git a/packages/ProbLog/problog/flags.yap b/packages/ProbLog/problog/flags.yap index 54a77fb93..438a8ca07 100644 --- a/packages/ProbLog/problog/flags.yap +++ b/packages/ProbLog/problog/flags.yap @@ -213,10 +213,10 @@ reset_problog_flags/0, problog_flag/2]). - :- use_module(gflags). :- use_module(os). :- use_module(logger). +:- use_module(library(system), [file_exists/1, delete_file/1]). problog_define_flag(Flag, Type, Description, DefaultValue):- flag_define(Flag, Type, DefaultValue, Description). diff --git a/packages/jpl b/packages/jpl index 73e4e086d..29151b2fe 160000 --- a/packages/jpl +++ b/packages/jpl @@ -1 +1 @@ -Subproject commit 73e4e086d06c54210100f0faaeccbea276c707eb +Subproject commit 29151b2fe68f2dc727cdc07040e1fa1ad4fcca20 diff --git a/pl/arith.yap b/pl/arith.yap index 033e45599..b8708cf05 100644 --- a/pl/arith.yap +++ b/pl/arith.yap @@ -293,7 +293,7 @@ between(I,M,J) :- ( var(J) -> - '$between'(I,M,J) + I =< M, '$between'(I,M,J) ; integer(J) ->