This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Re: Use of pointer casts in the interpreter
- To: Per Bothner <per@bothner.com>
- Subject: Re: Use of pointer casts in the interpreter
- From: Kresten Krab Thorup <krab@gnu.org>
- Date: 10 Aug 1999 16:52:29 +0900
- Cc: java-patches@sourceware.cygnus.com
- References: <199908081420.HAA21002@fencer.cygnus.com> <m2g11tcw6s.fsf@magnus.bothner.com> <wxp907lf4wy.fsf@harp.is.s.u-tokyo.ac.jp> <m2btcgtu3x.fsf@magnus.bothner.com>
Per Bothner <per@bothner.com> writes:
> Kresten Krab Thorup <krab@gnu.org> writes:
> > #define PUSHA(V) \
> > - ({ jobject __v=(V); *(jobject*)sp++ = __v; })
> > + ({ jobject __v=(V); (sp++)->o = __v; })
>
> I'm curious as to why you use the temporary variable __v.
> To me it seems like nothing but overhead (more verbose, harder to
> read, more work for the compiler, more variables to emit in
> the debugging symbols).
I just did this to make them more robust; there are some cases where
the argument to PUSH involves the stack itself, and then the order of
those pre- and post increment opeations might be wrong.
But maybe you can tell me this, is
*p++ = *--p;
equivalent to
tmp = *--p;
*p++ = tmp;
If it is, then clearly the extra local is not necessary.
-- Kresten
Kresten Krab Thorup, Ph.D. Candidate
c/o Yonezawa Laboratory
Department of Information Science
The University of Tokyo
7-3-1 Hongo, Bunkyo-ku, Tokyo 113 Japan
Fax: +81-(0)3-5689-4365
Phone: +81-(0)3-5841-4118
Mobile: +81-(0)90-3693-5715