fix EX: it cannot be a term and it should be a placeholder for BallTerm,
so the twp can never be alive at the same time.
This commit is contained in:
parent
92a8e37769
commit
3dd68aa8bd
@ -7542,13 +7542,16 @@ Yap_absmi(int inp)
|
||||
save_machine_regs();
|
||||
|
||||
SREG = (CELL *) YAP_Execute(p, p->cs.f_code);
|
||||
EX = 0L;
|
||||
}
|
||||
Yap_CloseSlots();
|
||||
|
||||
restore_machine_regs();
|
||||
setregs();
|
||||
Yap_PrologMode = UserMode;
|
||||
restore_machine_regs();
|
||||
if (EX) {
|
||||
struct DB_TERM *exp = EX;
|
||||
EX = NULL;
|
||||
Yap_JumpToEnv(Yap_PopTermFromDB(exp));
|
||||
}
|
||||
if (!SREG) {
|
||||
FAIL();
|
||||
}
|
||||
|
@ -2040,7 +2040,24 @@ YAP_GoalHasException(Term *t)
|
||||
int out = FALSE;
|
||||
BACKUP_MACHINE_REGS();
|
||||
if (EX) {
|
||||
*t = EX;
|
||||
do {
|
||||
*t = Yap_FetchTermFromDB(EX);
|
||||
if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
if (!Yap_growglobal(NULL)) {
|
||||
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage);
|
||||
RECOVER_MACHINE_REGS();
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
if (!Yap_growstack(EX->NOfCells*CellSize)) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||
RECOVER_MACHINE_REGS();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
} while (*t == (CELL)0);
|
||||
out = TRUE;
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
@ -2051,7 +2068,11 @@ X_API void
|
||||
YAP_ClearExceptions(void)
|
||||
{
|
||||
Yap_ResetExceptionTerm();
|
||||
EX = 0L;
|
||||
if (EX) {
|
||||
BallTerm = EX;
|
||||
}
|
||||
EX = NULL;
|
||||
Yap_ResetExceptionTerm();
|
||||
UncaughtThrow = FALSE;
|
||||
}
|
||||
|
||||
|
9
C/exec.c
9
C/exec.c
@ -1007,7 +1007,7 @@ init_stack(int arity, CELL *pt, int top, choiceptr saved_b)
|
||||
/* create an initial pseudo environment so that when garbage
|
||||
collection is going up in the environment chain it doesn't get
|
||||
confused */
|
||||
EX = 0L;
|
||||
EX = NULL;
|
||||
// sl = Yap_InitSlot(t);
|
||||
YENV = ASP;
|
||||
YENV[E_CP] = (CELL)P;
|
||||
@ -1502,7 +1502,8 @@ JumpToEnv(Term t) {
|
||||
B = handler;
|
||||
else
|
||||
previous->cp_b = handler;
|
||||
EX = t;
|
||||
EX = BallTerm;
|
||||
BallTerm = NULL;
|
||||
P = (yamop *)FAILCODE;
|
||||
HB = B->cp_h;
|
||||
return TRUE;
|
||||
@ -1622,7 +1623,7 @@ Yap_InitYaamRegs(void)
|
||||
LOCK(SignalLock);
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
EX = 0L;
|
||||
EX = NULL;
|
||||
init_stack(0, NULL, TRUE, NULL);
|
||||
/* the first real choice-point will also have AP=FAIL */
|
||||
CurSlot = 0;
|
||||
@ -1725,7 +1726,7 @@ static Int
|
||||
p_reset_exception(void)
|
||||
{
|
||||
Term t;
|
||||
EX = 0L;
|
||||
EX = NULL;
|
||||
t = GetException();
|
||||
if (!t)
|
||||
return FALSE;
|
||||
|
2
H/Regs.h
2
H/Regs.h
@ -110,7 +110,7 @@ typedef struct
|
||||
CELL *AuxSp_; /* 9 Auxiliary stack pointer */
|
||||
ADDR AuxTop_; /* 10 Auxiliary stack top */
|
||||
/* visualc*/
|
||||
CELL EX_; /* 18 */
|
||||
struct DB_TERM * EX_; /* 18 */
|
||||
Term CurrentModule_;
|
||||
#if defined(SBA) || defined(TABLING)
|
||||
CELL *H_FZ_;
|
||||
|
@ -2444,7 +2444,7 @@ PL_exception(qid_t q)
|
||||
X_API void
|
||||
PL_clear_exception(void)
|
||||
{
|
||||
EX = 0L;
|
||||
EX = NULL;
|
||||
}
|
||||
|
||||
X_API int
|
||||
|
Reference in New Issue
Block a user