Alignment of stack traces

Boehm, Hans hans_boehm@hp.com
Wed Feb 28 17:17:00 GMT 2001


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


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /