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

View File

@ -916,6 +916,22 @@ c_test(Int Op, Term t1, compiler_struct *cglobs) {
CACHE_REGS
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)) {
Term tn = MkVarTerm();
c_eq(t, tn, cglobs);
@ -923,8 +939,6 @@ c_test(Int Op, Term t1, compiler_struct *cglobs) {
}
if (Op == _cut_by)
c_var(t, commit_b_flag, 1, 0, cglobs);
else if (Op == _save_by)
c_var(t, save_b_flag, 1, 0, cglobs);
else
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) :-
attributes:all_attvars(Vs0),
call(Goal),
'$stop_creeping',
attributes:all_attvars(Vs),
% this should not be actually strictly necessary right now.
% but it makes it a safe bet.

View File

@ -493,7 +493,7 @@ true :- true.
'$write_answer'(NV, LGs, 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', []),
!
@ -778,7 +778,7 @@ incore(G) :- '$execute'(G).
yap_hacks:env_choice_point(CP),
'$current_module'(M),
(
yap_hacks:current_choicepoint(DCP),
yap_hacks:current_choice_point(DCP),
'$execute'(X),
yap_hacks:cut_at(DCP),
'$call'(A,CP,((X*->A),Y),M)
@ -848,7 +848,7 @@ not(G) :- \+ '$execute'(G).
).
'$call'((X*->Y; Z),CP,G0,M) :- !,
(
'$current_choicepoint'(DCP),
'$current_choice_point'(DCP),
'$call'(X,CP,G0,M),
yap_hacks:cut_at(DCP),
'$call'(Y,CP,G0,M)
@ -871,7 +871,7 @@ not(G) :- \+ '$execute'(G).
).
'$call'((X*->Y| Z),CP,G0,M) :- !,
(
'$current_choicepoint'(DCP),
'$current_choice_point'(DCP),
'$call'(X,CP,G0,M),
yap_hacks:cut_at(DCP),
'$call'(Y,CP,G0,M)
@ -885,7 +885,7 @@ not(G) :- \+ '$execute'(G).
'$call'(B,CP,G0,M)
).
'$call'(\+ X, _CP, _G0, M) :- !,
'$current_choicepoint'(CP),
'$current_choice_point'(CP),
\+ '$call'(X,CP,G0,M).
'$call'(not(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.
'$enter_command_with_hook'(Stream,Status) :-
'$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).
'$abort_loop'(Stream) :-
@ -1231,7 +1231,7 @@ catch_ball(C, C).
'$nb_getval'('$break', 0, fail),
recorded('$toplevel_hooks',H,_),
H \= fail, !,
( '$exit_system_mode'(H) -> true ; true).
( call(user:H1) -> true ; true).
'$run_toplevel_hooks'.
'$enter_system_mode' :-
@ -1273,7 +1273,6 @@ catch_ball(C, C).
fail
).
'$execute_outside_system_mode'(G, M, CP) :-
format('start~n', []),
(
'$$save_by'(CP1),
'$exit_system_mode',
@ -1293,7 +1292,7 @@ catch_ball(C, C).
'$run_at_thread_start' :-
recorded('$thread_initialization',M:D,_),
'$exit_system_mode'(D, M),
'$execute_outside_sysem_mode'(D, M),
fail.
'$run_at_thread_start'.

View File

@ -394,7 +394,7 @@ initialization(G,OPT) :-
'$do_error'(type_error(OPT),initialization(G,OPT))
).
'$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).
% ignore for now.
@ -412,7 +412,7 @@ initialization(G,OPT) :-
recorded('$system_initialisation',G,R),
erase(R),
G \= '$',
'$exit_system_mode'(G, prolog),
once( call(G) ),
fail.
'$exec_initialisation_goals' :-
'$show_consult_level'(Level),

View File

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

View File

@ -50,10 +50,12 @@ findall(Template, Generator, Answers, SoFar) :-
nb:nb_queue(Ref),
(
'$execute'(Generator),
'$stop_creeping',
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),
( '$catch'(Error,'$clean_findall'(Ref,Error),_),
'$execute'(G),
'$stop_creeping',
'$db_enqueue'(Ref, T),
fail
;
'$stop_creeping',
'$$set'(S,Ref)
).