[m-rev.] structure flattening

Peter Wang novalazy at gmail.com
Mon May 2 15:01:01 AEST 2011


Michael Day asked me about a generalisation of the no-tag optimisation,
for du types with multiple constructors.

    :- type variant
	--->    foo(foo)
	;       bar(bar).

    :- type foo ---> foo(a, b, c).

    :- type bar ---> bar(d, e, f).

variant could be represented as tagged pointers to foo and bar
values respectively, instead of tagged pointers to single word boxes.

This could only work if foo and bar are known, and whose representations
don't require the tag bits now used for variant.  To avoid problems due
to differing module imports, I suggested that the optimisation could be
only applied if variant/foo/bar are all defined within the interface
section of the same module, so that they would always be imported
together.  (Or if the types are not exported.)

I have doubts that the gains would be enough to justify the effort,
but I'm interested to hear any thoughts about it.

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