[m-rev.] for review: compile time evaluation of string.count_codepoints

Peter Wang novalazy at gmail.com
Tue Sep 17 17:37:09 AEST 2013


On Tue, 17 Sep 2013 17:02:10 +1000, Julien Fischer <jfischer at opturion.com> wrote:
> On Tue, Sep 17, 2013 at 4:59 PM, Peter Wang <novalazy at gmail.com> wrote:
> 
> > On Tue, 17 Sep 2013 16:49:15 +1000, Julien Fischer <jfischer at opturion.com>
> > wrote:
> > > On Tue, Sep 17, 2013 at 4:38 PM, Peter Wang <novalazy at gmail.com> wrote:
> > >
> > > > On Tue, 17 Sep 2013 02:30:43 +1000 (EST), Julien Fischer <
> > > > jfischer at opturion.com> wrote:
> > > > >
> > > > > For review by anyone.
> > > > >
> > > > > -----------
> > > > >
> > > > > Compile time evaluation of string.count_codepoints.
> > > > >
> > > > > compiler/const_prop.m:
> > > > >      Do compile time evaluation of string.count_codepoints where
> > > > possible.
> > > > >
> > > > >      Fix an old error in a comment: functions with two arguments are
> > > > >      binary, not unary.
> > > > >
> > > > > Julien.
> > > >
> > > > I'm curious about the motivation for this.
> > > >
> > >
> > > Which one, fixing the incorrect comment or doing compile time evaluation
> > of
> > > count_codepoints?  ;-)
> > >
> > > There's no really strong motivation other than that I noticed that some
> > > code that I was working on
> > > G12 would be smaller if we did the above substitution (because it enables
> > > further simplifications
> > > to take place).
> >
> > I don't like how brittle the recognition of known procedures is,
> > so I suggest not adding to it without good reason.
> >
> 
> It isn't all that brittle is it?  I don't remember it being particularly
> troublesome in the past.

Ok, maybe not *so* brittle, but kind of brittle.  I mainly don't like
that mode numbers could go out of sync by making a trivial change like
reordering mode lines (fortunately rare).  In this case someone might
decide to swap the function and predicate implementations for some
unknown reason and that would break the optimisation, I think.

Can you give an example of the code that benefits from the change?

Peter



More information about the reviews mailing list