error handling

This commit is contained in:
Vítor Santos Costa 2015-09-29 23:28:55 +01:00
parent db2cf949b4
commit 4c368a59d3
11 changed files with 39 additions and 19 deletions

View File

@ -561,7 +561,7 @@ typedef enum
LOCAL_PrologMode &= ~CritMode; \
if (LOCAL_PrologMode & AbortMode) { \
LOCAL_PrologMode &= ~AbortMode; \
Yap_Error(PURE_ABORT, 0, ""); \
Yap_Error(ABORT_EVENT, 0, ""); \
} \
GLOBAL_locks_who_locked_heap = MAX_WORKERS; \
UNLOCK(GLOBAL_locks_heap_access); \
@ -578,7 +578,7 @@ typedef enum
LOCAL_PrologMode &= ~CritMode; \
if (LOCAL_PrologMode & AbortMode) { \
LOCAL_PrologMode &= ~AbortMode; \
Yap_Error(PURE_ABORT, 0, ""); \
Yap_Error(ABORT_EVENT, 0, ""); \
Yap_RestartYap( 1 ); \
} \
/* UNLOCK(BGL); */ \

View File

@ -210,7 +210,7 @@
OPCODE(call_cpred ,Osbpp),
OPCODE(execute_cpred ,pp),
OPCODE(call_usercpred ,Osbpp),
OPCODE(call_c_wfail ,slp),
OPCODE(call_c_wfail ,slpp),
OPCODE(try_c ,OtapFs),
OPCODE(retry_c ,OtapFs),
OPCODE(cut_c ,OtapFs),

View File

@ -592,8 +592,9 @@ typedef struct yami {
COUNT s;
struct yami *l;
struct pred_entry *p;
struct pred_entry *p0;
CELL next;
} slp;
} slpp;
struct {
COUNT s;
Int I;

View File

@ -465,7 +465,7 @@ typedef enum {
} find_pred_type;
Int Yap_PredForCode(yamop *, find_pred_type, Atom *, UInt *, Term *);
PredEntry *Yap_PredEntryForCode(yamop *, find_pred_type, CODEADDR *, CODEADDR *);
PredEntry *Yap_PredEntryForCode(yamop *, find_pred_type, void* *, void* *);
LogUpdClause *Yap_new_ludbe(Term, PredEntry *, UInt);
Term Yap_LUInstance(LogUpdClause *, UInt);
@ -473,7 +473,9 @@ Term Yap_LUInstance(LogUpdClause *, UInt);
int Yap_new_udi_clause(PredEntry *, yamop *, Term);
yamop *Yap_udi_search(PredEntry *);
Term Yap_bug_location(yamop *codeptr, choiceptr b_ptr, CELL *env);
Term Yap_bug_location(yamop *p, yamop *cp, choiceptr b_ptr, CELL *env);
Term Yap_pc_location(yamop *p, choiceptr b_ptr, CELL *env);
Term Yap_env_location(yamop *p, choiceptr b_ptr, CELL *env, Int ignore_first);
#if LOW_PROF
void Yap_InformOfRemoval(void *);

View File

@ -299,6 +299,12 @@
#define REMOTE_Error_Term(wid) REMOTE(wid)->Error_Term_
#define LOCAL_Error_TYPE LOCAL->Error_TYPE_
#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_
#define LOCAL_Error_File LOCAL->Error_File_
#define REMOTE_Error_File(wid) REMOTE(wid)->Error_File_
#define LOCAL_Error_Function LOCAL->Error_Function_
#define REMOTE_Error_Function(wid) REMOTE(wid)->Error_Function_
#define LOCAL_Error_Lineno LOCAL->Error_Lineno_
#define REMOTE_Error_Lineno(wid) REMOTE(wid)->Error_Lineno_
#define LOCAL_Error_Size LOCAL->Error_Size_
#define REMOTE_Error_Size(wid) REMOTE(wid)->Error_Size_
#define LOCAL_ErrorSay LOCAL->ErrorSay_

View File

@ -167,7 +167,10 @@ typedef struct worker_local {
char* ErrorMessage_;
Term Error_Term_;
yap_error_number Error_TYPE_;
UInt Error_Size_;
const char* Error_File_;
const char* Error_Function_;
int Error_Lineno_;
size_t Error_Size_;
char ErrorSay_[MAX_ERROR_MSG_SIZE];
jmp_buf IOBotch_;
TokEntry* tokptr_;

View File

@ -180,6 +180,9 @@ static void InitWorker(int wid) {

View File

@ -513,12 +513,13 @@ restore_opcodes(yamop *pc, yamop *max USES_REGS)
pc->y_u.sllll.l4 = PtoOpAdjust(pc->y_u.sllll.l4);
pc = NEXTOP(pc,sllll);
break;
/* instructions type slp */
/* instructions type slpp */
case _call_c_wfail:
pc->y_u.slp.s = ConstantAdjust(pc->y_u.slp.s);
pc->y_u.slp.l = PtoOpAdjust(pc->y_u.slp.l);
pc->y_u.slp.p = PtoPredAdjust(pc->y_u.slp.p);
pc = NEXTOP(pc,slp);
pc->y_u.slpp.s = ConstantAdjust(pc->y_u.slpp.s);
pc->y_u.slpp.l = PtoOpAdjust(pc->y_u.slpp.l);
pc->y_u.slpp.p = PtoPredAdjust(pc->y_u.slpp.p);
pc->y_u.slpp.p0 = PtoPredAdjust(pc->y_u.slpp.p0);
pc = NEXTOP(pc,slpp);
break;
/* instructions type sssl */
case _go_on_cons:

View File

@ -188,6 +188,9 @@ static void RestoreWorker(int wid USES_REGS) {

View File

@ -530,12 +530,13 @@
CHECK(save_PtoOp(stream, pc->y_u.sllll.l4));
pc = NEXTOP(pc,sllll);
break;
/* instructions type slp */
/* instructions type slpp */
case _call_c_wfail:
CHECK(save_Constant(stream, pc->y_u.slp.s));
CHECK(save_PtoOp(stream, pc->y_u.slp.l));
CHECK(save_PtoPred(stream, pc->y_u.slp.p));
pc = NEXTOP(pc,slp);
CHECK(save_Constant(stream, pc->y_u.slpp.s));
CHECK(save_PtoOp(stream, pc->y_u.slpp.l));
CHECK(save_PtoPred(stream, pc->y_u.slpp.p));
CHECK(save_PtoPred(stream, pc->y_u.slpp.p0));
pc = NEXTOP(pc,slpp);
break;
/* instructions type sssl */
case _go_on_cons:

View File

@ -398,9 +398,9 @@
case _switch_on_sub_arg_type:
pc = NEXTOP(pc,sllll);
break;
/* instructions type slp */
/* instructions type slpp */
case _call_c_wfail:
pp = pc->y_u.slp.p;
pp = pc->y_u.slpp.p;
return walk_found_c_pred(pp, startp, endp);
/* instructions type sssl */
case _go_on_cons: