make sure that YAP_Restart does not restart a failed goal.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1855 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
a8409c5f52
commit
0b7083adb2
@ -10,8 +10,11 @@
|
|||||||
* File: c_interface.c *
|
* File: c_interface.c *
|
||||||
* comments: c_interface primitives definition *
|
* comments: c_interface primitives definition *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2007-01-28 14:26:36 $,$Author: vsc $ *
|
* Last rev: $Date: 2007-03-22 11:12:20 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.89 2007/01/28 14:26:36 vsc
|
||||||
|
* WIN32 support
|
||||||
|
*
|
||||||
* Revision 1.88 2007/01/08 08:27:19 vsc
|
* Revision 1.88 2007/01/08 08:27:19 vsc
|
||||||
* fix restore (Trevor)
|
* fix restore (Trevor)
|
||||||
* make indexing a bit faster on IDB
|
* make indexing a bit faster on IDB
|
||||||
@ -1063,6 +1066,7 @@ YAP_RunGoal(Term t)
|
|||||||
yamop *old_CP = CP;
|
yamop *old_CP = CP;
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
|
|
||||||
|
Yap_AllowRestart = FALSE;
|
||||||
Yap_PrologMode = UserMode;
|
Yap_PrologMode = UserMode;
|
||||||
out = Yap_RunTopGoal(t);
|
out = Yap_RunTopGoal(t);
|
||||||
Yap_PrologMode = UserCCallMode;
|
Yap_PrologMode = UserCCallMode;
|
||||||
@ -1070,9 +1074,11 @@ YAP_RunGoal(Term t)
|
|||||||
P = (yamop *)ENV[E_CP];
|
P = (yamop *)ENV[E_CP];
|
||||||
ENV = (CELL *)ENV[E_E];
|
ENV = (CELL *)ENV[E_E];
|
||||||
CP = old_CP;
|
CP = old_CP;
|
||||||
|
Yap_AllowRestart = TRUE;
|
||||||
} else {
|
} else {
|
||||||
if (B != NULL) /* restore might have destroyed B */
|
if (B != NULL) /* restore might have destroyed B */
|
||||||
B = B->cp_b;
|
B = B->cp_b;
|
||||||
|
Yap_AllowRestart = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
@ -1085,6 +1091,8 @@ YAP_RestartGoal(void)
|
|||||||
int out;
|
int out;
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
|
|
||||||
|
if (Yap_AllowRestart) {
|
||||||
|
fprintf(stderr,"Allow restart\n");
|
||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
do_putcf = myputc;
|
do_putcf = myputc;
|
||||||
Yap_PrologMode = UserMode;
|
Yap_PrologMode = UserMode;
|
||||||
@ -1093,8 +1101,11 @@ YAP_RestartGoal(void)
|
|||||||
if (out == FALSE) {
|
if (out == FALSE) {
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
Yap_trust_last();
|
Yap_trust_last();
|
||||||
|
Yap_AllowRestart = FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
return(out);
|
return(out);
|
||||||
}
|
}
|
||||||
|
2
C/init.c
2
C/init.c
@ -986,6 +986,7 @@ InitCodes(void)
|
|||||||
Yap_heap_regs->wl[i].global_variables = NULL;
|
Yap_heap_regs->wl[i].global_variables = NULL;
|
||||||
Yap_heap_regs->wl[i].global_arena = 0L;
|
Yap_heap_regs->wl[i].global_arena = 0L;
|
||||||
Yap_heap_regs->wl[i].global_delay_arena = 0L;
|
Yap_heap_regs->wl[i].global_delay_arena = 0L;
|
||||||
|
Yap_heap_regs->wl[i].allow_restart = FALSE;
|
||||||
Yap_heap_regs->wl[i].consultlow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
|
Yap_heap_regs->wl[i].consultlow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
|
||||||
if (Yap_heap_regs->wl[i].consultlow == NULL) {
|
if (Yap_heap_regs->wl[i].consultlow == NULL) {
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCodes");
|
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCodes");
|
||||||
@ -1001,6 +1002,7 @@ InitCodes(void)
|
|||||||
Yap_heap_regs->wl.static_arrays = NULL;
|
Yap_heap_regs->wl.static_arrays = NULL;
|
||||||
Yap_heap_regs->wl.global_variables = NULL;
|
Yap_heap_regs->wl.global_variables = NULL;
|
||||||
Yap_heap_regs->wl.global_arena = 0L;
|
Yap_heap_regs->wl.global_arena = 0L;
|
||||||
|
Yap_heap_regs->wl.allow_restart = FALSE;
|
||||||
Yap_heap_regs->wl.global_delay_arena = 0L;
|
Yap_heap_regs->wl.global_delay_arena = 0L;
|
||||||
Yap_heap_regs->wl.consultlow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
|
Yap_heap_regs->wl.consultlow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
|
||||||
if (Yap_heap_regs->wl.consultlow == NULL) {
|
if (Yap_heap_regs->wl.consultlow == NULL) {
|
||||||
|
4
H/Heap.h
4
H/Heap.h
@ -10,7 +10,7 @@
|
|||||||
* File: Heap.h *
|
* File: Heap.h *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: Heap Init Structure *
|
* comments: Heap Init Structure *
|
||||||
* version: $Id: Heap.h,v 1.113 2007-02-18 00:26:36 vsc Exp $ *
|
* version: $Id: Heap.h,v 1.114 2007-03-22 11:12:21 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/* information that can be stored in Code Space */
|
/* information that can be stored in Code Space */
|
||||||
@ -166,6 +166,7 @@ typedef struct worker_local_struct {
|
|||||||
struct array_entry *dynamic_arrays;
|
struct array_entry *dynamic_arrays;
|
||||||
struct static_array_entry *static_arrays;
|
struct static_array_entry *static_arrays;
|
||||||
struct global_entry *global_variables;
|
struct global_entry *global_variables;
|
||||||
|
int allow_restart;
|
||||||
Term global_arena;
|
Term global_arena;
|
||||||
Term global_delay_arena;
|
Term global_delay_arena;
|
||||||
yamop trust_lu_code[3];
|
yamop trust_lu_code[3];
|
||||||
@ -919,6 +920,7 @@ struct various_codes *Yap_heap_regs;
|
|||||||
#define StaticArrays Yap_heap_regs->WL.static_arrays
|
#define StaticArrays Yap_heap_regs->WL.static_arrays
|
||||||
#define GlobalVariables Yap_heap_regs->WL.global_variables
|
#define GlobalVariables Yap_heap_regs->WL.global_variables
|
||||||
#define GlobalArena Yap_heap_regs->WL.global_arena
|
#define GlobalArena Yap_heap_regs->WL.global_arena
|
||||||
|
#define Yap_AllowRestart Yap_heap_regs->WL.allow_restart
|
||||||
#define GlobalDelayArena Yap_heap_regs->WL.global_delay_arena
|
#define GlobalDelayArena Yap_heap_regs->WL.global_delay_arena
|
||||||
#define profiling Yap_heap_regs->compiler_profiling
|
#define profiling Yap_heap_regs->compiler_profiling
|
||||||
#define call_counting Yap_heap_regs->compiler_call_counting
|
#define call_counting Yap_heap_regs->compiler_call_counting
|
||||||
|
@ -11,8 +11,12 @@
|
|||||||
* File: rheap.h *
|
* File: rheap.h *
|
||||||
* comments: walk through heap code *
|
* comments: walk through heap code *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2007-02-18 00:26:36 $,$Author: vsc $ *
|
* Last rev: $Date: 2007-03-22 11:12:21 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.73 2007/02/18 00:26:36 vsc
|
||||||
|
* fix atom garbage collector (although it is still off by default)
|
||||||
|
* make valgrind feel better
|
||||||
|
*
|
||||||
* Revision 1.72 2007/01/08 08:27:19 vsc
|
* Revision 1.72 2007/01/08 08:27:19 vsc
|
||||||
* fix restore (Trevor)
|
* fix restore (Trevor)
|
||||||
* make indexing a bit faster on IDB
|
* make indexing a bit faster on IDB
|
||||||
@ -773,6 +777,7 @@ restore_codes(void)
|
|||||||
Yap_heap_regs->wl.global_delay_arena =
|
Yap_heap_regs->wl.global_delay_arena =
|
||||||
GlobalAdjust(Yap_heap_regs->wl.global_delay_arena);
|
GlobalAdjust(Yap_heap_regs->wl.global_delay_arena);
|
||||||
}
|
}
|
||||||
|
Yap_heap_regs->wl.allow_restart = FALSE;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (Yap_heap_regs->last_wtime != NULL)
|
if (Yap_heap_regs->last_wtime != NULL)
|
||||||
|
@ -120,4 +120,3 @@ getrand(rand(X,Y,Z)) :-
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1075,3 +1075,4 @@ throw(Ball) :-
|
|||||||
nb_setval('$system_mode',off),
|
nb_setval('$system_mode',off),
|
||||||
( nb_getval('$trace',on) -> '$creep' ; true).
|
( nb_getval('$trace',on) -> '$creep' ; true).
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user