Merge branch 'debugger' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3

This commit is contained in:
Vítor Santos Costa 2013-02-17 07:04:55 -06:00
commit f1273132b5
7 changed files with 36 additions and 23 deletions

View File

@ -2841,7 +2841,7 @@ p_rmspy( USES_REGS1 )
return FALSE; return FALSE;
} }
#if THREADS #if THREADS
if (!(pred->PredFlags & ThreadLocalPredFlag)) { if (pred->PredFlags & ThreadLocalPredFlag) {
pred->OpcodeOfPred = Yap_opcode(_thread_local); pred->OpcodeOfPred = Yap_opcode(_thread_local);
pred->PredFlags ^= SpiedPredFlag; pred->PredFlags ^= SpiedPredFlag;
UNLOCKPE(39,pred); UNLOCKPE(39,pred);
@ -5288,8 +5288,6 @@ p_continue_static_clause( USES_REGS1 )
static void static void
add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp) add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp)
{ {
CACHE_REGS
char *code_end = (char *)cl + cl->ClSize; char *code_end = (char *)cl + cl->ClSize;
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_LU_INDEX); Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_LU_INDEX);
cl = cl->ChildIndex; cl = cl->ChildIndex;
@ -5302,7 +5300,6 @@ add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp)
static void static void
add_code_in_static_index(StaticIndex *cl, PredEntry *pp) add_code_in_static_index(StaticIndex *cl, PredEntry *pp)
{ {
CACHE_REGS
char *code_end = (char *)cl + cl->ClSize; char *code_end = (char *)cl + cl->ClSize;
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_STATIC_INDEX); Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_STATIC_INDEX);
cl = cl->ChildIndex; cl = cl->ChildIndex;
@ -5315,7 +5312,6 @@ add_code_in_static_index(StaticIndex *cl, PredEntry *pp)
static void static void
add_code_in_pred(PredEntry *pp) { add_code_in_pred(PredEntry *pp) {
CACHE_REGS
yamop *clcode; yamop *clcode;
PELOCK(49,pp); PELOCK(49,pp);
@ -5387,7 +5383,6 @@ add_code_in_pred(PredEntry *pp) {
void void
Yap_dump_code_area_for_profiler(void) { Yap_dump_code_area_for_profiler(void) {
CACHE_REGS
ModEntry *me = CurrentModules; ModEntry *me = CurrentModules;
while (me) { while (me) {

View File

@ -916,6 +916,22 @@ c_test(Int Op, Term t1, compiler_struct *cglobs) {
CACHE_REGS CACHE_REGS
Term t = Deref(t1); Term t = Deref(t1);
/* be caareful, has to be first occurrence */
if (Op == _save_by) {
if (!IsNewVar(t)) {
char s[32];
LOCAL_Error_TYPE = TYPE_ERROR_VARIABLE;
LOCAL_Error_Term = t;
LOCAL_ErrorMessage = LOCAL_ErrorSay;
Yap_bip_name(Op, s);
sprintf(LOCAL_ErrorMessage, "compiling %s/2 on bound variable", s);
save_machine_regs();
siglongjmp(cglobs->cint.CompilerBotch,1);
}
c_var(t, save_b_flag, 1, 0, cglobs);
return;
}
if (!IsVarTerm(t) || IsNewVar(t)) { if (!IsVarTerm(t) || IsNewVar(t)) {
Term tn = MkVarTerm(); Term tn = MkVarTerm();
c_eq(t, tn, cglobs); c_eq(t, tn, cglobs);
@ -923,8 +939,6 @@ c_test(Int Op, Term t1, compiler_struct *cglobs) {
} }
if (Op == _cut_by) if (Op == _cut_by)
c_var(t, commit_b_flag, 1, 0, cglobs); c_var(t, commit_b_flag, 1, 0, cglobs);
else if (Op == _save_by)
c_var(t, save_b_flag, 1, 0, cglobs);
else else
c_var(t, f_flag,(unsigned int)Op, 0, cglobs); c_var(t, f_flag,(unsigned int)Op, 0, cglobs);
} }

View File

@ -148,6 +148,7 @@ lcall2([Goal|Goals], Mod) :-
prolog:call_residue_vars(Goal,Residue) :- prolog:call_residue_vars(Goal,Residue) :-
attributes:all_attvars(Vs0), attributes:all_attvars(Vs0),
call(Goal), call(Goal),
'$stop_creeping',
attributes:all_attvars(Vs), attributes:all_attvars(Vs),
% this should not be actually strictly necessary right now. % this should not be actually strictly necessary right now.
% but it makes it a safe bet. % but it makes it a safe bet.

View File

@ -493,7 +493,7 @@ true :- true.
'$write_answer'(NV, LGs, Written), '$write_answer'(NV, LGs, Written),
'$write_query_answer_true'(Written), '$write_query_answer_true'(Written),
( (
'$prompt_alternatives_on'(determinism), CP = NCP, DCP = 0 '$prompt_alternatives_on'(determinism), CP == NCP, DCP = 0
-> ->
format(user_error, '.~n', []), format(user_error, '.~n', []),
! !
@ -778,7 +778,7 @@ incore(G) :- '$execute'(G).
yap_hacks:env_choice_point(CP), yap_hacks:env_choice_point(CP),
'$current_module'(M), '$current_module'(M),
( (
yap_hacks:current_choicepoint(DCP), yap_hacks:current_choice_point(DCP),
'$execute'(X), '$execute'(X),
yap_hacks:cut_at(DCP), yap_hacks:cut_at(DCP),
'$call'(A,CP,((X*->A),Y),M) '$call'(A,CP,((X*->A),Y),M)
@ -848,7 +848,7 @@ not(G) :- \+ '$execute'(G).
). ).
'$call'((X*->Y; Z),CP,G0,M) :- !, '$call'((X*->Y; Z),CP,G0,M) :- !,
( (
'$current_choicepoint'(DCP), '$current_choice_point'(DCP),
'$call'(X,CP,G0,M), '$call'(X,CP,G0,M),
yap_hacks:cut_at(DCP), yap_hacks:cut_at(DCP),
'$call'(Y,CP,G0,M) '$call'(Y,CP,G0,M)
@ -871,7 +871,7 @@ not(G) :- \+ '$execute'(G).
). ).
'$call'((X*->Y| Z),CP,G0,M) :- !, '$call'((X*->Y| Z),CP,G0,M) :- !,
( (
'$current_choicepoint'(DCP), '$current_choice_point'(DCP),
'$call'(X,CP,G0,M), '$call'(X,CP,G0,M),
yap_hacks:cut_at(DCP), yap_hacks:cut_at(DCP),
'$call'(Y,CP,G0,M) '$call'(Y,CP,G0,M)
@ -885,7 +885,7 @@ not(G) :- \+ '$execute'(G).
'$call'(B,CP,G0,M) '$call'(B,CP,G0,M)
). ).
'$call'(\+ X, _CP, _G0, M) :- !, '$call'(\+ X, _CP, _G0, M) :- !,
'$current_choicepoint'(CP), '$current_choice_point'(CP),
\+ '$call'(X,CP,G0,M). \+ '$call'(X,CP,G0,M).
'$call'(not(X), _CP, _G0, M) :- !, '$call'(not(X), _CP, _G0, M) :- !,
\+ '$call'(X,CP,G0,M). \+ '$call'(X,CP,G0,M).
@ -1085,7 +1085,7 @@ bootstrap(F) :-
% support SWI hook in a separate predicate, to avoid slow down standard consult. % support SWI hook in a separate predicate, to avoid slow down standard consult.
'$enter_command_with_hook'(Stream,Status) :- '$enter_command_with_hook'(Stream,Status) :-
'$read_vars'(Stream,Command,_,Pos,Vars, '|: ', Comments), '$read_vars'(Stream,Command,_,Pos,Vars, '|: ', Comments),
('$exit_system_mode'(comment_hook(Comments,Pos,Command), prolog) -> true ; true ), ( prolog:comment_hook(Comments,Pos,Command) -> true ; true ),
'$command'(Command,Vars,Pos,Status). '$command'(Command,Vars,Pos,Status).
'$abort_loop'(Stream) :- '$abort_loop'(Stream) :-
@ -1231,7 +1231,7 @@ catch_ball(C, C).
'$nb_getval'('$break', 0, fail), '$nb_getval'('$break', 0, fail),
recorded('$toplevel_hooks',H,_), recorded('$toplevel_hooks',H,_),
H \= fail, !, H \= fail, !,
( '$exit_system_mode'(H) -> true ; true). ( call(user:H1) -> true ; true).
'$run_toplevel_hooks'. '$run_toplevel_hooks'.
'$enter_system_mode' :- '$enter_system_mode' :-
@ -1273,7 +1273,6 @@ catch_ball(C, C).
fail fail
). ).
'$execute_outside_system_mode'(G, M, CP) :- '$execute_outside_system_mode'(G, M, CP) :-
format('start~n', []),
( (
'$$save_by'(CP1), '$$save_by'(CP1),
'$exit_system_mode', '$exit_system_mode',
@ -1293,7 +1292,7 @@ catch_ball(C, C).
'$run_at_thread_start' :- '$run_at_thread_start' :-
recorded('$thread_initialization',M:D,_), recorded('$thread_initialization',M:D,_),
'$exit_system_mode'(D, M), '$execute_outside_sysem_mode'(D, M),
fail. fail.
'$run_at_thread_start'. '$run_at_thread_start'.

View File

@ -394,7 +394,7 @@ initialization(G,OPT) :-
'$do_error'(type_error(OPT),initialization(G,OPT)) '$do_error'(type_error(OPT),initialization(G,OPT))
). ).
'$initialization'(G,now) :- '$initialization'(G,now) :-
( '$exit_system_mode'(G,prolog) -> true ; format(user_error,':- ~w:~w failed.~n',[M,G]) ). ( call(G) -> true ; format(user_error,':- ~w:~w failed.~n',[M,G]) ).
'$initialization'(G,after_load) :- '$initialization'(G,after_load) :-
'$initialization'(G). '$initialization'(G).
% ignore for now. % ignore for now.
@ -412,7 +412,7 @@ initialization(G,OPT) :-
recorded('$system_initialisation',G,R), recorded('$system_initialisation',G,R),
erase(R), erase(R),
G \= '$', G \= '$',
'$exit_system_mode'(G, prolog), once( call(G) ),
fail. fail.
'$exec_initialisation_goals' :- '$exec_initialisation_goals' :-
'$show_consult_level'(Level), '$show_consult_level'(Level),

View File

@ -119,8 +119,7 @@ setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup) :-
yap_hacks:enable_interrupts, yap_hacks:enable_interrupts,
'$current_choice_point'(CP0), '$current_choice_point'(CP0),
'$execute'(Goal), '$execute'(Goal),
% ensure environment for delayed variables in Goal '$stop_creeping',
'$true',
'$current_choice_point'(CPF), '$current_choice_point'(CPF),
( (
CP0 =:= CPF CP0 =:= CPF
@ -131,6 +130,7 @@ setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup) :-
true true
) )
; ;
'$stop_creeping',
Catcher = fail, Catcher = fail,
fail fail
). ).

View File

@ -50,10 +50,12 @@ findall(Template, Generator, Answers, SoFar) :-
nb:nb_queue(Ref), nb:nb_queue(Ref),
( (
'$execute'(Generator), '$execute'(Generator),
'$stop_creeping',
nb:nb_queue_enqueue(Ref, Template), nb:nb_queue_enqueue(Ref, Template),
fail fail
; ;
nb:nb_queue_close(Ref, Answers, SoFar) '$stop_creeping',
nb:nb_queue_close(Ref, Answers, SoFar)
). ).
@ -147,9 +149,11 @@ all(T,G,S) :-
'$init_db_queue'(Ref), '$init_db_queue'(Ref),
( '$catch'(Error,'$clean_findall'(Ref,Error),_), ( '$catch'(Error,'$clean_findall'(Ref,Error),_),
'$execute'(G), '$execute'(G),
'$stop_creeping',
'$db_enqueue'(Ref, T), '$db_enqueue'(Ref, T),
fail fail
; ;
'$stop_creeping',
'$$set'(S,Ref) '$$set'(S,Ref)
). ).