[RFA] Avoid macro expansion side-effects w/DEBUG_LOCALS_INSN
Keith Seitz
keiths@redhat.com
Wed May 9 00:13:00 GMT 2007
Hi,
The attached patch fixes all users of the DEBUG_LOCALS_INSN macro (in
the debug interpreter) which are currently experiencing macro side
effects in certain insns. An example is op_storea:
op_storea:
STOREA(GET1U ());
NEXT_INSN;
In the DEBUG interpreter, this is expanded to:
op_storea:
do
{
DEBUG_LOCALS_INSN (GET1U (), 'o');
locals[GET1U ()].o = (--sp)->o;
}
while (0);
GET1U is defined as "(pc++)->int_val" (via INTVAL macro).
Obviously, this causes really bad things to happen in the DEBUG
interpreter with the double-increment of the PC.
I have fixed these using temporary variables in the various STORE*
macros to hold the passed value before using it in DEBUG_LOCALS_INSN and
the rest of the macro.
Since the code doesn't diff particularly well, I would appreciate it if
more eyes would double-check the translation, since I could very well
have made a typo. [Although I have double-checked it forty times...]
QCC?
Keith
ChangeLog
2007-05-08 Keith Seitz <keiths@redhat.com>
* interpret.cc (STOREA): Rewrite using temporary variable to
avoid double-macro expansion side-effects.
(STOREI): Likewise.
(STOREF): Likewise.
(STOREL)[SIZEOF_VOID_P == 8]: Likewise.
(STORED)[SIZEOF_VOID_P == 8]: Likewise.
(STOREL)[SIZEOF_VOID_P != 8]: Likewise.
(STORED)[SIZEOF_VOID_P != 8]: Likewise.
(POKEI): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DEBUG_LOCALS_INSN-macro-side-effects.patch
Type: text/x-patch
Size: 3682 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20070509/3cced6d8/attachment.bin>
More information about the Java-patches
mailing list