recover space on foreign exec

This commit is contained in:
Vítor Santos Costa 2018-09-21 13:31:22 +01:00
parent f6ca094534
commit 13d609867c
2 changed files with 9 additions and 21 deletions

View File

@ -1836,40 +1836,28 @@ X_API bool YAP_LeaveGoal(bool successful, YAP_dogoalinfo *dgi) {
}
handler = B;
while (handler
//&& LOCAL_CBorder > LCL0 - (CELL *)handler
&& LCL0-LOCAL_CBorder > (CELL *)handler
//&& handler->cp_ap != NOCODE
&& handler->cp_b != NULL
&& handler <= myB
&& handler != myB
) {
if (handler < myB)
if (handler < myB ) {
handler->cp_ap = TRUSTFAILCODE;
}
B = handler;
handler = handler->cp_b;
if (successful) {
Yap_TrimTrail();
} else {
} else if (!(LOCAL_PrologMode & AsyncIntMode)) {
P=FAILCODE;
Yap_exec_absmi(true, YAP_EXEC_ABSMI);
}
}
if (successful) {
CP = dgi->cp;
P = dgi->p;
} else {
LOCAL_CurSlot = dgi->CurSlot;
ENV = YENV = B->cp_env;
HR = B->cp_h;
TR = B->cp_tr;
// use the current choicepoint
// B=B->cp_b;
ASP=(CELL*)B;
}
if (B)
B = B->cp_b;
if (LOCAL_PrologMode & AsyncIntMode) {
Yap_signal(YAP_FAIL_SIGNAL);
}
P=dgi->p;
CP = dgi->cp;
RECOVER_MACHINE_REGS();
// fprintf(stderr,"LeftGoal success=%d: H=%d ENV=%p B=%d TR=%d P=%p CP=%p Slots=%d\n", successful,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, LOCAL_CurSlot);
return TRUE;

View File

@ -641,7 +641,7 @@ init_one_query(QueryID,Query,Type) :-
rb_new(H0),
maplist_to_hash(MapList, H0, Hash),
Tree \= [],
tree_to_grad(Tree, Hash, [], Grad),
tree_to_grad(Tree, Hash, [], Grad)
;
Bdd = bdd(-1,[],[]),
Grad=[]
@ -669,7 +669,7 @@ init_one_query(_QueryID,_Query,_Type) :-
%========================================================================
%= updates all values of query_probability/2 and query_gradient/4
%= Updates all values of query_probability/2 and query_gradient/4
%= should be called always before these predicates are accessed
%= if the old values are still valid, nothing happens
%========================================================================