[m-dev.] Mercury tags in C (was: tests in tests/debugger/declarative failed)

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Feb 16 14:56:39 AEDT 2000


On 16-Feb-2000, Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> Fergus wrote:
> > - Actually the tag numbers are currently the same in all grades;
> >   they differ depending on the number of tag bits available,
> >   which depends on the architecture (32- or 64-bit).
> 
> Just for the record, this is not true for the HAL version of Mercury.  In 
> `.rt' (reserve tag) grades, a tag is reserved for representing unbound 
> variables, which as a consequence also means enumeration types are 
> represented using the same format as discriminated union types and there are 
> no `no tag' types.

So in `.tr' grades, every discriminated union
type has a special representation for unbound.
What about builtin types like `int'?

`no tag' types are really quite an important feature
of Mercury.  Haskell has a special language construct
for this; Mercury doesn't have special syntax, but
nevertheless it's quite important that such types can
be represented without any space overhead.

If `int' doesn't have any representation for unbound,
then a type such as `:- type foo ---> mk_foo(int).'
will clearly need a different representation.
But for a type of the form

	:- type foo(...) ---> mk_foo(bar(...)).

where `bar' has a representation for unbound variables,
can't you represent unbound variables of type `foo'
just the same as unbound variables of type `bar'?

> So far the only types I've discovered which use hard-coded tags in C are 
> `list/1' and `comparison_result' (found just yesterday :-).  It looks like 
> there are some more in `trace/mercury_trace_declarative.h', which should be 
> straightforward to fix now that I know about them.  Can anybody think of any 
> others off the top of their head?

There are quite a few places where we assume that enumerations will
be represented the same in Mercury as they are in C.

Have a good look in browser/debugger_interface.m.
In particular, check the arity, determinism, pred_or_func, etc. types.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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