From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#10664: 24.0.93; JIT font-lock infloops in a C file Date: Wed, 8 Feb 2012 11:47:49 +0000 Message-ID: <20120208114749.GA3523@acm.acm> References: <83wr89qcay.fsf@gnu.org> <83bopdcfe5.fsf@gnu.org> <20120206110957.GA2731@acm.acm> <83wr7zc2r2.fsf@gnu.org> <20120207192032.GA17530@acm.acm> <83y5se9x9a.fsf@gnu.org> <20120207213401.GB17530@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1328701771 4531 80.91.229.3 (8 Feb 2012 11:49:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Feb 2012 11:49:31 +0000 (UTC) Cc: 10664@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 08 12:49:28 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rv61e-0003We-CO for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Feb 2012 12:49:26 +0100 Original-Received: from localhost ([::1]:56893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv61d-00038p-NF for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Feb 2012 06:49:25 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv61W-00038k-Dl for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 06:49:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rv61M-0001ER-RV for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 06:49:18 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv61G-0001Cv-HY; Wed, 08 Feb 2012 06:49:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Rv62E-0006YL-SY; Wed, 08 Feb 2012 06:50:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 08 Feb 2012 11:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10664 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 10664-submit@debbugs.gnu.org id=B10664.132870175625129 (code B ref 10664); Wed, 08 Feb 2012 11:50:02 +0000 Original-Received: (at 10664) by debbugs.gnu.org; 8 Feb 2012 11:49:16 +0000 Original-Received: from localhost ([127.0.0.1]:60083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rv61T-0006XF-1P for submit@debbugs.gnu.org; Wed, 08 Feb 2012 06:49:15 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:14047 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rv61N-0006X3-39 for 10664@debbugs.gnu.org; Wed, 08 Feb 2012 06:49:11 -0500 Original-Received: (qmail 37275 invoked by uid 3782); 8 Feb 2012 11:48:06 -0000 Original-Received: from acm.muc.de (pD9557B64.dip.t-dialin.net [217.85.123.100]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 08 Feb 2012 12:48:02 +0100 Original-Received: (qmail 3820 invoked by uid 1000); 8 Feb 2012 11:47:49 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:56693 Archived-At: Hi, Stefan. On Tue, Feb 07, 2012 at 06:39:11PM -0500, Stefan Monnier wrote: > > For one particular fontification in socket.c, the "safe position" is 500 > > bytes back from the starting point, so jit-lock is pushed back these 500 > > bytes, fontifies the next 500 bytes (`jit-lock-chunk-size'), then has its > > new start position set back 500 bytes, rinse, spin, repeat. > Why is "jit-lock pushed back"? Build Emacs revision #106728. emacs -Q, then create the following C++ buffer: ######################################################################### 1 template 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. -- Alan Mackenzie (Nuremberg, Germany).