[m-rev.] diff: disable closure layouts for non-C targets
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Mar 7 19:22:54 AEDT 2002
On 06-Mar-2002, Peter Ross <peter.ross at miscrit.be> wrote:
> What I suspect should be fixed is the outputing of references to arrays
> in mlds_to_c.m, which is I assume why we needed to use the pointer type.
> After all an array an int array is also a pointer to int in C if output
> correctly.
It's a bit tricky. C does distinguish between pointer types and array
types. The C types `int *' (pointer to int), `int []' (array of int), and
`int (*)[]' (pointer to array of int) are all different. It's just that
array types are implicitly converted to pointer types in certain contexts.
For the IL and Java back-ends, the MLDS type `mlds__array_type(T)' always
means a object which refers to (points to) the actual data on the heap.
For the C back-end, however, `mlds__array_type(T)' means an actual
array, not a pointer. We do need some way in the MLDS to represent
an actual array, not a pointer -- we need this so that we can define
non-heap-allocated arrays, e.g. local variables and static constants of
array type. And `mlds__array_type(T)' is the obvious way of representing
this. But this leads to the situation that `mlds__array_type(T)' means
different things depending on which target language you are compiling to.
When I wrote that code for closure layouts, I was really only thinking
of the C back-end.
We need to come up with some consistent story for how arrays and
references to arrays are represented in the MLDS, so that code
using them will work with all the different MLDS back-ends.
Currently I'm not sure what it should be.
I will have a look at the code and think about it a bit more.
--
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-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list