[m-rev.] for review: unboxed floats in high-level C grades
Peter Wang
novalazy at gmail.com
Fri Aug 19 10:40:56 AEST 2011
On 2011-08-19, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> >compiler/mlds_to_c.m:
> > Update code that writes out scalar static data to handle
> > `mlds_mostly_generic_array_type'.
> >
> > In one case, for `--high-level-data' only, output float constants by
> > their integer representation, so that they may be cast to pointer
> > types.
>
> Technically you should avoid doing that when --cross-compiling is
> enabled, but it probably isn't too important as the main use of that
> option is for building the source distribution and we don't support that
> in grades that use --high-level-data anyway.
I'll add a note about that, though it should be pretty hard to trip over
given the ubiquity of IEEE 754.
> >diff --git a/compiler/mlds.m b/compiler/mlds.m
> >index 5cea540..d66279f 100644
> >--- a/compiler/mlds.m
> >+++ b/compiler/mlds.m
> >@@ -815,6 +815,15 @@
> > % MLDS code generator, e.g. the arrays used for
> > % string switches.
> >
> >+ ; mlds_mostly_generic_array_type(list(mlds_type))
> >+ % A generic array with some float elements.
>
> What do you mean by "some"? Are other elements not going to be
> floats?
All the other elements are mlds_generic_type. I'll make that clearer.
> >+ % This is the same as mlds_array_type(mlds_generic_type) except
> >+ % that some element types are mlds_native_float_type instead of
> >+ % mlds_generic_type.
>
> That begs the question, why is it not called something like
> mlds_float_array_type? (Do you envisage it being used for element types
> other than floats in the future?)
Yes, it could be used for 64-bit integers on 32-bit platforms.
> >In C, it is not possible to initialize an
> >+ % element of a generic array with a float literal, so we replace
> >+ % them with a structure type with some float fields.
>
> That looks good otherwise.
>
> (Incidentally, I've added a version of the n-body benchmark from the
> programming language shootout or whatever it calls itself these days
> to the benchmarks; you may want to try this change out on it -- it should
> make a substantial difference**.)
Excellent. But I'm locked out:
-r--r--r--+ 1 juliensf g12 7457 2011-08-18 17:09 nbody.m,v
Peter
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list