[m-dev.] Minimal streams diff

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Oct 3 11:54:22 AEST 2002


On 02-Oct-2002, Michael Day <mikeday at yeslogic.com> wrote:
> 
> > 	- this patch is not OK because it will make things inefficient,
> > 	  given our current optimization technology
> 
> By cross-module type class calls you mean calls to read_char and
> write_char made from outside the module they are defined in? And these
> can't be specialised if intermodule optimisation is not enabled, requiring
> a method dictionary lookup even when the stream type is known? This seems
> like a problem with any type class based stream implementation, but surely
> it's reasonable to assume that intermodule optimisation will be enabled
> when efficiency is a concern?

Currently intermodule optimization is not enabled when compiling
the compiler itself (at least for the Mercury source distribution),
due to concerns about compilation time.

Also, currently intermodule optimization currently doesn't inline calls to
class methods, unless the procedure used to implement the class method
happens to be exported, or is called by some other inline exported procedure,
because such procedures used to implement class methods don't get put in
the `.opt' file.

Also, when we do type class specialization, we currently generate the
specialized code in the calling module and don't try to merge duplicate
instances resulting from calls in different modules (in fact I'm not even
sure if we even avoid duplicate instances in the same module).
This might result in significant code size increases due to
code duplication.

(Also, note that currently intermodule optimization does not work for type
class instance definitions that define clauses in the instance definition.
So if you care about efficiency, you need to use the the "is" syntax,
i.e. "method is foo/N".

And currently intermodule optimization can result warnings from the
C compiler when using --high-level-code.)

It would of course be nice to fix all of these things, but it is not
going to happen overnight.

> The solution to this (besides requiring intermodule optimisation) would be
> to leave the original io interface intact. However, this would require
> changing the name of the stream read_char and write_char predicates or
> moving them back to a separate stream module.

Right.  Probably the latter is best, IMHO.

-- 
Fergus Henderson <fjh at 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.
--------------------------------------------------------------------------
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