From: Eli Zaretskii <eliz@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: 10664@debbugs.gnu.org
Subject: bug#10664: 24.0.93; JIT font-lock infloops in a C file
Date: Wed, 08 Feb 2012 19:49:58 +0200 [thread overview]
Message-ID: <83sjil9pvd.fsf@gnu.org> (raw)
In-Reply-To: <20120208114749.GA3523@acm.acm>
> Date: Wed, 8 Feb 2012 11:47:49 +0000
> Cc: Eli Zaretskii <eliz@gnu.org>, 10664@debbugs.gnu.org
> From: Alan Mackenzie <acm@muc.de>
>
> #########################################################################
> 1 template <typename T>
> 2
> 3
> 4 void myfunc(T* p) {}
> #########################################################################
>
> This is fontified correctly. Type a space on L2. This is OK for half a
> second, then context fontification messes up L4. The correct
> fontification can only be restored by a change to L4.
>
> Revision #106729 fixes this problem, after a space on L2, by making the
> fontification start at L1 rather than L2.
>
> The exact mechanism of why the problem happened is buried in my log, and
> I could dredge it up if you're really interested.
>
> The problem with this approach is demonstrated in Eli's socket.c:
>
> SCM_DEFINE (scm_inet_pton, "inet-pton", 2, 0, 0,
> (SCM family, SCM address),
> "Convert a string containing a printable network address to\n"
> "an integer address. Note that unlike the C version of this\n"
> "function,\n"
> "the result is an integer with normal host byte ordering.\n"
> "@var{family} can be @code{AF_INET} or @code{AF_INET6}. E.g.,\n\n"
> "@lisp\n"
> "(inet-pton AF_INET \"127.0.0.1\") @result{} 2130706433\n"
> "(inet-pton AF_INET6 \"::1\") @result{} 1\n"
> "@end lisp")
> #define FUNC_NAME s_scm_inet_pton
> {
>
> A 500 byte chunk of fontification ends just before "@end lisp". For
> this line, the start of the next chunk is "pushed back" to the
> SCM_DEFINE line to get a proper context for "@end lisp". It then
> repeatedly fontifies the same chunk.
>
> Interestingly, EOL just before "@end lisp" is exactly 500 bytes after
> the initial scm_inet_pton.
Thanks for explaining this.
Would it fix the problem if, when jit-lock is "pushed back" by N >= 500
characters, it will fontify N + n characters, where n > 0 ? (E.g., set
n = 100.)
next prev parent reply other threads:[~2012-02-08 17:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 18:23 bug#10664: 24.0.93; JIT font-lock infloops in a C file Eli Zaretskii
2012-02-05 18:18 ` Eli Zaretskii
2012-02-06 11:09 ` Alan Mackenzie
2012-02-06 14:39 ` Stefan Monnier
2012-02-06 17:04 ` Eli Zaretskii
2012-02-07 17:30 ` Eli Zaretskii
2012-02-07 19:20 ` Alan Mackenzie
2012-02-07 20:58 ` Eli Zaretskii
2012-02-07 21:34 ` Alan Mackenzie
2012-02-07 23:39 ` Stefan Monnier
2012-02-08 11:47 ` Alan Mackenzie
2012-02-08 17:49 ` Eli Zaretskii [this message]
2012-02-08 19:28 ` Stefan Monnier
2012-02-10 11:28 ` Alan Mackenzie
2012-02-12 20:57 ` Eli Zaretskii
2012-02-14 5:42 ` Chong Yidong
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=83sjil9pvd.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=10664@debbugs.gnu.org \
--cc=acm@muc.de \
/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).