fix lost indices in reconsult

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@937 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-11-27 21:47:44 +00:00
parent 90829edc9e
commit 01703de3a0
2 changed files with 66 additions and 59 deletions

View File

@ -1095,9 +1095,9 @@ addclause(Term t, yamop *cp, int mode, int mod)
} }
} }
if (compile_mode) if (compile_mode)
p->PredFlags = pflags | CompiledPredFlag | FastPredFlag; p->PredFlags = p->PredFlags | CompiledPredFlag | FastPredFlag;
else else
p->PredFlags = pflags|CompiledPredFlag; p->PredFlags = p->PredFlags | CompiledPredFlag;
} }
if (p->cs.p_code.FirstClause == NULL) { if (p->cs.p_code.FirstClause == NULL) {
if (!(pflags & DynamicPredFlag)) { if (!(pflags & DynamicPredFlag)) {

View File

@ -247,7 +247,7 @@ debugging :-
'$creep'([Mod|G]) :- '$creep'([Mod|G]) :-
'$stop_debugging', '$stop_debugging',
CP is '$last_choice_pt', CP is '$last_choice_pt',
'$do_spy'(G, Mod, CP). '$do_spy'(G, Mod, CP, no).
%'$spy'(G) :- write(user_error,'$spy'(G)), nl, fail. %'$spy'(G) :- write(user_error,'$spy'(G)), nl, fail.
% %
@ -263,100 +263,103 @@ debugging :-
'$wake_up_goal'(G, LG). '$wake_up_goal'(G, LG).
'$spy'([Mod|G]) :- '$spy'([Mod|G]) :-
CP is '$last_choice_pt', CP is '$last_choice_pt',
'$do_spy'(G, Mod, CP). '$do_spy'(G, Mod, CP, no).
'$do_spy'(!, _, _) :- !, '$cut_by'(CP). % last argument to do_spy says that we are at the end of a context. It
'$do_spy'('$cut_by'(M), _, _) :- !, '$cut_by'(M). % is required to know whether we are controlled by the debugger.
'$do_spy'(M:G, _, CP) :- !, '$do_spy'(!, _, _, _) :- !, '$cut_by'(CP).
'$do_spy'(G, M, CP). '$do_spy'('$cut_by'(M), _, _, _) :- !, '$cut_by'(M).
'$do_spy'((A,B), M, CP) :- !, '$do_spy'(true, _, _, _) :- !.
'$do_spy'(A, M, CP), '$do_spy'(M:G, _, CP, InControl) :- !,
'$do_spy'(B, M, CP). '$do_spy'(G, M, CP, InControl).
'$do_spy'((T->A;B), M, CP) :- !, '$do_spy'((A,B), M, CP, InControl) :- !,
( '$do_spy'(T, M, CP) -> '$do_spy'(A, M, CP) '$do_spy'(A, M, CP, yes),
'$do_spy'(B, M, CP, InControl).
'$do_spy'((T->A;B), M, CP, InControl) :- !,
( '$do_spy'(T, M, CP, yes) -> '$do_spy'(A, M, CP, yes)
; ;
'$do_spy'(B, M, CP) '$do_spy'(B, M, CP, InControl)
). ).
'$do_spy'((A;B), M, CP) :- !, '$do_spy'((A;B), M, CP, InControl) :- !,
( (
'$do_spy'(A, M, CP) '$do_spy'(A, M, CP, yes)
; ;
'$do_spy'(B, M, CP) '$do_spy'(B, M, CP, InControl)
). ).
'$do_spy'((T->A|B), M, CP) :- !, '$do_spy'((T->A|B), M, CP, InControl) :- !,
( '$do_spy'(T, M, CP) -> '$do_spy'(A, M, CP) ( '$do_spy'(T, M, CP, yes) -> '$do_spy'(A, M, CP, yes)
; ;
'$do_spy'(B, M, CP) '$do_spy'(B, M, CP, InControl)
). ).
'$do_spy'((A|B), M, CP) :- !, '$do_spy'((A|B), M, CP, InControl) :- !,
( (
'$do_spy'(A, M, CP) '$do_spy'(A, M, CP, yes)
; ;
'$do_spy'(B, M, CP) '$do_spy'(B, M, CP, InControl)
). ).
'$do_spy'((\+G), M, CP) :- !, '$do_spy'((\+G), M, CP, InControl) :- !,
\+ '$do_spy'(G, M, CP). \+ '$do_spy'(G, M, CP, InControl).
'$do_spy'((not(G)), M) :- !, '$do_spy'((not(G)), M, InControl) :- !,
\+ '$do_spy'(G, M, CP). \+ '$do_spy'(G, M, CP, InControl).
'$do_spy'(G, Module, _) :- '$do_spy'(G, Module, _, InControl) :-
get_value(spy_gn,L), /* get goal no. */ get_value(spy_gn,L), /* get goal no. */
L1 is L+1, /* bump it */ L1 is L+1, /* bump it */
set_value(spy_gn,L1), /* and save it globaly */ set_value(spy_gn,L1), /* and save it globaly */
'$loop_spy'(L, G, Module). /* set creep on */ '$loop_spy'(L, G, Module, InControl). /* set creep on */
% we are skipping, so we can just call the goal, % we are skipping, so we can just call the goal,
% while leaving the minimal structure in place. % while leaving the minimal structure in place.
'$loop_spy'(GoalNumber, G, Module) :- '$loop_spy'(GoalNumber, G, Module, InControl) :-
'$system_catch'('$loop_spy2'(GoalNumber, G, Module), '$system_catch'('$loop_spy2'(GoalNumber, G, Module, InControl),
Module, Event, Module, Event,
'$loop_spy_event'(Event, GoalNumber, G, Module)). '$loop_spy_event'(Event, GoalNumber, G, Module, InControl)).
'$loop_fail'(GoalNumber, G, Module) :-
'$system_catch'(('$trace'(fail, G, Module, GoalNumber),
fail ),
Module, Event,
'$loop_spy_event'(Event, GoalNumber, G, Module)).
% handle weird things happening in the debugger. % handle weird things happening in the debugger.
'$loop_spy_event'('$retry_spy'(G0), GoalNumber, G, Module) :- '$loop_spy_event'('$retry_spy'(G0), GoalNumber, G, Module, InControl) :-
G0 >= GoalNumber, !, G0 >= GoalNumber, !,
'$loop_spy'(GoalNumber, G, Module). '$loop_spy'(GoalNumber, G, Module, InControl).
'$loop_spy_event'('$retry_spy'(GoalNumber), _, _, _) :- !, '$loop_spy_event'('$retry_spy'(GoalNumber), _, _, _, _) :- !,
throw('$retry_spy'(GoalNumber)). throw('$retry_spy'(GoalNumber)).
'$loop_spy_event'('$fail_spy'(G0), GoalNumber, G, Module) :- '$loop_spy_event'('$fail_spy'(G0), GoalNumber, G, Module, InControl) :-
G0 >= GoalNumber, !, G0 >= GoalNumber, !,
'$loop_fail'(GoalNumber, G, Module). '$loop_fail'(GoalNumber, G, Module, InControl).
'$loop_spy_event'('$fail_spy'(GoalNumber), _, _, _) :- !, '$loop_spy_event'('$fail_spy'(GoalNumber), _, _, _, _) :- !,
throw('$fail_spy'(GoalNumber)). throw('$fail_spy'(GoalNumber)).
'$loop_spy_event'(abort, _, _, _) :- !, '$loop_spy_event'(abort, _, _, _, _) :- !,
'$throw'(abort). '$throw'(abort).
'$loop_spy_event'(Event, GoalNumber, G, Module) :- !, '$loop_spy_event'(Event, GoalNumber, G, Module, _) :- !,
'$trace'(exception,G,Module,GoalNumber), '$trace'(exception,G,Module,GoalNumber),
fail. fail.
'$loop_fail'(GoalNumber, G, Module, InControl) :-
'$system_catch'(('$trace'(fail, G, Module, GoalNumber),
fail ),
Module, Event,
'$loop_spy_event'(Event, GoalNumber, G, Module, InControl)).
% if we are in % if we are in
'$loop_spy2'(GoalNumber, G, Module) :- '$loop_spy2'(GoalNumber, G, Module, InControl) :-
/* the following choice point is where the predicate is called */ /* the following choice point is where the predicate is called */
( (
'$enter_goal'(GoalNumber, G, Module), '$enter_goal'(GoalNumber, G, Module),
'$spycall'(G,Module), '$spycall'(G, Module, InControl),
/* go execute the predicate */ /* go execute the predicate */
( (
'$stop_debugging', '$stop_debugging',
'$show_trace'(exit,G,Module,GoalNumber), /* output message at exit */ '$show_trace'(exit,G,Module,GoalNumber), /* output message at exit */
'$continue_debugging' '$continue_debugging'(InControl)
; /* exit */ ; /* exit */
/* we get here when we want to redo a goal */ /* we get here when we want to redo a goal */
'$stop_debugging', '$stop_debugging',
'$show_trace'(redo,G,Module,GoalNumber), /* inform user_error */ '$show_trace'(redo,G,Module,GoalNumber), /* inform user_error */
'$continue_debugging', '$continue_debugging'(InControl),
fail /* to backtrack to spycalls */ fail /* to backtrack to spycalls */
) )
; ;
'$stop_debugging', '$stop_debugging',
'$show_trace'(fail,G,Module,GoalNumber), /* inform at fail port */ '$show_trace'(fail,G,Module,GoalNumber), /* inform at fail port */
'$continue_debugging', '$continue_debugging'(InControl),
fail fail
). ).
@ -388,18 +391,18 @@ debugging :-
% %
'$spycall'(G,M) :- '$spycall'(G, M, _) :-
'$access_yap_flags'(10,0), !, '$access_yap_flags'(10,0), !,
'$execute0'(G, M). '$execute0'(G, M).
'$spycall'(G,M) :- '$spycall'(G, M, InControl) :-
'$flags'(G,M,F,F), '$flags'(G,M,F,F),
F /\ 16'402008 =\= 0, !, % dynamic procedure, logical semantics, or source F /\ 16'402008 =\= 0, !, % dynamic procedure, logical semantics, or source
% use the interpreter % use the interpreter
'$clause'(G, M, Cl), '$clause'(G, M, Cl),
CP is '$last_choice_pt', CP is '$last_choice_pt',
'$do_spy'(Cl, M, CP). '$do_spy'(Cl, M, CP, InControl).
'$spycall'(G,M) :- '$spycall'(G, M, InControl) :-
'$continue_debugging', '$continue_debugging'(InControl),
'$execute0'(G, M). '$execute0'(G, M).
@ -518,7 +521,9 @@ debugging :-
'$set_yap_flags'(10,0), '$set_yap_flags'(10,0),
set_value(spy_skip,CallNumber), set_value(spy_skip,CallNumber),
set_value(spy_stop,on), set_value(spy_stop,on),
'$setflop'(1). % skip first call (for current goal),
% stop next time.
'$setflop'(0).
'$action'(0'r,P,CallId,_,_) :- !, % r retry '$action'(0'r,P,CallId,_,_) :- !, % r retry
'$scan_number'(0'r,CallId,ScanNumber), '$scan_number'(0'r,CallId,ScanNumber),
throw('$retry_spy'(ScanNumber)). throw('$retry_spy'(ScanNumber)).
@ -553,11 +558,13 @@ debugging :-
'$ilgl'(C), '$ilgl'(C),
fail. fail.
% if we are in the interpreter, don't need to care about forcing a trace, do we?
'$continue_debugging'(yes) :- !.
% I don't need to activate the FlipFlop if I am creeping. % I don't need to activate the FlipFlop if I am creeping.
'$continue_debugging' :- '$continue_debugging'(_) :-
'$access_yap_flags'(10,1), !, '$access_yap_flags'(10,1), !,
'$creep'. '$creep'.
'$continue_debugging' :- '$continue_debugging'(_) :-
get_value(spy_stop, On), get_value(spy_stop, On),
(On = on -> '$setflop'(1) ; '$setflop'(0)). (On = on -> '$setflop'(1) ; '$setflop'(0)).