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:
		
							
								
								
									
										24
									
								
								C/absmi.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								C/absmi.c
									
									
									
									
									
								
							@@ -10,8 +10,11 @@
 | 
				
			|||||||
*									 *
 | 
					*									 *
 | 
				
			||||||
* File:		absmi.c							 *
 | 
					* File:		absmi.c							 *
 | 
				
			||||||
* comments:	Portable abstract machine interpreter                    *
 | 
					* 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 $
 | 
					* $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
 | 
					* Revision 1.216  2006/12/29 01:57:50  vsc
 | 
				
			||||||
* allow coroutining plus tabling, this means fixing some trouble with the
 | 
					* allow coroutining plus tabling, this means fixing some trouble with the
 | 
				
			||||||
* gc and a bug in global variable handling.
 | 
					* gc and a bug in global variable handling.
 | 
				
			||||||
@@ -1754,6 +1757,12 @@ Yap_absmi(int inp)
 | 
				
			|||||||
      /* fail                             */
 | 
					      /* fail                             */
 | 
				
			||||||
      PBOp(op_fail, e);
 | 
					      PBOp(op_fail, e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef COROUTINING
 | 
				
			||||||
 | 
					      CACHE_Y_AS_ENV(YREG);
 | 
				
			||||||
 | 
					      check_stack(NoStackFail, H);
 | 
				
			||||||
 | 
					      ENDCACHE_Y_AS_ENV();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fail:
 | 
					    fail:
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
	register tr_fr_ptr pt0 = TR;
 | 
						register tr_fr_ptr pt0 = TR;
 | 
				
			||||||
@@ -2809,6 +2818,19 @@ Yap_absmi(int inp)
 | 
				
			|||||||
      /* don't do debugging and friends here */
 | 
					      /* don't do debugging and friends here */
 | 
				
			||||||
      goto do_commit_b_x;
 | 
					      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 ; */
 | 
					      /* don't forget I cannot creep at ; */
 | 
				
			||||||
    NoStackEither:
 | 
					    NoStackEither:
 | 
				
			||||||
      if (ActiveSignals & YAP_CREEP_SIGNAL) {
 | 
					      if (ActiveSignals & YAP_CREEP_SIGNAL) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -522,6 +522,10 @@ frozen(V, LG) :-
 | 
				
			|||||||
	'$purge_done_goals'(G0, GF).
 | 
						'$purge_done_goals'(G0, GF).
 | 
				
			||||||
'$purge_done_goals'(['$redo_freeze'(Done, _, _)|G0], GF) :- nonvar(Done), !,
 | 
					'$purge_done_goals'(['$redo_freeze'(Done, _, _)|G0], GF) :- nonvar(Done), !,
 | 
				
			||||||
	'$purge_done_goals'(G0, GF).
 | 
						'$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'(['$redo_eq'(Done, _, _, _)|G0], GF) :- nonvar(Done), !,
 | 
				
			||||||
	'$purge_done_goals'(G0, GF).
 | 
						'$purge_done_goals'(G0, GF).
 | 
				
			||||||
'$purge_done_goals'(['$redo_ground'(Done, _, _)|G0], GF) :- nonvar(Done), !,
 | 
					'$purge_done_goals'(['$redo_ground'(Done, _, _)|G0], GF) :- nonvar(Done), !,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -473,6 +473,8 @@ source_module(Mod) :-
 | 
				
			|||||||
	call_with_args(:,?,?,?,?,?,?,?,?,?),
 | 
						call_with_args(:,?,?,?,?,?,?,?,?,?),
 | 
				
			||||||
	format(+,:),
 | 
						format(+,:),
 | 
				
			||||||
	format(+,+,:),
 | 
						format(+,+,:),
 | 
				
			||||||
 | 
						call_cleanup(:,:),
 | 
				
			||||||
 | 
						call_cleanup(:,?,:),
 | 
				
			||||||
	call_residue(:,?),
 | 
						call_residue(:,?),
 | 
				
			||||||
	catch(:,+,:),
 | 
						catch(:,+,:),
 | 
				
			||||||
	clause(:,?),
 | 
						clause(:,?),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -179,7 +179,7 @@ call_cleanup(Goal, Catcher, Cleanup) :-
 | 
				
			|||||||
	      call(Cleanup).
 | 
						      call(Cleanup).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
'$call_cleanup'(Goal,Catcher,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:trail_suspension_marker(Catcher),
 | 
				
			||||||
	yap_hacks:current_choice_point(CP0),
 | 
						yap_hacks:current_choice_point(CP0),
 | 
				
			||||||
	call(Goal),
 | 
						call(Goal),
 | 
				
			||||||
@@ -193,6 +193,10 @@ call_cleanup(Goal, Catcher, Cleanup) :-
 | 
				
			|||||||
	call(Cleanup), !,
 | 
						call(Cleanup), !,
 | 
				
			||||||
	fail.
 | 
						fail.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					'$clean_call'(Cleanup) :-
 | 
				
			||||||
 | 
					        call(Cleanup), !.
 | 
				
			||||||
 | 
					'$clean_call'(_).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
op(P,T,V) :- var(P), !,
 | 
					op(P,T,V) :- var(P), !,
 | 
				
			||||||
	'$do_error'(instantiation_error,op(P,T,V)).
 | 
						'$do_error'(instantiation_error,op(P,T,V)).
 | 
				
			||||||
op(P,T,V) :- \+integer(P), !,
 | 
					op(P,T,V) :- \+integer(P), !,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user