unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acm@muc.de, 52298@debbugs.gnu.org
Subject: bug#52298: 29.0.50; Frequent redisplay cycles induced by c-type-finder-timer-func timer in CC Mode
Date: Fri, 10 Dec 2021 18:16:21 +0000	[thread overview]
Message-ID: <YbOZdTPCnj5mruRK@ACM> (raw)
In-Reply-To: <838rwttsxj.fsf@gnu.org>

Hello, Eli.

On Thu, Dec 09, 2021 at 22:38:32 +0200, Eli Zaretskii wrote:
> > Date: Thu, 9 Dec 2021 20:11:32 +0000
> > Cc: 52298@debbugs.gnu.org, acm@muc.de
> > From: Alan Mackenzie <acm@muc.de>

[ .... ]

> It seems the reason is not the 'fontified' property, it's the
> 'c-is-sws' property that c-forward-sws puts on the buffer text.  I
> show the backtrace below.  There's also the 'c-type' property that
> c-get-fontification-context puts; see the second backtrace below.

Thanks for the debugging!

> Both of these are called from the timer function.  Are they using
> with-silent-modifications?

I'm pretty sure they are.

I think that modify_text_properties is calling modiff_incr even when
inhibit_modification_hooks is non-nil.  I tried putting an `if' around
that bit of the code, without any great success.

The main reason for all the redisplaying (which I got from
trace-redisplay displaying "redisplay_preserve_echo_area (8)") is the
call from detect_input_pending_run_timers in keyboard.c.  It is calling
redisplay_preserve_echo_area each time the timer triggers.

The call to detect_input_pending_run_timers (true) (that argument being
`do_display') seems to be in dispnew.c, assuming it's not in process.c.
I'll need to look further into this.

> The result of this is that the buffer's modification tick is increased
> all the time, and redisplay_window then decides that the current glyph
> matrix is not up-to-date, which means it must work harder to decide
> how to redisplay this window.

> Here are the two backtraces I promised:

> #0  0x013118d6 in modiff_incr (a=0x6ee5310) at lisp.h:3552
> #1  0x0131203e in modify_text_properties (buffer=XIL(0xa000000006ee50a0),
>     start=make_fixnum(39237), end=make_fixnum(39238)) at textprop.c:91
> #2  0x01316a2b in add_text_properties_1 (start=make_fixnum(39237),
>     end=make_fixnum(39238), properties=XIL(0xc00000000082b538),
>     object=XIL(0xa000000006ee50a0), set_type=TEXT_PROPERTY_REPLACE,
>     destructive=true) at textprop.c:1224
> #3  0x01316ef0 in Fadd_text_properties (start=make_fixnum(39237),
>     end=make_fixnum(39238), properties=XIL(0xc00000000082b538), object=XIL(0))
>     at textprop.c:1296
> #4  0x01316fcf in Fput_text_property (start=make_fixnum(39237),
>     end=make_fixnum(39238), property=XIL(0x56056f0), value=XIL(0x30),
>     object=XIL(0)) at textprop.c:1314
> #5  0x012670c5 in funcall_subr (subr=0x17216a0 <Sput_text_property>,
>     numargs=4, args=0x82b790) at eval.c:3152

[ .... ]

> Lisp Backtrace:
> "put-text-property" (0x82b790)
> "c-forward-sws" (0x82c0a8)
> "c-fl-decl-start" (0x82c7d8)
> "c-context-expand-fl-region" (0x82cdd0)
> 0x753e6b0 PVEC_COMPILED
> "mapc" (0x82d688)
> "c-before-context-fl-expand-region" (0x82dc90)
> "c-type-finder-timer-func" (0x82e530)
> "apply" (0x82e528)
> "timer-event-handler" (0x82eba8)

> ----------------------------------------------------------------------

> #0  0x013118d6 in modiff_incr (a=0x6ee5310) at lisp.h:3552
> #1  0x0131203e in modify_text_properties (buffer=XIL(0xa000000006ee50a0),
>     start=make_fixnum(39339), end=make_fixnum(39340)) at textprop.c:91
> #2  0x01316a2b in add_text_properties_1 (start=make_fixnum(39339),
>     end=make_fixnum(39340), properties=XIL(0xc00000000082b258),
>     object=XIL(0xa000000006ee50a0), set_type=TEXT_PROPERTY_REPLACE,
>     destructive=true) at textprop.c:1224
> #3  0x01316ef0 in Fadd_text_properties (start=make_fixnum(39339),
>     end=make_fixnum(39340), properties=XIL(0xc00000000082b258), object=XIL(0))
>     at textprop.c:1296
> #4  0x01316fcf in Fput_text_property (start=make_fixnum(39339),
>     end=make_fixnum(39340), property=XIL(0x57a2ff8), value=XIL(0x566adc8),
>     object=XIL(0)) at textprop.c:1314
> #5  0x012670c5 in funcall_subr (subr=0x17216a0 <Sput_text_property>,
>     numargs=4, args=0x82b478) at eval.c:3152

[ .... ]

> Lisp Backtrace:
> "put-text-property" (0x82b478)
> "c-get-fontification-context" (0x82bc88)
> 0x7581bc8 PVEC_COMPILED
> "c-find-decl-spots" (0x82d638)
> "c-find-types-background" (0x82dc98)
> "c-type-finder-timer-func" (0x82e530)
> "apply" (0x82e528)
> "timer-event-handler" (0x82eba8)
> (gdb) fr 4
> #4  0x01316fcf in Fput_text_property (start=make_fixnum(39339),
>     end=make_fixnum(39340), property=XIL(0x57a2ff8), value=XIL(0x566adc8),
>     object=XIL(0)) at textprop.c:1314
> 1314      Fadd_text_properties (start, end, properties, object);
> (gdb) pp property
> c-type

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2021-12-10 18:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-05  7:46 bug#52298: 29.0.50; Frequent redisplay cycles induced by c-type-finder-timer-func timer in CC Mode Eli Zaretskii
2021-12-06 20:53 ` Alan Mackenzie
2021-12-07 12:58   ` Eli Zaretskii
2021-12-07 19:58     ` Alan Mackenzie
2021-12-07 20:16       ` Eli Zaretskii
2021-12-08 20:15 ` Alan Mackenzie
2021-12-09  7:08   ` Eli Zaretskii
2021-12-09 20:11     ` Alan Mackenzie
2021-12-09 20:38       ` Eli Zaretskii
2021-12-10 18:16         ` Alan Mackenzie [this message]
2021-12-10 18:51           ` Eli Zaretskii
2021-12-10 22:52             ` Alan Mackenzie
2021-12-11  7:59               ` Eli Zaretskii
2021-12-11 14:52                 ` Alan Mackenzie
2021-12-11 15:38                   ` Eli Zaretskii
2021-12-11 17:04                     ` Alan Mackenzie
2021-12-11 18:21                       ` Eli Zaretskii
2021-12-12  8:58                         ` Alan Mackenzie
2021-12-12  9:15                           ` Eli Zaretskii
2021-12-12 19:05                             ` Alan Mackenzie
2021-12-12 19:21                               ` Eli Zaretskii
2021-12-13 14:19                                 ` Alan Mackenzie
2021-12-12 23:31                               ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-13 14:25                                 ` Alan Mackenzie
2021-12-19 14:38                               ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YbOZdTPCnj5mruRK@ACM \
    --to=acm@muc.de \
    --cc=52298@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).