[m-rev.] structure flattening

Paul Bone pbone at csse.unimelb.edu.au
Thu Aug 11 13:10:37 AEST 2011


On Mon, May 02, 2011 at 03:01:01PM +1000, Peter Wang wrote:
> Hi,
> 
> 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.
> 

Can you do some sort of analysis to see how often this occurs?  Perhaps by
writing the part of the transformation that recognizes if the transformation is
applicable?

Thanks.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20110811/6d53ed52/attachment.sig>


More information about the reviews mailing list