[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s
From: |
Eli Zaretskii |
Subject: |
Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s |
Date: |
Sun, 07 Mar 2021 16:04:42 +0200 |
> From: Pip Cet <pipcet@gmail.com>
> Date: Sun, 7 Mar 2021 13:27:01 +0000
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
>
> > > 1. Have FUNCTION_MAY_GC etc. translate into a GCC attribute in debug
> > > builds so we can statically check that a function that says it never
> > > calls GC doesn't call a function that says it may call GC.
> > > 2. Have a statement at the beginning of non-GCing functions which sets
> > > a flag that is then checked by garbage-collecting functions, so that
> > > we may dynamically check this.
> > >
> > > (1) seems easy to implement, but has a high rate of false negatives as
>
> "Seems". If you have a computer fast enough and enough RAM to actually
> compile emacs with -flto -fanalyzer -fdump-analyzer-json. I don't.
>
> > > many functions are safe to call from non-GCing functions as long as
> > > the arguments are correct.
> > > (2) is difficult to implement, and would only trigger at runtime.
> > >
> > > So I say we should do (1) in preference to (2), but maybe we should do
> > > both.
> >
> > I don't think I understand how will we know which function says it
> > never calls GC.
>
> By tagging it in the source code?
How do you know which functions to tag?
> > For the same reasons, I don't see how (2) can be done in practice.
>
> Sorry, I don't understand. We'd have
>
> void
> f (void)
> {
> DONT_CALL_GC ();
> g();
> }
>
> void
> g (void)
> {
> maybe_gc ();
> }
>
> and that would throw a runtime error because maybe_gc checks the flag
> set by DONT_CALL_GC.
How do you know in which functions to add DONT_CALL_GC ?
Or did you intend to add that to all the functions one by one, then
removing them as needed, until you stop getting runtime exceptions?
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, (continued)
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Stefan Monnier, 2021/03/05
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Pip Cet, 2021/03/05
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Pip Cet, 2021/03/06
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Eli Zaretskii, 2021/03/06
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Pip Cet, 2021/03/06
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Eli Zaretskii, 2021/03/06
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Pip Cet, 2021/03/06
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Eli Zaretskii, 2021/03/06
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Pip Cet, 2021/03/07
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s,
Eli Zaretskii <=
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Pip Cet, 2021/03/07
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Eli Zaretskii, 2021/03/07
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Pip Cet, 2021/03/07
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Eli Zaretskii, 2021/03/07
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Stefan Monnier, 2021/03/07
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Andrea Corallo, 2021/03/07
- Re: master d582356: * src/fns.c (Frandom): Handle bignum `limit`s, Pip Cet, 2021/03/07