cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] =~ runtime improvements?
Date: Sun, 30 Sep 2018 19:11:27 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1809301907270.2863@hadrien> (raw)
In-Reply-To: <CAGXu5jJD1H2LePxkRfZita7SphUb_EKkyAQLxCaDf-Xqr3yUOQ@mail.gmail.com>



On Sun, 30 Sep 2018, Kees Cook wrote:

> On Sun, Sep 30, 2018 at 8:40 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >
> >
> > On Sun, 30 Sep 2018, Lars-Peter Clausen wrote:
> >
> >> On 09/27/2018 08:51 PM, Kees Cook wrote:
> >> > Hi,
> >> >
> >> > This .cocci takes a VERY long time to run against the kernel, and I'd
> >> > love to know what I could do to improve it. I assume it's related to
> >> > the use of the "=~" operand:
> >> >
> >>
> >> Maybe I'm missing something, but do you need all of those variations? An
> >> expression should match an identifier. I'd expect ((ECOUNT)) *
> >> ((ESTRIDE)) * ((ESIZE)) matches the superset of all the other statements
> >> with ICOUNT, ISIZE and ISTRIDE in them. So you only need two rules one
> >> for array_size and one for array3_size.
> >
> > I agree about the indentifiers and expressions, although he also needs
> > some rules for the constant case.
>
> I had to go progressively to exclude cases in an attempt to isolate
> individual factors. For example:
>
> E1 * E2
>
> will match:
>
> var1 * var2 * var3

I think you could just do E1 * E2 * E3 before E1 * E2?

>
> In order to make a best-effort at extracting the multiplication
> factors, I need to go in order from constants (ignore) to identifiers
> (explicitly correct) to expressions (may overly match)
>
> But yes, it seems the problem is mainly the "..." part, which is unavoidable.

Maybe it would be good to have some special cases?  Are the
multiplications often right next to the allocation?  Or if there is
something that is often between them, then it could be useful to make a
special case for that.

julia

      reply	other threads:[~2018-09-30 17:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 18:51 [Cocci] =~ runtime improvements? Kees Cook
2018-09-27 21:09 ` Julia Lawall
2018-09-30 15:06 ` Lars-Peter Clausen
2018-09-30 15:40   ` Julia Lawall
2018-09-30 16:54     ` Kees Cook
2018-09-30 17:11       ` Julia Lawall [this message]

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=alpine.DEB.2.21.1809301907270.2863@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    /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.
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 NNTP newsgroup(s).