This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: Alignment of stack traces
- To: "Boehm, Hans" <hans_boehm at hp dot com>
- Subject: RE: Alignment of stack traces
- From: Andrew Haley <aph at redhat dot com>
- Date: Thu, 1 Mar 2001 20:26:12 +0000 (GMT)
- Cc: "'Jeff Sturm'" <jsturm at one-point dot com>,Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>,"'java at gcc dot gnu dot org'" <java at gcc dot gnu dot org>
- References: <140D21516EC2D3119EE7009027876644049B5C52@hplex1.hpl.hp.com>
Boehm, Hans writes:
> Are there enough other uses for this that it's worth doing?
>
> Java primitive arrays almost fit the bill here, except that there's no way
> to say "an array of pointer-sized integers. Java object arrays would work,
> but add extra scanning time.
>
> For now I'm using an array of Java longs, which doesn't appear to have
> broken anything on Itanium. But I haven't even rebuilt on X86 yet.
An array of Java longs ought to do it, but it may not always work; a
pointer doesn't have to be the same size as a jlong.
The cleanest way to fix this is probably to copy the data from the
byte array to an array of pointers when it's time to print the stack
trace. The difference in efficiency is so marginal as not to be worth
worrying about.
Is this OK?
Andrew.
2001-03-01 Andrew Haley <aph@redhat.com>
* java/lang/natThrowable.cc (printRawStackTrace): Copy the
stackTrace buffer to a correctly aligned pointer array.
Index: java/lang/natThrowable.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natThrowable.cc,v
retrieving revision 1.8
diff -u -r1.8 natThrowable.cc
--- natThrowable.cc 2000/12/22 06:19:24 1.8
+++ natThrowable.cc 2001/03/01 20:23:04
@@ -83,8 +83,9 @@
if (!stackTrace)
return;
- void **p = (void **)elements (stackTrace);
int depth = stackTrace->length / sizeof p[0];
+ void *p[depth];
+ memcpy (p, elements (stackTrace), stackTrace->length);
_Jv_name_finder finder (_Jv_ThisExecutable ());