Merge branch 'master' of yap.dcc.fc.up.pt:yap-6

This commit is contained in:
Vítor Santos Costa 2011-02-08 21:02:41 +00:00
commit 8496d1979b
10 changed files with 24 additions and 20 deletions

View File

@ -1258,6 +1258,8 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
case _switch_on_cons: case _switch_on_cons:
case _if_cons: case _if_cons:
case _go_on_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); ipc = NEXTOP(ipc,sssl);
break; break;
case _op_fail: 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 static void
decrease_log_indices(LogUpdIndex *c, yamop *suspend_code) decrease_log_indices(LogUpdIndex *c, yamop *suspend_code)
{ {

View File

@ -36,6 +36,7 @@ int
Yap_rational_tree_loop(CELL *pt0, CELL *pt0_end, CELL **to_visit, CELL **to_visit_max) Yap_rational_tree_loop(CELL *pt0, CELL *pt0_end, CELL **to_visit, CELL **to_visit_max)
{ {
CELL ** base = to_visit;
rtree_loop: rtree_loop:
while (pt0 < pt0_end) { while (pt0 < pt0_end) {
register CELL *ptd0; register CELL *ptd0;
@ -91,7 +92,7 @@ rtree_loop:
derefa_body(d0, ptd0, rtree_loop_unk, rtree_loop_nvar); derefa_body(d0, ptd0, rtree_loop_unk, rtree_loop_nvar);
} }
/* Do we still have compound terms to visit */ /* Do we still have compound terms to visit */
if (to_visit < (CELL **)to_visit_base) { if (to_visit < base) {
pt0 = to_visit[0]; pt0 = to_visit[0];
pt0_end = to_visit[1]; pt0_end = to_visit[1];
*pt0 = (CELL)to_visit[2]; *pt0 = (CELL)to_visit[2];
@ -102,7 +103,7 @@ rtree_loop:
cufail: cufail:
/* we found an infinite term */ /* we found an infinite term */
while (to_visit < (CELL **)to_visit_base) { while (to_visit < (CELL **)base) {
CELL *pt0; CELL *pt0;
pt0 = to_visit[0]; pt0 = to_visit[0];
*pt0 = (CELL)to_visit[2]; *pt0 = (CELL)to_visit[2];

View File

@ -205,7 +205,6 @@ void STD_PROTO(Yap_IPred,(PredEntry *, UInt, yamop *));
int STD_PROTO(Yap_addclause,(Term,yamop *,int,Term,Term*)); int STD_PROTO(Yap_addclause,(Term,yamop *,int,Term,Term*));
void STD_PROTO(Yap_add_logupd_clause,(PredEntry *,LogUpdClause *,int)); void STD_PROTO(Yap_add_logupd_clause,(PredEntry *,LogUpdClause *,int));
void STD_PROTO(Yap_kill_iblock,(ClauseUnion *,ClauseUnion *,PredEntry *)); 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)); void STD_PROTO(Yap_EraseStaticClause,(StaticClause *, Term));
ClauseUnion *STD_PROTO(Yap_find_owner_index,(yamop *, PredEntry *)); ClauseUnion *STD_PROTO(Yap_find_owner_index,(yamop *, PredEntry *));

View File

@ -284,6 +284,9 @@ static void
AdjustSwitchTable(op_numbers op, yamop *table, COUNT i) AdjustSwitchTable(op_numbers op, yamop *table, COUNT i)
{ {
CELL *startcode = (CELL *)table; CELL *startcode = (CELL *)table;
/* in case the table is already gone */
if (!table)
return;
switch (op) { switch (op) {
case _switch_on_func: case _switch_on_func:
{ {

View File

@ -659,7 +659,8 @@ inline EXTERN yamop *PtoOpAdjust (yamop *);
inline EXTERN yamop * inline EXTERN yamop *
PtoOpAdjust (yamop * ptr) PtoOpAdjust (yamop * ptr)
{ {
return (yamop *) (CharP (ptr) + HDiff); if (ptr)
return (yamop *) (CharP (ptr) + HDiff);
} }
inline EXTERN struct operator_entry *OpListAdjust (struct operator_entry *); inline EXTERN struct operator_entry *OpListAdjust (struct operator_entry *);

View File

@ -9,8 +9,8 @@
% %
% Contributions to this file: % Contributions to this file:
% Author: Theofrastos Mantadelis % Author: Theofrastos Mantadelis
% $Date: 2011-02-01 18:36:41 +0100 (Tue, 01 Feb 2011) $ % $Date: 2011-02-04 16:04:49 +0100 (Fri, 04 Feb 2011) $
% $Revision: 7 $ % $Revision: 11 $
% Contributions: The timer implementation is inspired by Bernd Gutmann's timers % Contributions: The timer implementation is inspired by Bernd Gutmann's timers
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -394,4 +394,4 @@ timer_pause(Name, Elapsed):-
retract('$timer'(Name, _, StartTime)), retract('$timer'(Name, _, StartTime)),
statistics(walltime, [EndTime, _]), statistics(walltime, [EndTime, _]),
Elapsed is EndTime - StartTime, Elapsed is EndTime - StartTime,
assert('$timer'(Name, paused, Elapsed)). assertz('$timer'(Name, paused, Elapsed)).

View File

@ -10,8 +10,8 @@
% Contributions to this file: % Contributions to this file:
% Author: Theofrastos Mantadelis % Author: Theofrastos Mantadelis
% Sugestions: Bernd Gutmann, Paulo Moura % Sugestions: Bernd Gutmann, Paulo Moura
% $Date: 2011-02-03 17:19:26 +0100 (Thu, 03 Feb 2011) $ % $Date: 2011-02-04 16:06:56 +0100 (Fri, 04 Feb 2011) $
% $Revision: 9 $ % $Revision: 12 $
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
@ -357,8 +357,12 @@ in_interval_single(Type, (Min, Max)):-
Min < Max, Min < Max,
Max - Min > 0.0. Max - Min > 0.0.
type_or_inf(_Type, (+inf)):- !. type_or_inf(Type, Value):-
type_or_inf(_Type, (-inf)):- !. 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). type_or_inf(Type, Value):- call(Type, Value).
in_interval(Type, [Interval|_Rest], Value):- in_interval(Type, [Interval|_Rest], Value):-

View File

@ -213,10 +213,10 @@
reset_problog_flags/0, reset_problog_flags/0,
problog_flag/2]). problog_flag/2]).
:- use_module(gflags). :- use_module(gflags).
:- use_module(os). :- use_module(os).
:- use_module(logger). :- use_module(logger).
:- use_module(library(system), [file_exists/1, delete_file/1]).
problog_define_flag(Flag, Type, Description, DefaultValue):- problog_define_flag(Flag, Type, Description, DefaultValue):-
flag_define(Flag, Type, DefaultValue, Description). flag_define(Flag, Type, DefaultValue, Description).

@ -1 +1 @@
Subproject commit 73e4e086d06c54210100f0faaeccbea276c707eb Subproject commit 29151b2fe68f2dc727cdc07040e1fa1ad4fcca20

View File

@ -293,7 +293,7 @@ between(I,M,J) :-
( (
var(J) var(J)
-> ->
'$between'(I,M,J) I =< M, '$between'(I,M,J)
; ;
integer(J) integer(J)
-> ->