From ab8911708bf49cb796d68402132d7da6ac001bf3 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 26 Oct 2010 22:03:36 +0100 Subject: [PATCH] fix YAP to use _longjmp when available. longjmp is just too expensive on OSX machines. --- C/amasm.c | 42 +++++++++++------------ C/compiler.c | 92 +++++++++++++++++++++++++-------------------------- C/computils.c | 6 ++-- C/heapgc.c | 6 ++-- C/index.c | 52 ++++++++++++++--------------- C/iopreds.c | 6 ++-- C/parser.c | 10 +++--- H/Yap.h | 5 +++ config.h.in | 1 + configure | 40 ++++++++++++++++++++++ configure.in | 19 +++++++++++ 11 files changed, 172 insertions(+), 107 deletions(-) diff --git a/C/amasm.c b/C/amasm.c index 5fac347f3..c66965342 100755 --- a/C/amasm.c +++ b/C/amasm.c @@ -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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(cip->CompilerBotch, 1); break; case _functor: code_p->opc = emit_op(_p_func2s_vc); @@ -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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); } } } diff --git a/C/compiler.c b/C/compiler.c index 6e49a6e2c..dcd8ca7b1 100755 --- a/C/compiler.c +++ b/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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(cglobs->cint.CompilerBotch,OUT_OF_AUX_BOTCH); default: - longjmp(cglobs->cint.CompilerBotch,COMPILER_ERR_BOTCH); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); */ + _longjmp(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); + _longjmp(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); + _longjmp(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 = _setjmp(cglobs.cint.CompilerBotch))) { 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); + _longjmp(cglobs.cint.CompilerBotch,3); } cglobs.Uses = (Int *)(H+maxvnum); cglobs.Contents = (Term *)(H+maxvnum+(sizeof(Int)/sizeof(CELL))*MaxTemps); diff --git a/C/computils.c b/C/computils.c index b9f2738e9..2011bfe8c 100755 --- a/C/computils.c +++ b/C/computils.c @@ -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); + _longjmp(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); + _longjmp(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); + _longjmp(cip->CompilerBotch, OUT_OF_STACK_BOTCH); } return (p); #endif diff --git a/C/heapgc.c b/C/heapgc.c index 243709de1..53b51e8c1 100755 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -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); + _longjmp(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); + _longjmp(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 (_setjmp(Yap_gc_restore) == 2) { UInt sz; /* we cannot recover, fail system */ diff --git a/C/index.c b/C/index.c index db02e1eff..cbf541a6b 100644 --- a/C/index.c +++ b/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 _longjmp. * * 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); + _longjmp(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); + _longjmp(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); + _longjmp(cint->CompilerBotch,4); #else if (!Yap_growtrail(sz, TRUE)) { save_machine_regs(); - longjmp(cint->CompilerBotch,4); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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 = _setjmp(cint.CompilerBotch)) == 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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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); + _longjmp(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 = _setjmp(cint.CompilerBotch)) == 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); + _longjmp(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); + _longjmp(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 _longjmp and recover space */ save_machine_regs(); - longjmp(cint->CompilerBotch,2); + _longjmp(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 _longjmp and recover space */ save_machine_regs(); - longjmp(cint->CompilerBotch,2); + _longjmp(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 = _setjmp(cint.CompilerBotch)) == 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 = _setjmp(cint.CompilerBotch)) == 3) { restore_machine_regs(); Yap_gcl(Yap_Error_Size, ap->ArityOfPE, ENV, CP); save_machine_regs(); diff --git a/C/iopreds.c b/C/iopreds.c index 6f9510bd7..b0951497d 100755 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -780,7 +780,7 @@ MemPutc(int sno, int ch) if (Stream[sno].u.mem_string.error_handler) { Yap_Error_Size = new_max_size*sizeof(char); save_machine_regs(); - longjmp(*(jmp_buf *)Stream[sno].u.mem_string.error_handler,1); + _longjmp(*(jmp_buf *)Stream[sno].u.mem_string.error_handler,1); } else { Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP could not grow heap for writing to string"); } @@ -4354,7 +4354,7 @@ static Int while (TRUE) { CELL *old_H = H; - if (setjmp(Yap_IOBotch) == 0) { + if (_setjmp(Yap_IOBotch) == 0) { v = Yap_VarNames(Yap_VarTable, TermNil); break; } else { @@ -5145,7 +5145,7 @@ format(volatile Term otail, volatile Term oargs, int sno) Stream[sno].u.mem_string.error_handler = (void *)&format_botch; old_pos = Stream[sno].u.mem_string.pos; /* set up an error handler */ - if (setjmp(format_botch)) { + if (_setjmp(format_botch)) { restore_machine_regs(); *H++ = oargs; *H++ = otail; diff --git a/C/parser.c b/C/parser.c index b499296b8..d10863f03 100644 --- a/C/parser.c +++ b/C/parser.c @@ -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(!_setjmp(newenv.JmpBuff)) { \ 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(!_setjmp(newenv.JmpBuff)) { \ FailBuff = &newenv; \ S; \ FailBuff=saveenv; \ @@ -113,7 +113,7 @@ STATIC_PROTO(Term ParseTerm, (int, JMPBUFF *)); } -#define FAIL longjmp(FailBuff->JmpBuff,1) +#define FAIL _longjmp(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); + _longjmp(Yap_IOBotch,1); } return(o); } else { @@ -710,7 +710,7 @@ Yap_Parse(void) Volatile Term t; JMPBUFF FailBuff; - if (!setjmp(FailBuff.JmpBuff)) { + if (!_setjmp(FailBuff.JmpBuff)) { t = ParseTerm(1200, &FailBuff); if (Yap_tokptr->Tok != Ord(eot_tok)) return (0L); diff --git a/H/Yap.h b/H/Yap.h index 458c5295d..3cfe37d0e 100755 --- a/H/Yap.h +++ b/H/Yap.h @@ -245,6 +245,11 @@ typedef unsigned long int YAP_ULONG_LONG; #define LOW_PROF 1 #endif +#if !HAVE__SETJMP +#define _longjmp(A,B) longjmp(A,B) +#define _setjmp(A) setjmp(A) +#endif + #ifdef DEBUG extern char Yap_Option[20]; #endif diff --git a/config.h.in b/config.h.in index f741308a0..26d28cac7 100755 --- a/config.h.in +++ b/config.h.in @@ -167,6 +167,7 @@ #undef RETSIGTYPE #undef HAVE__NSGETENVIRON +#undef HAVE__SETJMP #undef HAVE_ACCESS #undef HAVE_ACOSH #undef HAVE_ALARM diff --git a/configure b/configure index 9ae12012a..5cbd4d0a6 100755 --- a/configure +++ b/configure @@ -8569,6 +8569,46 @@ $as_echo "#define HAVE_SIGSETJMP 0" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _setjmp" >&5 +$as_echo_n "checking for _setjmp... " >&6; } +if ${yap_cv__setjmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +jmp_buf RestartEnv; + + _longjmp (RestartEnv, 1); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + yap_cv__setjmp=yes +else + yap_cv__setjmp=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $yap_cv__setjmp" >&5 +$as_echo "$yap_cv__setjmp" >&6; } +if test "$yap_cv__setjmp" = yes +then +$as_echo "#define HAVE__SETJMP 1" >>confdefs.h + +else +$as_echo "#define HAVE__SETJMP 0" >>confdefs.h + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigsegv" >&5 $as_echo_n "checking for sigsegv... " >&6; } if ${yap_cv_sigsegv+:} false; then : diff --git a/configure.in b/configure.in index 93a53a0f9..3f131d636 100755 --- a/configure.in +++ b/configure.in @@ -1567,6 +1567,25 @@ else AC_DEFINE(HAVE_SIGSETJMP,0) fi +dnl check for _setjmp +AC_MSG_CHECKING(for _setjmp) +AC_CACHE_VAL(yap_cv__setjmp,[ +AC_TRY_COMPILE( + #include + , + jmp_buf RestartEnv; + + _longjmp (RestartEnv, 1); + , + yap_cv__setjmp=yes,yap_cv__setjmp=no)]) +AC_MSG_RESULT($yap_cv__setjmp) +if test "$yap_cv__setjmp" = yes +then +AC_DEFINE(HAVE__SETJMP,1) +else +AC_DEFINE(HAVE__SETJMP,0) +fi + dnl check for sigsegv AC_MSG_CHECKING(for sigsegv) AC_CACHE_VAL(yap_cv_sigsegv,[