This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Alignment of stack traces
- To: "'java at gcc dot gnu dot org'" <java at gcc dot gnu dot org>
- Subject: Alignment of stack traces
- From: "Boehm, Hans" <hans_boehm at hp dot com>
- Date: Wed, 28 Feb 2001 17:17:22 -0800
natThrowable.cc contains the code:
// ??? Might this cause a problem if the byte array isn't aligned?
stackTrace = JvNewByteArray (n * sizeof p[0]);
memcpy (elements (stackTrace), p+1, (n * sizeof p[0]));
As far as I can tell, the answer to the initial question is "yes". I seem
to be getting an alignment fault somewhere near the access of one of the
traces that results from this on an Itanium machine. (This is a little
vague, since the Itanium gdb doesn't seem to get along very well with gcj at
the moment.)
This makes sense to me, since the array size is 32 bits. Thus a byte array
naturally ends up with unaligned data on a 64-bit machine.
Why does this work on Alpha? Do stack traces print correctly there?
What's the right solution here? Should the stack trace just be an array of
java longs? This would overconstrain the 32-bit case, but that doesn't seem
to be a big deal.
Thanks.
Hans