From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: John Wiegley <jwiegley@gmail.com>,
Stefan Monnier <monnier@iro.umontreal.ca>,
emacs-devel@gnu.org
Subject: Re: Lisp watchpoints
Date: Sun, 29 Nov 2015 15:35:24 -0500 [thread overview]
Message-ID: <CAM-tV-_83Bsg1GSkF-obEbJ5xTzHmdvyttgpjpaS7rdyT4pyXQ@mail.gmail.com> (raw)
In-Reply-To: <834mg4oa3l.fsf@gnu.org>
On Sun, Nov 29, 2015 at 2:54 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Sun, 29 Nov 2015 14:40:57 -0500
>> From: Noam Postavsky <npostavs@users.sourceforge.net>
>> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, John Wiegley <jwiegley@gmail.com>, emacs-devel@gnu.org
>>
>> > The call to ARRAYELTS should be outside of the loop (for those poor
>> > souls who run unoptimized builds most of the time).
>>
>> Compiling the following shows gcc folds the constants even with -O0
>> (also, notify_variable_watchers() should only be called for a few
>> selected symbols so I don't think it would really slow things down
>> very much).
>
> That depends om your GCC version, and then there are -fFOO switches
> that can control each specific optimizations. And seeing that in the
> code simply looks wrong, regardless. So let's move it out, please.
Since ARRAYELTS is a compile-time constant, to me it looks completely
redundant to move it out of the loop. Would it help if I added a
WATCHER_NUMBER_LIMIT to the enum after WATCHER_NUMBER_SET_REDISPLAY
and used that instead?
>
>> >> + DEFVAR_INT ("set-redisplay-internal-watcher-number",
>> >> + Vset_redisplay_internal_watcher_number,
>> >> + doc: /* Internal watch function constant. */);
>> >> + Vset_redisplay_internal_watcher_number = WATCHER_NUMBER_SET_REDISPLAY;
>> >> + make_symbol_constant (intern_c_string ("set-redisplay-internal-watcher-number"));
>> >
>> > I'd prefer if all this were moved to window.c. data.c has no business
>> > with display-related issues.
>>
>> Hmm, then how should we make the connection between watcher numbers
>> and C function pointers? I think data.c should be in charge of that.
>
> What connection? I'm afraid I'm not following.
The watchers_table holds all of the C functions that can be used as
watchers. I think it makes sense to have this table in data.c. Lisp
code that wants to add a watcher to a variable needs to know which
number to use (0 for set_redisplay, because it's the 1st (and only)
entry in the table). Since data.c has the table, I figured it makes
sense that it would be in charge of exporting the number->Cpointer
mapping to lisp. Hence, set-redisplay-internal-watcher-number is
defined in data.c.
If window.c would be in charge of defining
set-redisplay-internal-watcher-number, then it would need to know the
right number, which would probably mean moving the
WATCHER_NUMBER_SET_REDISPLAY definition to a header file away from the
watcher_table definition, which would be suboptimal, I think.
Or I guess we could just hard code the number 0 with a comment to look
in data.c; is that too dirty?
next prev parent reply other threads:[~2015-11-29 20:35 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-14 18:14 Lisp watchpoints (Was: [Emacs-diffs] master 19e09cf: Ensure redisplay after evaluation) Noam Postavsky
2015-11-14 22:29 ` Lisp watchpoints Stefan Monnier
2015-11-22 20:13 ` Noam Postavsky
2015-11-22 20:41 ` Eli Zaretskii
2015-11-22 21:25 ` Stefan Monnier
2015-11-23 3:32 ` Eli Zaretskii
2015-11-23 2:31 ` Noam Postavsky
2015-11-29 2:04 ` Noam Postavsky
2015-11-29 4:44 ` Stefan Monnier
2015-11-29 5:12 ` Noam Postavsky
2015-11-29 11:28 ` Andreas Schwab
2015-11-29 14:12 ` Noam Postavsky
2015-11-29 15:37 ` Stefan Monnier
2015-11-29 16:10 ` Eli Zaretskii
2015-11-30 0:57 ` Noam Postavsky
2015-11-30 1:14 ` Stefan Monnier
2015-11-30 15:49 ` Eli Zaretskii
2015-11-29 11:28 ` Andreas Schwab
2015-11-29 15:39 ` Stefan Monnier
2015-11-29 15:45 ` Eli Zaretskii
2015-11-29 16:01 ` Noam Postavsky
2015-11-29 16:04 ` Noam Postavsky
2015-11-29 17:13 ` Eli Zaretskii
2015-11-29 22:24 ` Stefan Monnier
2015-11-29 17:11 ` Eli Zaretskii
2015-11-29 16:06 ` Stefan Monnier
2015-11-29 16:43 ` Eli Zaretskii
2015-11-29 19:40 ` Noam Postavsky
2015-11-29 19:54 ` Eli Zaretskii
2015-11-29 20:35 ` Noam Postavsky [this message]
2015-11-29 20:45 ` Eli Zaretskii
2015-11-29 21:33 ` Noam Postavsky
2015-11-29 20:00 ` Andreas Schwab
2015-11-29 20:19 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2016-12-03 14:51 Kaushal Modi
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=CAM-tV-_83Bsg1GSkF-obEbJ5xTzHmdvyttgpjpaS7rdyT4pyXQ@mail.gmail.com \
--to=npostavs@users.sourceforge.net \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jwiegley@gmail.com \
--cc=monnier@iro.umontreal.ca \
/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).