all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 39944@debbugs.gnu.org
Subject: bug#39944: 27.0.90; JIT Stealth timer errors
Date: Sat, 07 Mar 2020 20:29:47 +0200	[thread overview]
Message-ID: <831rq49fxg.fsf@gnu.org> (raw)
In-Reply-To: <bcd022c6-90f8-9c10-1188-40f9089013d2@cs.ucla.edu> (message from Paul Eggert on Sat, 7 Mar 2020 10:02:28 -0800)

> Cc: 39944@debbugs.gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Sat, 7 Mar 2020 10:02:28 -0800
> 
> > (the comments in that part of the code can really use some
> > enhancement; they currently seem to target only experts in both time
> > handling and GMP: many macros whose names don't explain what they do,
> > and plethora of calls to libgmp functions that have no comments
> > whatsoever).
> 
> Although comments in that area no doubt could use improvement, I'd rather not 
> see comments like this:
> 
>        /* Add TM_YEAR_BASE to mpz[0].  */
>        mpz_add_ui (mpz[0], mpz[0], TM_YEAR_BASE);

There are quite a few of similar comments there, and they actually
help, because they save us from consulting the GMP manual on every
step.

But I really meant that stuff like this lacks a comment:

      hz = make_integer_mpz ();
      mpz_swap (mpz[0], *iticks);
      ticks = make_integer_mpz ();

And also functions like timespec_ticks, lisp_time_hz_ticks, and
lisp_time_seconds, which don't have a single comment describing how
they do their thing.  Following that code with the purpose of tracking
some specific result is not for the faint at heart.  I think adding a
comment here and there might make that easier.

> > +  (when (numberp time)
> > +    (setq time (timer-relative-time nil time))
> > +    (or (consp time)
> > +        (setq time (time-convert time 'list))))
> 
> This would catch some problems but not all, as the real bug here is in the code 
> (or (consp time) (error "Invalid time format")) which occurs a few lines later. 
> As near as I can tell this later code is both wrong and unnecessary. It's wrong 
> because it's no longer true that only conses are time values. It's unnecessary 
> because the immediately following (timer-set-function timer function args) call 
> checks the validity of TIME. On the off chance that a validity check is still 
> helpful (because we don't want to create garbage?) I installed the attached 
> patch.

Thanks.

> But it might be better in master to remove the "Invalid time format"
> check entirely.

I'm fine with removing that test, if we are sure that invoking
run-at-time with something utterly un-timely, like a symbol or a a
string that cannot be a valid time description, will trigger an error
(presumably from timer-set-time).





  reply	other threads:[~2020-03-07 18:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 10:01 bug#39944: 27.0.90; JIT Stealth timer errors Eli Zaretskii
2020-03-06 10:06 ` Eli Zaretskii
2020-03-06 10:16   ` Eli Zaretskii
2020-03-06 16:11     ` Eli Zaretskii
2020-03-07 18:02       ` Paul Eggert
2020-03-07 18:29         ` Eli Zaretskii [this message]
2020-03-08  8:41         ` Paul Eggert
2020-03-08 15:10           ` Eli Zaretskii
2020-09-20  8:33             ` Lars Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=831rq49fxg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=39944@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.