alignment of string literals
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Mar 24 14:41:20 AEDT 1999
On 24-Mar-1999, in mail to mercury-bugs at cs.mu.oz.au,
Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> I've found another bug, similar to an earlier deep_copy/univ one. It
> involves sticking maps into the io__globals and pulling them out again,
> sometimes corrupted (seems to be mainly the strings used as keys, but they
> could just be the most obvious symptom).
I have tracked this one down.
The bug is due to string literals not being aligned
but the code for deep_copy assuming that they are.
For now, the simple fix is to change the code for deep_copy.
I will post the diff for this in a separate message.
The alternative fix would be to change to the way we generate code
for string literals to ensure that they are aligned.
I think our original idea regarding alignment of string literals was
that the tag allocation / data representation would assume that string
literals are aligned. But in fact it currently does not do that.
If you do assume string literals are aligned, then in some cases
it's possible to use a more efficient representation than the one
we currently use. But using that kind of representation does make
some things more complicated. For example, store__arg_ref and/or
store__set_ref would need to become more complicated (and less
efficient). So perhaps it would be simpler to just stick with
our current data representation scheme, in which case we can drop
the assumption that string literals are aligned.
Are there any other places where we rely on string literals being aligned?
(I can't think of any, but maybe there are some that I have forgotten about.)
--
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.
More information about the developers
mailing list