fix some bugs in call_cleanup: the result of action should not matter,

and !,fail would not wakeup the delayed goal.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1754 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2006-12-31 01:50:35 +00:00
parent a24c8bee1c
commit 88f51c97d7
4 changed files with 34 additions and 2 deletions

View File

@ -10,8 +10,11 @@
* *
* File: absmi.c *
* comments: Portable abstract machine interpreter *
* Last rev: $Date: 2006-12-30 03:25:44 $,$Author: vsc $ *
* Last rev: $Date: 2006-12-31 01:50:34 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.217 2006/12/30 03:25:44 vsc
* call_cleanup/2 and 3
*
* Revision 1.216 2006/12/29 01:57:50 vsc
* allow coroutining plus tabling, this means fixing some trouble with the
* gc and a bug in global variable handling.
@ -1754,6 +1757,12 @@ Yap_absmi(int inp)
/* fail */
PBOp(op_fail, e);
#ifdef COROUTINING
CACHE_Y_AS_ENV(YREG);
check_stack(NoStackFail, H);
ENDCACHE_Y_AS_ENV();
#endif
fail:
{
register tr_fr_ptr pt0 = TR;
@ -2809,6 +2818,19 @@ Yap_absmi(int inp)
/* don't do debugging and friends here */
goto do_commit_b_x;
/* Problem: have I got an environment or not? */
NoStackFail:
/* find something to fool S */
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) {
goto fail;
}
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) {
SREG = (CELL *)RepPredProp(Yap_GetPredPropByAtom(AtomFail,0));
goto creep;
}
/* don't do debugging and friends here */
goto fail;
/* don't forget I cannot creep at ; */
NoStackEither:
if (ActiveSignals & YAP_CREEP_SIGNAL) {

View File

@ -522,6 +522,10 @@ frozen(V, LG) :-
'$purge_done_goals'(G0, GF).
'$purge_done_goals'(['$redo_freeze'(Done, _, _)|G0], GF) :- nonvar(Done), !,
'$purge_done_goals'(G0, GF).
'$purge_done_goals'(['$redo_freeze'(Done, _, CallCleanup)|G0], GF) :-
nonvar(CallCleanup),
CallCleanup = _:'$clean_call'(_), !,
'$purge_done_goals'(G0, GF).
'$purge_done_goals'(['$redo_eq'(Done, _, _, _)|G0], GF) :- nonvar(Done), !,
'$purge_done_goals'(G0, GF).
'$purge_done_goals'(['$redo_ground'(Done, _, _)|G0], GF) :- nonvar(Done), !,

View File

@ -473,6 +473,8 @@ source_module(Mod) :-
call_with_args(:,?,?,?,?,?,?,?,?,?),
format(+,:),
format(+,+,:),
call_cleanup(:,:),
call_cleanup(:,?,:),
call_residue(:,?),
catch(:,+,:),
clause(:,?),

View File

@ -179,7 +179,7 @@ call_cleanup(Goal, Catcher, Cleanup) :-
call(Cleanup).
'$call_cleanup'(Goal,Catcher,Cleanup) :-
'$freeze_goal'(Catcher, once(Cleanup)),
'$freeze_goal'(Catcher, '$clean_call'(Cleanup)),
yap_hacks:trail_suspension_marker(Catcher),
yap_hacks:current_choice_point(CP0),
call(Goal),
@ -193,6 +193,10 @@ call_cleanup(Goal, Catcher, Cleanup) :-
call(Cleanup), !,
fail.
'$clean_call'(Cleanup) :-
call(Cleanup), !.
'$clean_call'(_).
op(P,T,V) :- var(P), !,
'$do_error'(instantiation_error,op(P,T,V)).
op(P,T,V) :- \+integer(P), !,