[clean-list] About abstract synonym types...

Fergus Henderson fjh@cs.mu.oz.au
Fri, 6 Feb 2004 13:18:05 +1100


On 05-Feb-2004, Marco Kesseler <m.wittebrood@mailbox.kun.nl> wrote:
> [Fergus wrote:]
> > For example, the original Mercury implementation represents 
> > all data types as a single word (types such as tuples that 
> > don't fit in a single word get boxed), and the argument 
> > passing convention is that the first input argument goes in 
> > register r1, the second in r2, etc.  This argument passing 
> > convention does not depend on the types of the arguments. I 
> 
> Isn't it so that some boxing and unboxing may occur - next to just
> passing around types -, which does make the convention depend on the
> type of the arguments?

No.

The calling convention ensures that everything that needs to be boxed
is already boxed.  The only time unboxing would be needed is when
some concrete operation (e.g. addition of two floating point numbers,
or extracting the field of a tuple) is performed, but since the type
is abstract that can only occur where the concrete type definition is
visible, i.e. in the module which defines the type.  For modules which
merely pass abstract values around, the generated code doesn't need to do
any unboxing.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.