[eeps] Multi-Parameter Typechecking BIFs

Richard O'Keefe <>
Fri Feb 27 00:54:09 CET 2009


On 26 Feb 2009, at 7:53 pm, Bjorn Gustavsson wrote:

> On Thu, Feb 26, 2009 at 12:52 AM, Richard O'Keefe  
> <> wrote:
>> Let's take a look at e3d_vec.erl
>
> You noted that several functions in e3d_vec do not check the type of
> all of their arguments
> and assumed it was an oversight.
>
> It was not. ...
> I only added enough type checks to make sure that the compiler would
> use the specially
> optimized floating point instructions.

That was the other hypothesis.
The reason that I didn't go for it was the lack of any such
explanation in the file itself, and short of looking at the
generated code, I know no way of _telling_ which type tests
are needed for that purpose and which are not.

By the way, I mean no criticism of Wings3D or its author.
It's an impressive program that I couldn't possibly have
written.

There is, however, a real problem with adding just enough
type checks for the compiler to generate specific code.
It isn't future-proof.  A later, smarter, compiler might
need fewer hints, which is good.  (Something like Saumya
Debray's "call forwarding" might help.)  But equally,
changes to the compiler to improve performance elsewhere
might result in it needing *more* hints for this purpose.
It is certainly imaginable that HiPE for x86, HiPE for
x86-64, HiPE for SPARC v8, and HiPE for SPARC V9 might
need different hints.  Did you verify that you got the
special floating-point instructions on all of those
machine types?

I would check this myself, but I haven't yet figured out
how to see what native code HiPE is generating.  (I thought
I knew, but pp_asm and pp_native don't do the trick after
all.)





More information about the eeps mailing list