[m-dev.] for review: passing boxed floats to pragma C code

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Dec 31 19:46:57 AEDT 1999


> Tabling does work for MLDS now.  I just added it ;-)

How extensively have you tested it? Even for LLDS tabling, there is as yet
no test case for tabling values of user-defined or polymorphic types,
nor for testing whether hash table expansion works. I am in the process
of adding such test cases, and one has already revealed two bugs (at least
one which exists in both the old tabling code as well as the new).

>> The complication is quite small; just one extra field for pragma_cs in the
>> LLDS.
> 
> And code to parse it, and to output it, and to process it...

The code to parse it, and to output it, and to process it, is about a hundred
lines all up; I would call that small. The code to pass it around is the bulk
of the diff.

However, this is moot; see below.

> What's the performance cost of the work-around using `boxed(float)'?
> If the compiler does a good job of inlining, that should not have
> any performance overhead.  (If the compiler does not do a good job
> of inlining, then we should fix inlining!)

The real problem is not passing floats vs passing words. The real problem
is that the passed floats must be stored in the hash table, and the existing
hash table design requires the hash table elements to be Words. This requires
boxing the floats again, so that they can be stored, and later compared against
other floats. Your boxed(float) proposal does not touch on this at all.
My proposal would have optimized this by reusing the original boxes of the
floats.

The solution I have now adopted instead is to parameterize the hash table code
even further, by type, so that instead of one table type, there are three.
This allows the code to store floats in the hash table in their native format.

Zoltan.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list