Commit af26b72c authored by Paul Eggert's avatar Paul Eggert

Be more systematic about _setjmp vs setjmp.

* alloc.c (test_setjmp, mark_stack):
* image.c (PNG_LONGJMP) [PNG_LIBPNG_VER < 10500]:
(PNG_JMPBUF) [! (PNG_LIBPNG_VER < 10500)]:
(png_load, my_error_exit, jpeg_load):
* process.c (send_process_trap, send_process):
Uniformly prefer _setjmp and _longjmp to setjmp and longjmp.
The underscored versions are up to 30x faster on some hosts.
Formerly, the code used setjmp+longjmp sometimes and
_setjmp+_longjmp at other times, with no particular reason to
prefer setjmp+longjmp.
parent 7b6c362e
2012-09-04 Paul Eggert <eggert@cs.ucla.edu>
Be more systematic about _setjmp vs setjmp.
* alloc.c (test_setjmp, mark_stack):
* image.c (PNG_LONGJMP) [PNG_LIBPNG_VER < 10500]:
(PNG_JMPBUF) [! (PNG_LIBPNG_VER < 10500)]:
(png_load, my_error_exit, jpeg_load):
* process.c (send_process_trap, send_process):
Uniformly prefer _setjmp and _longjmp to setjmp and longjmp.
The underscored versions are up to 30x faster on some hosts.
Formerly, the code used setjmp+longjmp sometimes and
_setjmp+_longjmp at other times, with no particular reason to
prefer setjmp+longjmp.
2012-09-03 Paul Eggert <eggert@cs.ucla.edu>
Fix minor problem found by static checking.
......
......@@ -4764,7 +4764,7 @@ test_setjmp (void)
x = strlen (buf);
x = 2 * x - 1;
setjmp (jbuf);
_setjmp (jbuf);
if (longjmps_done == 1)
{
/* Came here after the longjmp at the end of the function.
......@@ -4789,7 +4789,7 @@ test_setjmp (void)
++longjmps_done;
x = 2;
if (longjmps_done == 1)
longjmp (jbuf, 1);
_longjmp (jbuf, 1);
}
#endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */
......@@ -4931,7 +4931,7 @@ mark_stack (void)
}
#endif /* GC_SETJMP_WORKS */
setjmp (j.j);
_setjmp (j.j);
end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j;
#endif /* not GC_SAVE_REGISTERS_ON_STACK */
#endif /* not HAVE___BUILTIN_UNWIND_INIT */
......
......@@ -5517,13 +5517,13 @@ init_png_functions (Lisp_Object libraries)
#if (PNG_LIBPNG_VER < 10500)
#define PNG_LONGJMP(ptr) (longjmp ((ptr)->jmpbuf, 1))
#define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1))
#define PNG_JMPBUF(ptr) ((ptr)->jmpbuf)
#else
/* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */
#define PNG_LONGJMP(ptr) (fn_png_longjmp ((ptr), 1))
#define PNG_JMPBUF(ptr) \
(*fn_png_set_longjmp_fn ((ptr), longjmp, sizeof (jmp_buf)))
(*fn_png_set_longjmp_fn ((ptr), _longjmp, sizeof (jmp_buf)))
#endif
/* Error and warning handlers installed when the PNG library
......@@ -5696,7 +5696,7 @@ png_load (struct frame *f, struct image *img)
/* Set error jump-back. We come back here when the PNG library
detects an error. */
if (setjmp (PNG_JMPBUF (png_ptr)))
if (_setjmp (PNG_JMPBUF (png_ptr)))
{
error:
if (png_ptr)
......@@ -6114,7 +6114,7 @@ static _Noreturn void
my_error_exit (j_common_ptr cinfo)
{
struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err;
longjmp (mgr->setjmp_buffer, 1);
_longjmp (mgr->setjmp_buffer, 1);
}
......@@ -6365,7 +6365,7 @@ jpeg_load (struct frame *f, struct image *img)
cinfo.err = fn_jpeg_std_error (&mgr.pub);
mgr.pub.error_exit = my_error_exit;
if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
if ((rc = _setjmp (mgr.setjmp_buffer)) != 0)
{
if (rc == 1)
{
......@@ -6411,12 +6411,12 @@ jpeg_load (struct frame *f, struct image *img)
if (!check_image_size (f, width, height))
{
image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
longjmp (mgr.setjmp_buffer, 2);
_longjmp (mgr.setjmp_buffer, 2);
}
/* Create X image and pixmap. */
if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
longjmp (mgr.setjmp_buffer, 2);
_longjmp (mgr.setjmp_buffer, 2);
/* Allocate colors. When color quantization is used,
cinfo.actual_number_of_colors has been set with the number of
......
......@@ -5431,7 +5431,7 @@ send_process_trap (int ignore)
{
SIGNAL_THREAD_CHECK (SIGPIPE);
sigunblock (sigmask (SIGPIPE));
longjmp (send_process_frame, 1);
_longjmp (send_process_frame, 1);
}
/* In send_process, when a write fails temporarily,
......@@ -5634,7 +5634,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
/* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2,
CFLAGS="-g -O": The value of the parameter `proc' is clobbered
when returning with longjmp despite being declared volatile. */
if (!setjmp (send_process_frame))
if (!_setjmp (send_process_frame))
{
p = XPROCESS (proc); /* Repair any setjmp clobbering. */
process_sent_to = proc;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment