Merge branch 'master' of ../yap-6.2
This commit is contained in:
108
C/absmi.c
108
C/absmi.c
@@ -4261,17 +4261,17 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(get_bigint, xc);
|
||||
Op(get_bigint, xN);
|
||||
#ifdef USE_GMP
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xc.x);
|
||||
d0 = XREG(PREG->u.xN.x);
|
||||
deref_head(d0, gbigint_unk);
|
||||
|
||||
gbigint_nonvar:
|
||||
if (!IsApplTerm(d0))
|
||||
FAIL();
|
||||
/* we have met a preexisting bigint */
|
||||
START_PREFETCH(xc);
|
||||
START_PREFETCH(xN);
|
||||
BEGP(pt0);
|
||||
pt0 = RepAppl(d0);
|
||||
/* check functor */
|
||||
@@ -4279,9 +4279,9 @@ Yap_absmi(int inp)
|
||||
{
|
||||
FAIL();
|
||||
}
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.xc.c))
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.xN.b))
|
||||
FAIL();
|
||||
PREG = NEXTOP(PREG, xc);
|
||||
PREG = NEXTOP(PREG, xN);
|
||||
ENDP(pt0);
|
||||
/* enter read mode */
|
||||
GONext();
|
||||
@@ -4291,10 +4291,10 @@ Yap_absmi(int inp)
|
||||
deref_body(d0, pt0, gbigint_unk, gbigint_nonvar);
|
||||
/* Enter Write mode */
|
||||
/* set d1 to be the new structure we are going to create */
|
||||
START_PREFETCH(xc);
|
||||
START_PREFETCH(xN);
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.xc.c;
|
||||
PREG = NEXTOP(PREG, xc);
|
||||
d1 = PREG->u.xN.b;
|
||||
PREG = NEXTOP(PREG, xN);
|
||||
BIND(pt0, d1, bind_gbigint);
|
||||
#ifdef COROUTINING
|
||||
DO_TRAIL(pt0, d1);
|
||||
@@ -4313,16 +4313,16 @@ Yap_absmi(int inp)
|
||||
ENDOp();
|
||||
|
||||
|
||||
Op(get_dbterm, xc);
|
||||
Op(get_dbterm, xD);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xc.x);
|
||||
d0 = XREG(PREG->u.xD.x);
|
||||
deref_head(d0, gdbterm_unk);
|
||||
|
||||
gdbterm_nonvar:
|
||||
BEGD(d1);
|
||||
/* we have met a preexisting dbterm */
|
||||
d1 = PREG->u.xc.c;
|
||||
PREG = NEXTOP(PREG, xc);
|
||||
d1 = PREG->u.xD.D;
|
||||
PREG = NEXTOP(PREG, xD);
|
||||
UnifyBound(d0,d1);
|
||||
ENDD(d1);
|
||||
|
||||
@@ -4330,10 +4330,10 @@ Yap_absmi(int inp)
|
||||
deref_body(d0, pt0, gdbterm_unk, gdbterm_nonvar);
|
||||
/* Enter Write mode */
|
||||
/* set d1 to be the new structure we are going to create */
|
||||
START_PREFETCH(xc);
|
||||
START_PREFETCH(xD);
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.xc.c;
|
||||
PREG = NEXTOP(PREG, xc);
|
||||
d1 = PREG->u.xD.D;
|
||||
PREG = NEXTOP(PREG, xD);
|
||||
BIND(pt0, d1, bind_gdbterm);
|
||||
#ifdef COROUTINING
|
||||
DO_TRAIL(pt0, d1);
|
||||
@@ -6347,7 +6347,7 @@ Yap_absmi(int inp)
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
Op(unify_bigint, oc);
|
||||
Op(unify_bigint, oN);
|
||||
#ifdef USE_GMP
|
||||
BEGD(d0);
|
||||
BEGP(pt0);
|
||||
@@ -6368,16 +6368,16 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
ENDD(d1);
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.oc.c))
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.oN.b))
|
||||
FAIL();
|
||||
PREG = NEXTOP(PREG, oc);
|
||||
PREG = NEXTOP(PREG, oN);
|
||||
ENDP(pt0);
|
||||
GONext();
|
||||
|
||||
derefa_body(d0, pt0, ubigint_unk, ubigint_nonvar);
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.oc.c;
|
||||
PREG = NEXTOP(PREG, oc);
|
||||
d1 = PREG->u.oN.b;
|
||||
PREG = NEXTOP(PREG, oN);
|
||||
BIND_GLOBAL(pt0, d1, bind_ubigint);
|
||||
#ifdef COROUTINING
|
||||
DO_TRAIL(pt0, d1);
|
||||
@@ -6393,7 +6393,7 @@ Yap_absmi(int inp)
|
||||
#endif
|
||||
ENDOp();
|
||||
|
||||
Op(unify_l_bigint, oc);
|
||||
Op(unify_l_bigint, oN);
|
||||
#ifdef USE_GMP
|
||||
BEGD(d0);
|
||||
CACHE_S();
|
||||
@@ -6413,16 +6413,16 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
ENDD(d0);
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.oc.c))
|
||||
if (Yap_gmp_tcmp_big_big(d0,PREG->u.oN.b))
|
||||
FAIL();
|
||||
PREG = NEXTOP(PREG, oc);
|
||||
PREG = NEXTOP(PREG, oN);
|
||||
ENDP(pt0);
|
||||
GONext();
|
||||
|
||||
derefa_body(d0, S_SREG, ulbigint_unk, ulbigint_nonvar);
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.oc.c;
|
||||
PREG = NEXTOP(PREG, oc);
|
||||
d1 = PREG->u.oN.b;
|
||||
PREG = NEXTOP(PREG, oN);
|
||||
BIND_GLOBAL(S_SREG, d1, bind_ulbigint);
|
||||
#ifdef COROUTINING
|
||||
DO_TRAIL(S_SREG, d1);
|
||||
@@ -6438,7 +6438,7 @@ Yap_absmi(int inp)
|
||||
#endif
|
||||
ENDOp();
|
||||
|
||||
Op(unify_dbterm, oc);
|
||||
Op(unify_dbterm, oD);
|
||||
BEGD(d0);
|
||||
BEGP(pt0);
|
||||
pt0 = SREG++;
|
||||
@@ -6447,15 +6447,15 @@ Yap_absmi(int inp)
|
||||
udbterm_nonvar:
|
||||
BEGD(d1);
|
||||
/* we have met a preexisting dbterm */
|
||||
d1 = PREG->u.oc.c;
|
||||
PREG = NEXTOP(PREG, oc);
|
||||
d1 = PREG->u.oD.D;
|
||||
PREG = NEXTOP(PREG, oD);
|
||||
UnifyBound(d0,d1);
|
||||
ENDD(d1);
|
||||
|
||||
derefa_body(d0, pt0, udbterm_unk, udbterm_nonvar);
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.oc.c;
|
||||
PREG = NEXTOP(PREG, oc);
|
||||
d1 = PREG->u.oD.D;
|
||||
PREG = NEXTOP(PREG, oD);
|
||||
BIND_GLOBAL(pt0, d1, bind_udbterm);
|
||||
#ifdef COROUTINING
|
||||
DO_TRAIL(pt0, d1);
|
||||
@@ -6468,7 +6468,7 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(unify_l_dbterm, oc);
|
||||
Op(unify_l_dbterm, oD);
|
||||
BEGD(d0);
|
||||
CACHE_S();
|
||||
READ_IN_S();
|
||||
@@ -6477,15 +6477,15 @@ Yap_absmi(int inp)
|
||||
uldbterm_nonvar:
|
||||
BEGD(d1);
|
||||
/* we have met a preexisting dbterm */
|
||||
d1 = PREG->u.oc.c;
|
||||
PREG = NEXTOP(PREG, oc);
|
||||
d1 = PREG->u.oD.D;
|
||||
PREG = NEXTOP(PREG, oD);
|
||||
UnifyBound(d0,d1);
|
||||
ENDD(d1);
|
||||
|
||||
derefa_body(d0, S_SREG, uldbterm_unk, uldbterm_nonvar);
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.oc.c;
|
||||
PREG = NEXTOP(PREG, oc);
|
||||
d1 = PREG->u.oD.D;
|
||||
PREG = NEXTOP(PREG, oD);
|
||||
BIND_GLOBAL(S_SREG, d1, bind_uldbterm);
|
||||
#ifdef COROUTINING
|
||||
DO_TRAIL(S_SREG, d1);
|
||||
@@ -6907,8 +6907,26 @@ Yap_absmi(int inp)
|
||||
GONext();
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(put_dbterm, xD);
|
||||
BEGD(d0);
|
||||
d0 = PREG->u.xD.D;
|
||||
XREG(PREG->u.xD.x) = d0;
|
||||
PREG = NEXTOP(PREG, xD);
|
||||
GONext();
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(put_float, xd);
|
||||
Op(put_bigint, xN);
|
||||
BEGD(d0);
|
||||
d0 = PREG->u.xN.b;
|
||||
XREG(PREG->u.xN.x) = d0;
|
||||
PREG = NEXTOP(PREG, xN);
|
||||
GONext();
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(put_float, xd);
|
||||
BEGD(d0);
|
||||
d0 = AbsAppl(PREG->u.xd.d);
|
||||
XREG(PREG->u.xd.x) = d0;
|
||||
@@ -7101,6 +7119,24 @@ Yap_absmi(int inp)
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
Op(write_bigint, N);
|
||||
BEGD(d0);
|
||||
d0 = PREG->u.N.b;
|
||||
*SREG++ = d0;
|
||||
ENDD(d0);
|
||||
PREG = NEXTOP(PREG, N);
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
Op(write_dbterm, D);
|
||||
BEGD(d0);
|
||||
d0 = PREG->u.D.D;
|
||||
*SREG++ = d0;
|
||||
ENDD(d0);
|
||||
PREG = NEXTOP(PREG, D);
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
Op(write_float, d);
|
||||
BEGD(d0);
|
||||
d0 = AbsAppl(PREG->u.d.d);
|
||||
|
||||
16
C/agc.c
16
C/agc.c
@@ -114,20 +114,6 @@ AtomAdjust(Atom a)
|
||||
|
||||
static Term AdjustDBTerm(Term, Term *);
|
||||
|
||||
static Term
|
||||
CodeComposedTermAdjust(Term t)
|
||||
{
|
||||
Term *base;
|
||||
|
||||
if (IsApplTerm(t)) {
|
||||
base = RepAppl(t);
|
||||
} else {
|
||||
base = RepPair(t);
|
||||
}
|
||||
return AdjustDBTerm(t, base);
|
||||
}
|
||||
|
||||
|
||||
#define IsOldCode(P) FALSE
|
||||
#define IsOldCodeCellPtr(P) FALSE
|
||||
#define IsOldDelay(P) FALSE
|
||||
@@ -161,7 +147,7 @@ CodeComposedTermAdjust(Term t)
|
||||
#define ModEntryPtrAdjust(P) (P)
|
||||
#define AtomEntryAdjust(P) (P)
|
||||
#define GlobalEntryAdjust(P) (P)
|
||||
#define BlobTermAdjust(P) (P)
|
||||
#define BlobTermInCodeAdjust(P) (P)
|
||||
#define CellPtoHeapAdjust(P) (P)
|
||||
#define PtoAtomHashEntryAdjust(P) (P)
|
||||
#define CellPtoHeapCellAdjust(P) (P)
|
||||
|
||||
84
C/amasm.c
84
C/amasm.c
@@ -1083,15 +1083,15 @@ a_uc(CELL rnd1, op_numbers opcode, op_numbers opcode_w, yamop *code_p, int pass_
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_blob(CELL rnd1, op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
a_wblob(CELL rnd1, op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.c.c =
|
||||
code_p->u.N.b =
|
||||
AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[rnd1]));
|
||||
}
|
||||
*clause_has_blobsp = TRUE;
|
||||
GONEXT(c);
|
||||
GONEXT(N);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1117,11 +1117,11 @@ a_wdbt(CELL rnd1, op_numbers opcode, int *clause_has_dbtermp, yamop *code_p, int
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.c.c = rnd1;
|
||||
code_p->u.D.D = rnd1;
|
||||
add_to_dbtermsl(cip, cip->cpc->rnd1);
|
||||
}
|
||||
*clause_has_dbtermp = TRUE;
|
||||
GONEXT(c);
|
||||
GONEXT(D);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1130,13 +1130,13 @@ a_ublob(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_blobs
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.oc.opcw = emit_op(opcode_w);
|
||||
code_p->u.oc.c =
|
||||
code_p->u.oN.opcw = emit_op(opcode_w);
|
||||
code_p->u.oN.b =
|
||||
AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[rnd1]));
|
||||
|
||||
}
|
||||
*clause_has_blobsp = TRUE;
|
||||
GONEXT(oc);
|
||||
GONEXT(oN);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1145,12 +1145,12 @@ a_udbt(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_dbterm
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.oc.opcw = emit_op(opcode_w);
|
||||
code_p->u.oc.c = cip->cpc->rnd1;
|
||||
code_p->u.oD.opcw = emit_op(opcode_w);
|
||||
code_p->u.oD.D = cip->cpc->rnd1;
|
||||
add_to_dbtermsl(cip, cip->cpc->rnd1);
|
||||
}
|
||||
*clause_has_dbtermp = TRUE;
|
||||
GONEXT(oc);
|
||||
GONEXT(oD);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1372,11 +1372,11 @@ a_rb(op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, stru
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.xc.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xc.c = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1]));
|
||||
code_p->u.xN.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xN.b = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1]));
|
||||
}
|
||||
*clause_has_blobsp = TRUE;
|
||||
GONEXT(xc);
|
||||
GONEXT(xN);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1385,12 +1385,12 @@ a_dbt(op_numbers opcode, int *clause_has_dbtermp, yamop *code_p, int pass_no, st
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.xc.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xc.c = cip->cpc->rnd1;
|
||||
code_p->u.xD.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xD.D = cip->cpc->rnd1;
|
||||
add_to_dbtermsl(cip, cip->cpc->rnd1);
|
||||
}
|
||||
*clause_has_dbtermp = TRUE;
|
||||
GONEXT(xc);
|
||||
GONEXT(xD);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@@ -1480,7 +1480,7 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, struct i
|
||||
op = _p_equal; /* just to make some compilers happy */
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "internal assembler error for built-in (%d)", (Flags & 0x7f));
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
}
|
||||
if (is_test) {
|
||||
UInt lab;
|
||||
@@ -1503,7 +1503,7 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, struct i
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil,
|
||||
"user defined predicate cannot be a test predicate");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
} else
|
||||
code_p->opc = emit_op(_call_c_wfail);
|
||||
code_p->u.slp.s =
|
||||
@@ -2053,7 +2053,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
|
||||
if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) {
|
||||
/* OOOPS, got in trouble, must do a longjmp and recover space */
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch,2);
|
||||
siglongjmp(cip->CompilerBotch,2);
|
||||
}
|
||||
Yap_LUIndexSpace_CP += size;
|
||||
#ifdef DEBUG
|
||||
@@ -2693,7 +2693,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _plus:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for +/2 (should be XC)");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _minus:
|
||||
code_p->opc = emit_op(_p_minus_y_cv);
|
||||
@@ -2701,7 +2701,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _times:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for */2 (should be XC)");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _div:
|
||||
code_p->opc = emit_op(_p_div_y_cv);
|
||||
@@ -2709,12 +2709,12 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _and:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for /\\/2 (should be XC)");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _or:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for \\//2 (should be XC)");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _sll:
|
||||
code_p->opc = emit_op(_p_sll_y_cv);
|
||||
@@ -2744,7 +2744,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _minus:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error XC for -/2");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _times:
|
||||
code_p->opc = emit_op(_p_times_y_vc);
|
||||
@@ -2777,7 +2777,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _arg:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error for arg/3");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _functor:
|
||||
code_p->opc = emit_op(_p_func2s_y_vc);
|
||||
@@ -2838,7 +2838,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _plus:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for +/2");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _minus:
|
||||
code_p->opc = emit_op(_p_minus_cv);
|
||||
@@ -2846,7 +2846,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _times:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for */2");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _div:
|
||||
code_p->opc = emit_op(_p_div_cv);
|
||||
@@ -2854,12 +2854,12 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _and:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for /\\/2");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _or:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for \\//2");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _sll:
|
||||
code_p->opc = emit_op(_p_sll_cv);
|
||||
@@ -2889,7 +2889,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _minus:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error XC for -/2");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _times:
|
||||
code_p->opc = emit_op(_p_times_vc);
|
||||
@@ -2922,7 +2922,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
|
||||
case _arg:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error for arg/3");
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
break;
|
||||
case _functor:
|
||||
code_p->opc = emit_op(_p_func2s_vc);
|
||||
@@ -3248,10 +3248,10 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
code_p = a_ri(_put_longint, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case put_bigint_op:
|
||||
code_p = a_rb(_put_atom, clause_has_blobsp, code_p, pass_no, cip);
|
||||
code_p = a_rb(_put_bigint, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case put_dbterm_op:
|
||||
code_p = a_dbt(_put_atom, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
code_p = a_dbt(_put_dbterm, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
break;
|
||||
case get_list_op:
|
||||
code_p = a_glist(&do_not_optimise_uatom, code_p, pass_no, cip);
|
||||
@@ -3344,10 +3344,10 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
code_p = a_wi(_write_longint, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case write_bigint_op:
|
||||
code_p = a_blob(cip->cpc->rnd1, _write_atom, clause_has_blobsp, code_p, pass_no, cip);
|
||||
code_p = a_wblob(cip->cpc->rnd1, _write_bigint, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case write_dbterm_op:
|
||||
code_p = a_wdbt(cip->cpc->rnd1, _write_atom, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
code_p = a_wdbt(cip->cpc->rnd1, _write_dbterm, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
break;
|
||||
case unify_list_op:
|
||||
code_p = a_ue(_unify_list, _unify_list_write, code_p, pass_no);
|
||||
@@ -3540,7 +3540,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
if (CellPtr(cip->label_offset+cip->cpc->rnd1) > ASP-256) {
|
||||
Yap_Error_Size = 256+((char *)(cip->label_offset+cip->cpc->rnd1) - (char *)H);
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 3);
|
||||
siglongjmp(cip->CompilerBotch, 3);
|
||||
}
|
||||
if ( (char *)(cip->label_offset+cip->cpc->rnd1) >= cip->freep)
|
||||
cip->freep = (char *)(cip->label_offset+(cip->cpc->rnd1+1));
|
||||
@@ -3722,7 +3722,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
if (cip->cpc->nextInst->op != bccall_op) {
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "compiling binary test", (int) cip->cpc->op);
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
}
|
||||
code_p = a_bfunc(cip->cpc->nextInst->rnd2, &clinfo, code_p, pass_no, cip);
|
||||
break;
|
||||
@@ -3762,7 +3762,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
default:
|
||||
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "instruction %d found while assembling", (int) cip->cpc->op);
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, 1);
|
||||
siglongjmp(cip->CompilerBotch, 1);
|
||||
}
|
||||
cip->cpc = cip->cpc->nextInst;
|
||||
}
|
||||
@@ -3788,7 +3788,7 @@ fetch_clause_space(Term* tp, UInt size, struct intermediates *cip, UInt *osizep)
|
||||
case OUT_OF_STACK_ERROR:
|
||||
Yap_Error_Size = 256+((char *)cip->freep - (char *)H);
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch,3);
|
||||
siglongjmp(cip->CompilerBotch,3);
|
||||
case OUT_OF_TRAIL_ERROR:
|
||||
/* don't just return NULL */
|
||||
ARG1 = *tp;
|
||||
@@ -3865,7 +3865,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
||||
Yap_LabelFirstArraySz = DEFAULT_NLABELS;
|
||||
if (!Yap_LabelFirstArray) {
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
}
|
||||
if (Yap_LabelFirstArray && max_label <= Yap_LabelFirstArraySz) {
|
||||
@@ -3874,7 +3874,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
||||
cip->label_offset = (Int *)Yap_AllocCodeSpace(sizeof(Int)*max_label);
|
||||
if (!cip->label_offset) {
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
C/cdmgr.c
16
C/cdmgr.c
@@ -771,8 +771,10 @@ get_pred(Term t, Term tmod, char *pname)
|
||||
#define ModuleAdjust(X) (X)
|
||||
#define ExternalFunctionAdjust(X) (X)
|
||||
#define AdjustSwitchTable(X,Y,Z)
|
||||
#define DBGroundTermAdjust(X) (X)
|
||||
#define rehash(A,B,C)
|
||||
static Term BlobTermAdjust(Term t)
|
||||
|
||||
static Term BlobTermInCodeAdjust(Term t)
|
||||
{
|
||||
#if TAGS_FAST_OPS
|
||||
return t-ClDiff;
|
||||
@@ -781,22 +783,12 @@ static Term BlobTermAdjust(Term t)
|
||||
#endif
|
||||
}
|
||||
|
||||
static Term ConstantTermAdjust (Term);
|
||||
|
||||
static Term
|
||||
ConstantTermAdjust (Term t)
|
||||
{
|
||||
if (IsAtomTerm(t))
|
||||
return AtomTermAdjust(t);
|
||||
else if (IsIntTerm(t))
|
||||
return t;
|
||||
else if (IsApplTerm(t) && IsBlobFunctor(FunctorOfTerm(t))) {
|
||||
return BlobTermAdjust(t);
|
||||
} else if (IsApplTerm(t) || IsPairTerm(t)) {
|
||||
return CodeComposedTermAdjust(t);
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
|
||||
92
C/compiler.c
92
C/compiler.c
@@ -533,7 +533,7 @@ optimize_ce(Term t, unsigned int arity, unsigned int level, compiler_struct *cgl
|
||||
if (H >= (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
p->NextCE = cglobs->common_exps;
|
||||
cglobs->common_exps = p;
|
||||
@@ -568,7 +568,7 @@ compile_sf_term(Term t, int argno, int level)
|
||||
Yap_Error_Term = TermNil;
|
||||
Yap_ErrorMessage = "illegal argument of soft functor";
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
}
|
||||
else
|
||||
c_var(t, -argno, arity, level, cglobs);
|
||||
@@ -595,7 +595,7 @@ c_args(Term app, unsigned int level, compiler_struct *cglobs)
|
||||
Yap_Error_Term = TermNil;
|
||||
Yap_ErrorMessage = "exceed maximum arity of compiled goal";
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
}
|
||||
if (Arity > cglobs->max_args)
|
||||
cglobs->max_args = Arity;
|
||||
@@ -615,7 +615,7 @@ try_store_as_dbterm(Term t, Int argno, unsigned int arity, int level, compiler_s
|
||||
/* oops, too deep a term */
|
||||
save_machine_regs();
|
||||
Yap_Error_Size = 0;
|
||||
_longjmp(cglobs->cint.CompilerBotch, OUT_OF_AUX_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_AUX_BOTCH);
|
||||
}
|
||||
if (g < 16)
|
||||
return FALSE;
|
||||
@@ -626,18 +626,18 @@ try_store_as_dbterm(Term t, Int argno, unsigned int arity, int level, compiler_s
|
||||
switch(Yap_Error_TYPE) {
|
||||
case OUT_OF_STACK_ERROR:
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_STACK_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_STACK_BOTCH);
|
||||
case OUT_OF_TRAIL_ERROR:
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TRAIL_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TRAIL_BOTCH);
|
||||
case OUT_OF_HEAP_ERROR:
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_HEAP_BOTCH);
|
||||
case OUT_OF_AUXSPACE_ERROR:
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_AUX_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_AUX_BOTCH);
|
||||
default:
|
||||
_longjmp(cglobs->cint.CompilerBotch,COMPILER_ERR_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,COMPILER_ERR_BOTCH);
|
||||
}
|
||||
}
|
||||
H = h0;
|
||||
@@ -1004,7 +1004,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2 with output bound", s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
}
|
||||
} else { /* t1 is bound */
|
||||
@@ -1019,7 +1019,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/3",s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
} else {
|
||||
if (Op == _functor) {
|
||||
@@ -1035,7 +1035,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling functor/3");
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
i2 = IntegerOfTerm(t2);
|
||||
if (i2 < 0) {
|
||||
@@ -1047,7 +1047,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling functor/3");
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
if (IsNumTerm(t1)) {
|
||||
/* we will always fail */
|
||||
@@ -1062,7 +1062,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling functor/3");
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
if (i2 == 0)
|
||||
c_eq(t1, t3, cglobs);
|
||||
@@ -1074,7 +1074,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
if (H+2 >= (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
RESET_VARIABLE(H);
|
||||
RESET_VARIABLE(H+1);
|
||||
@@ -1086,7 +1086,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
if (H >= (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
RESET_VARIABLE(H);
|
||||
H++;
|
||||
@@ -1098,7 +1098,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Prop p0 = PredPropByFunc(f, mod);
|
||||
if (EndOfPAEntr(p0)) {
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
c_args(Goal, 0, cglobs);
|
||||
Yap_emit(safe_call_op, (CELL)p0 , Zero, &cglobs->cint);
|
||||
@@ -1120,7 +1120,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2", s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
if (IsAtomicTerm(t2) ||
|
||||
(IsApplTerm(t2) && IsExtensionFunctor(FunctorOfTerm(t2)))) {
|
||||
@@ -1132,7 +1132,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2", s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
} else if (IsApplTerm(t2)) {
|
||||
Functor f = FunctorOfTerm(t2);
|
||||
if (i1 < 1 || i1 > ArityOfFunctor(f)) {
|
||||
@@ -1163,7 +1163,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2", s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
}
|
||||
if (Op == _functor) {
|
||||
@@ -1176,7 +1176,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2", s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
} else {
|
||||
if (!IsVarTerm(t2)) {
|
||||
Int arity;
|
||||
@@ -1191,7 +1191,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2", s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
arity = IntOfTerm(t2);
|
||||
if (arity < 0) {
|
||||
@@ -1209,12 +1209,12 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2", s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
if (H+1+arity >= (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
tnew = AbsAppl(H);
|
||||
*H++ = (CELL)Yap_MkFunctor(AtomOfTerm(t1),arity);
|
||||
@@ -1253,7 +1253,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2 with output bound", s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
}
|
||||
/* then we compile the opcode/result */
|
||||
@@ -1263,7 +1263,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
if (H == (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
c_var(tmpvar,f_flag,(unsigned int)Op, 0, cglobs);
|
||||
c_eq(tmpvar,t3, cglobs);
|
||||
@@ -1276,7 +1276,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
||||
Yap_bip_name(Op, s);
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2 with input unbound", s);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
} else if (IsNewVar(t3) && cglobs->curbranch == 0 && cglobs->cint.CurrentPred->PredFlags & TabledPredFlag) {
|
||||
Term nv = MkVarTerm();
|
||||
@@ -1342,7 +1342,7 @@ c_functor(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
|
||||
if (EndOfPAEntr(p0)) {
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
if (profiling)
|
||||
Yap_emit(enter_profiling_op, (CELL)RepPredProp(p0), Zero, &cglobs->cint);
|
||||
@@ -1443,7 +1443,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
Yap_Error_Term = M;
|
||||
Yap_ErrorMessage = "in module name";
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
}
|
||||
Goal = ArgOfTerm(2, Goal);
|
||||
mod = M;
|
||||
@@ -1561,7 +1561,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
p = RepPredProp(p0 = Yap_PredPropByAtomNonThreadLocal(atom, mod));
|
||||
if (EndOfPAEntr(p0)) {
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
/* if we are profiling, make sure we register we entered this predicate */
|
||||
if (profiling)
|
||||
@@ -1574,7 +1574,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
p = RepPredProp(p0 = Yap_PredPropByFunctorNonThreadLocal(f, mod));
|
||||
if (EndOfPAEntr(p0)) {
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
if (f == FunctorOr || f == FunctorVBar) {
|
||||
Term arg;
|
||||
@@ -1649,7 +1649,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
if (H == (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
savecpc = cglobs->cint.cpc;
|
||||
savencpc = FirstP->nextInst;
|
||||
@@ -1732,7 +1732,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
if (H == (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
push_branch(cglobs->onbranch, commitvar, cglobs);
|
||||
++cglobs->curbranch;
|
||||
@@ -1767,7 +1767,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
if (H == (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
cglobs->onlast = FALSE;
|
||||
c_var(commitvar, save_b_flag, 1, 0, cglobs);
|
||||
@@ -1882,7 +1882,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
Yap_ErrorMessage = Yap_ErrorSay;
|
||||
sprintf(Yap_ErrorMessage, "compiling %s/2 with second arg unbound", RepAtom(NameOfFunctor(p->FunctorOfPred))->StrOfAE);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,1);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||
}
|
||||
c_var(a1, bt1_flag, 2, 0, cglobs);
|
||||
cglobs->current_p0 = p0;
|
||||
@@ -1893,7 +1893,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
if (H == (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
c_eq(t2, a2, cglobs);
|
||||
c_var(a1, bt1_flag, 2, 0, cglobs);
|
||||
@@ -1906,7 +1906,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
if (H == (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
c_eq(t1, a1, cglobs);
|
||||
|
||||
@@ -1920,7 +1920,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
if (H == (CELL *)cglobs->cint.freep0) {
|
||||
/* oops, too many new variables */
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||
}
|
||||
c_eq(t2, a2, cglobs);
|
||||
c_var(t1, bt1_flag, 2, 0, cglobs);
|
||||
@@ -2287,7 +2287,7 @@ clear_bvarray(int var, CELL *bvarray
|
||||
Yap_ErrorMessage = "compiler internal error: variable initialised twice";
|
||||
fprintf(stderr," vsc: compiling7\n");
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
}
|
||||
cglobs->pbvars++;
|
||||
#endif
|
||||
@@ -2328,7 +2328,7 @@ push_bvmap(int label, PInstr *pcpc, compiler_struct *cglobs)
|
||||
Yap_Error_Term = TermNil;
|
||||
Yap_ErrorMessage = "Too many embedded disjunctions";
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
}
|
||||
/* the label instruction */
|
||||
bvstack[bvindex].lab = label;
|
||||
@@ -2351,7 +2351,7 @@ reset_bvmap(CELL *bvarray, int nperm, compiler_struct *cglobs)
|
||||
Yap_Error_Term = TermNil;
|
||||
Yap_ErrorMessage = "No embedding in disjunctions";
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
}
|
||||
env_size = (bvstack[bvindex-1].pc)->rnd1;
|
||||
size = env_size/(8*sizeof(CELL));
|
||||
@@ -2371,7 +2371,7 @@ pop_bvmap(CELL *bvarray, int nperm, compiler_struct *cglobs)
|
||||
Yap_Error_Term = TermNil;
|
||||
Yap_ErrorMessage = "Too few embedded disjunctions";
|
||||
/* save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); */
|
||||
siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); */
|
||||
}
|
||||
reset_bvmap(bvarray, nperm, cglobs);
|
||||
bvindex--;
|
||||
@@ -2641,7 +2641,7 @@ checktemp(Int arg, Int rn, compiler_vm_op ic, compiler_struct *cglobs)
|
||||
Yap_Error_Term = TermNil;
|
||||
Yap_ErrorMessage = "too many temporaries";
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH);
|
||||
}
|
||||
v->NoOfVE = cglobs->vadr = vadr = TempVar | target1;
|
||||
v->KindOfVE = TempVar;
|
||||
@@ -2774,7 +2774,7 @@ c_layout(compiler_struct *cglobs)
|
||||
Yap_Error_Term = TermNil;
|
||||
Yap_ErrorMessage = "wrong number of variables found in bitmap";
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -3319,7 +3319,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
||||
|
||||
/* make sure we know there was no error yet */
|
||||
Yap_ErrorMessage = NULL;
|
||||
if ((botch_why = _setjmp(cglobs.cint.CompilerBotch))) {
|
||||
if ((botch_why = sigsetjmp(cglobs.cint.CompilerBotch, 0))) {
|
||||
restore_machine_regs();
|
||||
reset_vars(cglobs.vtable);
|
||||
Yap_ReleaseCMem(&cglobs.cint);
|
||||
@@ -3420,7 +3420,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
||||
cglobs.vtable = NULL;
|
||||
Yap_Error_Size = (256+maxvnum)*sizeof(CELL);
|
||||
save_machine_regs();
|
||||
_longjmp(cglobs.cint.CompilerBotch,3);
|
||||
siglongjmp(cglobs.cint.CompilerBotch,3);
|
||||
}
|
||||
cglobs.Uses = (Int *)(H+maxvnum);
|
||||
cglobs.Contents = (Term *)(H+maxvnum+(sizeof(Int)/sizeof(CELL))*MaxTemps);
|
||||
|
||||
@@ -122,7 +122,7 @@ AllocCMem (UInt size, struct intermediates *cip)
|
||||
if (!p) {
|
||||
Yap_Error_Size = size;
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
Yap_CMemFirstBlock = p;
|
||||
Yap_CMemFirstBlockSz = blksz;
|
||||
@@ -132,7 +132,7 @@ AllocCMem (UInt size, struct intermediates *cip)
|
||||
if (!p) {
|
||||
Yap_Error_Size = size;
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
}
|
||||
p->u.next = cip->blks;
|
||||
@@ -152,7 +152,7 @@ AllocCMem (UInt size, struct intermediates *cip)
|
||||
if (ASP <= CellPtr (cip->freep) + 256) {
|
||||
Yap_Error_Size = 256+((char *)cip->freep - (char *)H);
|
||||
save_machine_regs();
|
||||
_longjmp(cip->CompilerBotch, OUT_OF_STACK_BOTCH);
|
||||
siglongjmp(cip->CompilerBotch, OUT_OF_STACK_BOTCH);
|
||||
}
|
||||
return (p);
|
||||
#endif
|
||||
|
||||
@@ -165,7 +165,7 @@ gc_growtrail(int committed, tr_fr_ptr begsTR, cont *old_cont_top0)
|
||||
#endif
|
||||
/* could not find more trail */
|
||||
save_machine_regs();
|
||||
_longjmp(Yap_gc_restore, 2);
|
||||
siglongjmp(Yap_gc_restore, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ check_pr_trail(tr_fr_ptr trp)
|
||||
if (!Yap_growtrail(0, TRUE) || TRUE) {
|
||||
/* could not find more trail */
|
||||
save_machine_regs();
|
||||
_longjmp(Yap_gc_restore, 2);
|
||||
siglongjmp(Yap_gc_restore, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3782,7 +3782,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
}
|
||||
#endif
|
||||
time_start = Yap_cputime();
|
||||
if (_setjmp(Yap_gc_restore) == 2) {
|
||||
if (sigsetjmp(Yap_gc_restore, 0) == 2) {
|
||||
UInt sz;
|
||||
|
||||
/* we cannot recover, fail system */
|
||||
|
||||
52
C/index.c
52
C/index.c
@@ -188,7 +188,7 @@
|
||||
* Revision 1.150 2005/12/23 00:20:13 vsc
|
||||
* updates to gprof
|
||||
* support for __POWER__
|
||||
* Try to saveregs before _longjmp.
|
||||
* Try to saveregs before siglongjmp.
|
||||
*
|
||||
* Revision 1.149 2005/12/17 03:25:39 vsc
|
||||
* major changes to support online event-based profiling
|
||||
@@ -832,14 +832,14 @@ sort_group(GroupDef *grp, CELL *top, struct intermediates *cint)
|
||||
if (!(base = (CELL *)Yap_AllocCodeSpace(2*max*sizeof(CELL)))) {
|
||||
save_machine_regs();
|
||||
Yap_Error_Size = 2*max*sizeof(CELL);
|
||||
_longjmp(cint->CompilerBotch,2);
|
||||
siglongjmp(cint->CompilerBotch,2);
|
||||
}
|
||||
#else
|
||||
base = top;
|
||||
while (top+2*max > (CELL *)Yap_TrailTop) {
|
||||
if (!Yap_growtrail(2*max*CellSize, TRUE)) {
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,4);
|
||||
siglongjmp(cint->CompilerBotch,4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2046,11 +2046,11 @@ groups_in(ClauseDef *min, ClauseDef *max, GroupDef *grp, struct intermediates *c
|
||||
Yap_Error_Size = sz;
|
||||
/* grow stack */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,4);
|
||||
siglongjmp(cint->CompilerBotch,4);
|
||||
#else
|
||||
if (!Yap_growtrail(sz, TRUE)) {
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,4);
|
||||
siglongjmp(cint->CompilerBotch,4);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -2179,7 +2179,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_
|
||||
if (cl == NULL) {
|
||||
/* grow stack */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,2);
|
||||
siglongjmp(cint->CompilerBotch,2);
|
||||
}
|
||||
Yap_LUIndexSpace_SW += sz;
|
||||
cl->ClFlags = SwitchTableMask|LogUpdMask|func_mask;
|
||||
@@ -2199,7 +2199,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_
|
||||
if (cl == NULL) {
|
||||
/* grow stack */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,2);
|
||||
siglongjmp(cint->CompilerBotch,2);
|
||||
}
|
||||
Yap_IndexSpace_SW += sz;
|
||||
cl->ClFlags = SwitchTableMask;
|
||||
@@ -2518,7 +2518,7 @@ suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermedi
|
||||
sz = (UInt)NEXTOP((yamop *)NULL,sssllp)+tels*sizeof(yamop *);
|
||||
if ((ncode = (yamop *)Yap_AllocCodeSpace(sz)) == NULL) {
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch, 2);
|
||||
siglongjmp(cint->CompilerBotch, 2);
|
||||
}
|
||||
#if DEBUG
|
||||
Yap_ExpandClauses++;
|
||||
@@ -3130,7 +3130,7 @@ copy_clauses(ClauseDef *max0, ClauseDef *min0, CELL *top, struct intermediates *
|
||||
Yap_Error_Size = sz;
|
||||
/* grow stack */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,4);
|
||||
siglongjmp(cint->CompilerBotch,4);
|
||||
}
|
||||
memcpy((void *)top, (void *)min0, sz);
|
||||
return (ClauseDef *)top;
|
||||
@@ -3324,7 +3324,7 @@ compile_index(struct intermediates *cint)
|
||||
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
||||
/* grow stack */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,2);
|
||||
siglongjmp(cint->CompilerBotch,2);
|
||||
}
|
||||
}
|
||||
cint->freep = (char *)H;
|
||||
@@ -3336,7 +3336,7 @@ compile_index(struct intermediates *cint)
|
||||
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
||||
/* grow stack */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,3);
|
||||
siglongjmp(cint->CompilerBotch,3);
|
||||
}
|
||||
cint->freep = (char *)(cint->cls+NClauses);
|
||||
#endif
|
||||
@@ -3381,7 +3381,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
||||
cint.cls = NULL;
|
||||
Yap_Error_Size = 0;
|
||||
|
||||
if ((setjres = _setjmp(cint.CompilerBotch)) == 3) {
|
||||
if ((setjres = sigsetjmp(cint.CompilerBotch, 0)) == 3) {
|
||||
restore_machine_regs();
|
||||
recover_from_failed_susp_on_cls(&cint, 0);
|
||||
if (!Yap_gcl(Yap_Error_Size, ap->ArityOfPE+NSlots, ENV, next_pc)) {
|
||||
@@ -3463,7 +3463,7 @@ push_stack(istack_entry *sp, Int arg, Term Tag, Term extra, struct intermediates
|
||||
{
|
||||
if (sp+1 > (istack_entry *)Yap_TrailTop) {
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,4);
|
||||
siglongjmp(cint->CompilerBotch,4);
|
||||
}
|
||||
sp->pos = arg;
|
||||
sp->val = Tag;
|
||||
@@ -4349,7 +4349,7 @@ expand_index(struct intermediates *cint) {
|
||||
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
||||
/* grow stack */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,2);
|
||||
siglongjmp(cint->CompilerBotch,2);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -4359,7 +4359,7 @@ expand_index(struct intermediates *cint) {
|
||||
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
||||
/* grow stack */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,3);
|
||||
siglongjmp(cint->CompilerBotch,3);
|
||||
}
|
||||
#endif
|
||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||
@@ -4377,7 +4377,7 @@ expand_index(struct intermediates *cint) {
|
||||
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
||||
/* grow stack */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,2);
|
||||
siglongjmp(cint->CompilerBotch,2);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -4386,7 +4386,7 @@ expand_index(struct intermediates *cint) {
|
||||
/* tell how much space we need (worst case) */
|
||||
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,3);
|
||||
siglongjmp(cint->CompilerBotch,3);
|
||||
}
|
||||
#endif
|
||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||
@@ -4485,7 +4485,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) {
|
||||
cint.cls = NULL;
|
||||
cint.code_addr = NULL;
|
||||
cint.label_offset = NULL;
|
||||
if ((cb = _setjmp(cint.CompilerBotch)) == 3) {
|
||||
if ((cb = sigsetjmp(cint.CompilerBotch, 0)) == 3) {
|
||||
restore_machine_regs();
|
||||
/* grow stack */
|
||||
recover_from_failed_susp_on_cls(&cint, 0);
|
||||
@@ -4695,7 +4695,7 @@ push_path(path_stack_entry *sp, yamop **pipc, ClauseDef *clp, struct intermediat
|
||||
{
|
||||
if (sp+1 > (path_stack_entry *)Yap_TrailTop) {
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,4);
|
||||
siglongjmp(cint->CompilerBotch,4);
|
||||
}
|
||||
sp->flag = pc_entry;
|
||||
sp->u.pce.pi_pc = pipc;
|
||||
@@ -4711,7 +4711,7 @@ fetch_new_block(path_stack_entry *sp, yamop **pipc, PredEntry *ap, struct interm
|
||||
{
|
||||
if (sp+1 > (path_stack_entry *)Yap_TrailTop) {
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,4);
|
||||
siglongjmp(cint->CompilerBotch,4);
|
||||
}
|
||||
/* add current position */
|
||||
sp->flag = block_entry;
|
||||
@@ -5484,9 +5484,9 @@ add_try(PredEntry *ap, ClauseDef *cls, yamop *next, struct intermediates *cint)
|
||||
LogUpdClause *lcl = ClauseCodeToLogUpdClause(cls->Code);
|
||||
|
||||
if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) {
|
||||
/* OOOPS, got in trouble, must do a _longjmp and recover space */
|
||||
/* OOOPS, got in trouble, must do a siglongjmp and recover space */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,2);
|
||||
siglongjmp(cint->CompilerBotch,2);
|
||||
}
|
||||
Yap_LUIndexSpace_CP += size;
|
||||
#ifdef DEBUG
|
||||
@@ -5510,9 +5510,9 @@ add_trust(LogUpdIndex *icl, ClauseDef *cls, struct intermediates *cint)
|
||||
PredEntry *ap = lcl->ClPred;
|
||||
|
||||
if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) {
|
||||
/* OOOPS, got in trouble, must do a _longjmp and recover space */
|
||||
/* OOOPS, got in trouble, must do a siglongjmp and recover space */
|
||||
save_machine_regs();
|
||||
_longjmp(cint->CompilerBotch,2);
|
||||
siglongjmp(cint->CompilerBotch,2);
|
||||
}
|
||||
Yap_LUIndexSpace_CP += size;
|
||||
#ifdef DEBUG
|
||||
@@ -6000,7 +6000,7 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
|
||||
cint.CurrentPred = ap;
|
||||
cint.expand_block = NULL;
|
||||
cint.CodeStart = cint.BlobsStart = cint.cpc = cint.icpc = NIL;
|
||||
if ((cb = _setjmp(cint.CompilerBotch)) == 3) {
|
||||
if ((cb = sigsetjmp(cint.CompilerBotch, 0)) == 3) {
|
||||
restore_machine_regs();
|
||||
Yap_gcl(Yap_Error_Size, ap->ArityOfPE, ENV, CP);
|
||||
save_machine_regs();
|
||||
@@ -6476,7 +6476,7 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
|
||||
}
|
||||
cint.expand_block = NULL;
|
||||
cint.CodeStart = cint.BlobsStart = cint.cpc = cint.icpc = NULL;
|
||||
if ((cb = _setjmp(cint.CompilerBotch)) == 3) {
|
||||
if ((cb = sigsetjmp(cint.CompilerBotch, 0)) == 3) {
|
||||
restore_machine_regs();
|
||||
Yap_gcl(Yap_Error_Size, ap->ArityOfPE, ENV, CP);
|
||||
save_machine_regs();
|
||||
|
||||
12
C/parser.c
12
C/parser.c
@@ -65,7 +65,7 @@ static char SccsId[] = "%W% %G%";
|
||||
/* weak backtraking mechanism based on long_jump */
|
||||
|
||||
typedef struct jmp_buff_struct {
|
||||
jmp_buf JmpBuff;
|
||||
sigjmp_buf JmpBuff;
|
||||
} JMPBUFF;
|
||||
|
||||
STATIC_PROTO(void GNextToken, (void));
|
||||
@@ -81,7 +81,7 @@ STATIC_PROTO(Term ParseTerm, (int, JMPBUFF *));
|
||||
Volatile CELL *saveH=H; \
|
||||
Volatile int savecurprio=curprio; \
|
||||
saveenv=FailBuff; \
|
||||
if(!_setjmp(newenv.JmpBuff)) { \
|
||||
if(!sigsetjmp(newenv.JmpBuff, 0)) { \
|
||||
FailBuff = &newenv; \
|
||||
S; \
|
||||
FailBuff=saveenv; \
|
||||
@@ -99,7 +99,7 @@ STATIC_PROTO(Term ParseTerm, (int, JMPBUFF *));
|
||||
Volatile TokEntry *saveT=Yap_tokptr; \
|
||||
Volatile CELL *saveH=H; \
|
||||
saveenv=FailBuff; \
|
||||
if(!_setjmp(newenv.JmpBuff)) { \
|
||||
if(!sigsetjmp(newenv.JmpBuff, 0)) { \
|
||||
FailBuff = &newenv; \
|
||||
S; \
|
||||
FailBuff=saveenv; \
|
||||
@@ -113,7 +113,7 @@ STATIC_PROTO(Term ParseTerm, (int, JMPBUFF *));
|
||||
}
|
||||
|
||||
|
||||
#define FAIL _longjmp(FailBuff->JmpBuff,1)
|
||||
#define FAIL siglongjmp(FailBuff->JmpBuff,1)
|
||||
|
||||
VarEntry *
|
||||
Yap_LookupVar(char *var) /* lookup variable in variables table */
|
||||
@@ -181,7 +181,7 @@ VarNames(VarEntry *p,Term l)
|
||||
VarNames(p->VarLeft,l)));
|
||||
if (H > ASP-4096) {
|
||||
save_machine_regs();
|
||||
_longjmp(Yap_IOBotch,1);
|
||||
siglongjmp(Yap_IOBotch,1);
|
||||
}
|
||||
return(o);
|
||||
} else {
|
||||
@@ -706,7 +706,7 @@ Yap_Parse(void)
|
||||
Volatile Term t;
|
||||
JMPBUFF FailBuff;
|
||||
|
||||
if (!_setjmp(FailBuff.JmpBuff)) {
|
||||
if (!sigsetjmp(FailBuff.JmpBuff, 0)) {
|
||||
t = ParseTerm(1200, &FailBuff);
|
||||
if (Yap_tokptr->Tok != Ord(eot_tok))
|
||||
return (0L);
|
||||
|
||||
Reference in New Issue
Block a user