This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Optimize compiled bytecodes in tracepoint conditionals


This patch is the GDBserver version of the compiled bytecode optimization for tracepoints that I reported on at the GCC summit last year. It is a fairly basic instruction combination pattern, in which pairs of comparison and if_goto bytecodes are recognized specially, and get a custom x86 instruction sequence that uses the condition codes directly, rather than manipulating a 64-bit 0-or-1 value on the stack.

Although this optimization originally yielded as much as a 30% speedup in tracepoint conditional testing with the original application that incorporated a custom GDB stub, the improvement in the GDBserver context is more like 3-5%, for both i386 and x86-64. There are a great many differences in the environment, and it could simply be that my original results were mistaken; so I'd be interested in hearing from anybody doing their own experiments with this code. (I recommend the tspeed.exp test as a starting point.)

In any case, even a small speedup is worthwhile, so I plan to commit this in a few days if nobody has any objections to this rather arcane bit of code.

Stan
stan@codesourcery.com

2011-09-11 Stan Shebs <stan@codesourcery.com>

    * server.h (struct emit_ops): Add compare-goto fields.
    * tracepoint.c (gdb_agent_op_sizes): New table.
    (emit_eq_goto): New function.
    (emit_ne_goto): New function.
    (emit_lt_goto): New function.
    (emit_le_goto): New function.
    (emit_gt_goto): New function.
    (emit_ge_goto): New function.
    (is_goto_target): New function.
    (compile_bytecodes): Recognize special cases of compare-goto
    combinations and call specialized emitters for them.
    * linux-x86-low.c (amd64_emit_eq_goto): New function.
    (amd64_emit_ne_goto): New function.
    (amd64_emit_lt_goto): New function.
    (amd64_emit_le_goto): New function.
    (amd64_emit_gt_goto): New function.
    (amd64_emit_ge_goto): New function.
    (amd64_emit_ops): Add the new functions.
    (i386_emit_eq_goto): New function.
    (i386_emit_ne_goto): New function.
    (i386_emit_lt_goto): New function.
    (i386_emit_le_goto): New function.
    (i386_emit_gt_goto): New function.
    (i386_emit_ge_goto): New function.
    (i386_emit_ops): Add the new functions.


Attachment: tpopt-patch-1
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]