unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Pip Cet <pipcet@gmail.com>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s
Date: Sat, 06 Mar 2021 12:56:50 +0200	[thread overview]
Message-ID: <83k0qkwnwt.fsf@gnu.org> (raw)
In-Reply-To: <CAOqdjBfnK+4i59+xvQoJpf5cdzxttmWFukFWA9QUeirDDmcrvw@mail.gmail.com> (message from Pip Cet on Sat, 6 Mar 2021 09:44:18 +0000)

> From: Pip Cet <pipcet@gmail.com>
> Date: Sat, 6 Mar 2021 09:44:18 +0000
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
> 
> I thought this code in code_conversion_save was safe:
> 
>       Lisp_Object name
>         = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil);
>       workbuf = Fget_buffer_create (name, Qt);
> 
> but I had misread the second argument to Fget_buffer_create: it's
> inhibit-hooks, not run-hooks.
> 
> So I'm not sure whether code_conversion_save is allowed to call Lisp.

I'd rather it didn't, for more than one reason.  But we can side-step
this by making Fgenerate_new_buffer_name use random-fixnum, which is
still a pure-C implementation.

> It would really help to document the "doesn't call Lisp" and "doesn't
> quit" restrictions somewhere (but I'm not volunteering...)

I agree, on both counts.  We are making Emacs ever more complex, and
keeping correctness as we go, let alone avoiding performance
degradations, becomes more and more problematic.  So much so that you
can easily observe what control engineers call "limit-cycle problem"
in Emacs development, whereby the stability of Emacs doesn't become
steadily better with time, but instead shows small oscillations, even
though we fix bugs at a very high rate, including in old code.

> As an alternative, we could simply use get_random() % 1000000 and
> accept that the first 737418-ish buffer names are microscopically more
> likely to be used on 32-bit narrow-int systems.

Yes, we could do that.  Perhaps it's even better, and we could re-use
the same logic as in Frandom regarding the proximity to INTMASK.



  reply	other threads:[~2021-03-06 10:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210305170955.27732.27579@vcs0.savannah.gnu.org>
     [not found] ` <20210305170957.AF99920E1B@vcs0.savannah.gnu.org>
2021-03-05 19:42   ` master d582356: * src/fns.c (Frandom): Handle bignum `limit`s Pip Cet
2021-03-05 19:56     ` Stefan Monnier
2021-03-05 20:13       ` Pip Cet
2021-03-05 20:34         ` Stefan Monnier
2021-03-06  7:42       ` Pip Cet
2021-03-06  8:44         ` Eli Zaretskii
2021-03-06  9:44           ` Pip Cet
2021-03-06 10:56             ` Eli Zaretskii [this message]
2021-03-06 13:22               ` Pip Cet
2021-03-06 14:45                 ` Eli Zaretskii
2021-03-07 13:27                   ` Pip Cet
2021-03-07 14:04                     ` Eli Zaretskii
2021-03-07 14:21                       ` Pip Cet
2021-03-07 15:22                         ` Eli Zaretskii
2021-03-07 17:23                           ` Pip Cet
2021-03-07 17:47                             ` Eli Zaretskii
2021-03-07 18:37                     ` Stefan Monnier
2021-03-07 19:54                       ` Andrea Corallo via Emacs development discussions.
2021-03-07 19:55                       ` Pip Cet

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=83k0qkwnwt.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=pipcet@gmail.com \
    /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).