[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8c81818673a 6/7: Tune volatile in read_char
From: |
Paul Eggert |
Subject: |
master 8c81818673a 6/7: Tune volatile in read_char |
Date: |
Sat, 17 Aug 2024 00:16:47 -0400 (EDT) |
branch: master
commit 8c81818673ae9ff788c6e65fb90984f327b27964
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>
Tune volatile in read_char
* src/keyboard.c (read_char): Optimize access to a local volatile.
---
src/keyboard.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/keyboard.c b/src/keyboard.c
index b519ccdf9f0..0d3506bc59b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2517,7 +2517,7 @@ read_char (int commandflag, Lisp_Object map,
Lisp_Object prev_event,
bool *used_mouse_menu, struct timespec *end_time)
{
- Lisp_Object volatile c;
+ Lisp_Object c;
sys_jmp_buf local_getcjmp;
sys_jmp_buf save_jump;
Lisp_Object tem, save;
@@ -2752,8 +2752,10 @@ read_char (int commandflag, Lisp_Object map,
it *must not* be in effect when we call redisplay. */
specpdl_ref jmpcount = SPECPDL_INDEX ();
+ Lisp_Object volatile c_volatile;
if (sys_setjmp (local_getcjmp))
{
+ c = c_volatile;
/* Handle quits while reading the keyboard. */
/* We must have saved the outer value of getcjmp here,
so restore it now. */
@@ -2798,6 +2800,13 @@ read_char (int commandflag, Lisp_Object map,
goto non_reread;
}
+ c_volatile = c;
+#if GCC_LINT && __GNUC__ && !__clang__
+ /* This useless assignment pacifies GCC 14.2.1 x86-64
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21161>. */
+ c = c_volatile;
+#endif
+
/* Start idle timers if no time limit is supplied. We don't do it
if a time limit is supplied to avoid an infinite recursion in the
situation where an idle timer calls `sit-for'. */
@@ -2959,6 +2968,8 @@ read_char (int commandflag, Lisp_Object map,
}
reread = true;
}
+
+ c_volatile = c;
}
/* Read something from current KBOARD's side queue, if possible. */
@@ -2970,6 +2981,7 @@ read_char (int commandflag, Lisp_Object map,
if (!CONSP (KVAR (current_kboard, kbd_queue)))
emacs_abort ();
c = XCAR (KVAR (current_kboard, kbd_queue));
+ c_volatile = c;
kset_kbd_queue (current_kboard,
XCDR (KVAR (current_kboard, kbd_queue)));
if (NILP (KVAR (current_kboard, kbd_queue)))
@@ -3025,6 +3037,8 @@ read_char (int commandflag, Lisp_Object map,
c = XCDR (c);
recorded = true;
}
+
+ c_volatile = c;
}
non_reread:
@@ -3108,7 +3122,7 @@ read_char (int commandflag, Lisp_Object map,
d = Faref (KVAR (current_kboard, Vkeyboard_translate_table), c);
/* nil in keyboard-translate-table means no translation. */
if (!NILP (d))
- c = d;
+ c_volatile = c = d;
}
}
@@ -3148,6 +3162,7 @@ read_char (int commandflag, Lisp_Object map,
Vunread_command_events = Fcons (c, Vunread_command_events);
}
c = posn;
+ c_volatile = c;
}
}
@@ -3273,6 +3288,7 @@ read_char (int commandflag, Lisp_Object map,
}
/* It returned one event or more. */
c = XCAR (tem);
+ c_volatile = c;
Vunread_post_input_method_events
= nconc2 (XCDR (tem), Vunread_post_input_method_events);
}
@@ -3347,6 +3363,7 @@ read_char (int commandflag, Lisp_Object map,
do
{
c = read_char (0, Qnil, Qnil, 0, NULL);
+ c_volatile = c;
if (EVENT_HAS_PARAMETERS (c)
&& EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_click))
XSETCAR (help_form_saved_window_configs, Qnil);
@@ -3360,7 +3377,7 @@ read_char (int commandflag, Lisp_Object map,
{
cancel_echoing ();
do
- c = read_char (0, Qnil, Qnil, 0, NULL);
+ c_volatile = c = read_char (0, Qnil, Qnil, 0, NULL);
while (BUFFERP (c));
}
}
- master updated (909d1d02db1 -> ed305c4b98c), Paul Eggert, 2024/08/17
- master ed305c4b98c 7/7: Fix x_construct_mouse_click || vs | typo, Paul Eggert, 2024/08/17
- master 2169a9387a5 1/7: Don’t ignore -Wclobbered in bytecode.c, Paul Eggert, 2024/08/17
- master 1282714da55 3/7: Don’t ignore -Wclobbered in eval.c, Paul Eggert, 2024/08/17
- master 8c81818673a 6/7: Tune volatile in read_char,
Paul Eggert <=
- master cfa5a634e91 2/7: Don’t ignore -Wclobbered in emacs-module.c, Paul Eggert, 2024/08/17
- master 3b24ac53885 4/7: Don’t ignore -Wclobbered in image.c, Paul Eggert, 2024/08/17
- master a967efdd2a5 5/7: Don’t ignore -Wclobbered in keyboard.c, Paul Eggert, 2024/08/17