Branch: Tag:

2004-08-31

2004-08-31 20:25:40 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added support for more variants of setjmp() et al to avoid excessive system calls on BSDs. Thanks to Dan Nelson for the suggestion.

Rev: src/configure.in:1.838
Rev: src/error.c:1.131
Rev: src/pike_error.h:1.34

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: pike_error.h,v 1.33 2004/06/29 11:09:15 nilsson Exp $ + || $Id: pike_error.h,v 1.34 2004/08/31 20:25:40 grubba Exp $   */      #ifndef PIKE_ERROR_H
33:   #undef HAVE_SETJMP_H   #endif    + #if defined(HAVE_SIGSETJMP) && defined(HAVE_SIGLONGJMP) + #define HAVE_AND_USE_SIGSETJMP + #define LOW_JMP_BUF sigjmp_buf + #define LOW_SETJMP(X) sigsetjmp(X, 0) + #define LOW_LONGJMP(X, Y) siglongjmp(X, Y) + #elif defined(HAVE__SETJMP) && defined(HAVE__LONGJMP) + #define HAVE_AND_USE__SETJMP + #define LOW_JMP_BUF jmp_buf + #define LOW_SETJMP(X) _setjmp(X) + #define LOW_LONGJMP(X, Y) _longjmp(X, Y) + #else + /* Assume we have setjmp and longjmp, they are after all defined by ANSI C. */ + #define HAVE_AND_USE_SETJMP + #define LOW_JMP_BUF jmp_buf + #define LOW_SETJMP(X) setjmp(X) + #define LOW_LONGJMP(X, Y) longjmp(X, Y) + #endif +    #if 1   PMOD_EXPORT extern const char msg_fatal_error[];   #define Pike_fatal \
88:   typedef struct JMP_BUF   {    struct JMP_BUF *previous; -  jmp_buf recovery; +  LOW_JMP_BUF recovery;    struct pike_frame *frame_pointer;    ptrdiff_t stack_pointer;    ptrdiff_t mark_sp;
127:   #endif      #define DEBUG_LINE_ARGS ,char *location - #define SETJMP(X) setjmp((init_recovery(&X, 0, PERR_LOCATION())->recovery)) + #define SETJMP(X) LOW_SETJMP((init_recovery(&X, 0, PERR_LOCATION())->recovery))   #define SETJMP_SP(jmp, stack_pop_levels) \ -  setjmp((init_recovery(&jmp, stack_pop_levels, PERR_LOCATION())->recovery)) +  LOW_SETJMP((init_recovery(&jmp, stack_pop_levels, PERR_LOCATION())->recovery))   #else   #define DEBUG_LINE_ARGS - #define SETJMP(X) setjmp((init_recovery(&X, 0)->recovery)) + #define SETJMP(X) LOW_SETJMP((init_recovery(&X, 0)->recovery))   #define SETJMP_SP(jmp, stack_pop_levels) \ -  setjmp((init_recovery(&jmp, stack_pop_levels)->recovery)) +  LOW_SETJMP((init_recovery(&jmp, stack_pop_levels)->recovery))   #define UNSETJMP(X) Pike_interpreter.recoveries=X.previous   #endif