emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109873: Be more systematic about _se


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109873: Be more systematic about _setjmp vs setjmp.
Date: Mon, 03 Sep 2012 23:34:19 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109873
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2012-09-03 23:34:19 -0700
message:
  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.
modified:
  src/ChangeLog
  src/alloc.c
  src/image.c
  src/process.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-03 19:36:09 +0000
+++ b/src/ChangeLog     2012-09-04 06:34:19 +0000
@@ -1,3 +1,17 @@
+2012-09-04  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        Fix minor problem found by static checking.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-09-02 16:56:31 +0000
+++ b/src/alloc.c       2012-09-04 06:34:19 +0000
@@ -4764,7 +4764,7 @@
   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 @@
   ++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 @@
     }
 #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 */

=== modified file 'src/image.c'
--- a/src/image.c       2012-09-02 16:56:31 +0000
+++ b/src/image.c       2012-09-04 06:34:19 +0000
@@ -5517,13 +5517,13 @@
 
 
 #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 @@
 
   /* 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 @@
 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 @@
   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 @@
   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

=== modified file 'src/process.c'
--- a/src/process.c     2012-09-02 17:10:35 +0000
+++ b/src/process.c     2012-09-04 06:34:19 +0000
@@ -5431,7 +5431,7 @@
 {
   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 @@
   /* 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;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]