RFA: Changes to interpreter to avoid non-debugging slowdown

Tom Tromey tromey@redhat.com
Wed Aug 2 22:56:00 GMT 2006


>>>>> "Kyle" == Kyle Galloway <kgallowa@redhat.com> writes:

Kyle> I noticed a small error in my last patch.  I accidentally whacked out an
Kyle> include in stacktrace.cc which will cause some problems.  The new patch
Kyle> is included in this file.

We're very close :-)

Kyle> +#define STOREA(I) 		\
Kyle> +DEBUG_LOCALS_INSN(I, 'o')	\
Kyle> +locals[I].o = (--sp)->o

It is more normal C style to make these kinds of macros "statement
like", so that users can use them without recalling exactly how they
expand.  So you'd write something like:

#define STOREA(I)              \
  do {                         \
    DEBUG_LOCALS_INSN(I, 'o'); \
    locals[I].o = (--sp)->o;   \
  } while (0)

This approach lets STOREA be used in an 'if' without remembering
whether it needs braces.

Kyle> +#define DEBUG
Kyle> +#undef DEBUG_LOCALS_INSN
Kyle> +#define DEBUG_LOCALS_INSN(s, t) {}
 
Likewise here, DEBUG_LOCALS_INSN could be 'do {} while (0)'.

I notice neither definition of DEBUG_LOCALS_INSN does anything... I
presume that will follow?

Tom



More information about the Java-patches mailing list