summaryrefslogtreecommitdiff
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-01-25 20:27:45 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2017-01-25 21:25:37 -0800
commit1392ec7420ee23238a1588b759c631d87a677483 (patch)
treeca89387ce9acf91005465c7359dc4e212375c479 /src/lisp.h
parent0dfd9a69186e12e53b8aa759c47b9747de92db43 (diff)
downloademacs-1392ec7420ee23238a1588b759c631d87a677483.tar.gz
A quicker check for quit
On some microbenchmarks this lets Emacs run 60% faster on my platform (AMD Phenom II X4 910e, Fedora 25 x86-64). * src/atimer.c: Include keyboard.h, for pending_signals. * src/editfns.c (Fcompare_buffer_substrings): * src/fns.c (Fnthcdr, Fmemq, Fmemql, Fassq, Frassq, Fplist_put) (Fnconc, Fplist_member): Set and clear immediate_quit before and after loop instead of executing QUIT each time through the loop. This is OK for loops that affect only locals. * src/eval.c (process_quit_flag): Now static. (maybe_quit): New function, containing QUIT’s old body. * src/fns.c (rarely_quit): New function. (Fmember, Fassoc, Frassoc, Fdelete, Fnreverse, Freverse) (Flax_plist_get, Flax_plist_put, internal_equal, Fnconc): Use it instead of QUIT, for speed in tight loops that might modify non-locals. * src/keyboard.h (pending_signals, process_pending_signals): These belong to keyboard.c, so move them here ... * src/lisp.h: ... from here. (QUIT): Redefine in terms of the new maybe_quit function, which contains this macro’s old definiens. This works well with branch prediction on processors with return stack buffers, e.g., x86 other than the original Pentium.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 7e918249935..01a08a05f20 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3133,20 +3133,12 @@ extern Lisp_Object memory_signal_data;
and (in particular) cannot call arbitrary Lisp code.
If quit-flag is set to `kill-emacs' the SIGINT handler has received
- a request to exit Emacs when it is safe to do. */
+ a request to exit Emacs when it is safe to do.
-extern void process_pending_signals (void);
-extern bool volatile pending_signals;
-
-extern void process_quit_flag (void);
-#define QUIT \
- do { \
- if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
- process_quit_flag (); \
- else if (pending_signals) \
- process_pending_signals (); \
- } while (false)
+ When not quitting, process any pending signals. */
+extern void maybe_quit (void);
+#define QUIT maybe_quit ()
/* True if ought to quit now. */