diff options
author | Raymond Hettinger <python@rcn.com> | 2004-02-08 19:59:27 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-02-08 19:59:27 (GMT) |
commit | a72169871dec0905b47d7de2198cd3998a2c0d25 (patch) | |
tree | 8c5a330d44ae68690b6b8c24a7972fbfe73036a0 | |
parent | ce9b4714efc86c098d677375922afb49a1877dbe (diff) | |
download | cpython-a72169871dec0905b47d7de2198cd3998a2c0d25.zip cpython-a72169871dec0905b47d7de2198cd3998a2c0d25.tar.gz cpython-a72169871dec0905b47d7de2198cd3998a2c0d25.tar.bz2 |
SF patch #884022: dynamic execution profiling vs opcode prediction
(Contributed by Andrew I MacIntyre.)
disables opcode prediction when dynamic execution
profiling is in effect, so the profiling counters at
the top of the main interpreter loop in eval_frame()
are updated for each opcode.
-rw-r--r-- | Python/ceval.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index c6e0470..f2d79e7 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -645,9 +645,18 @@ eval_frame(PyFrameObject *f) A successful prediction saves a trip through the eval-loop including its two unpredictable branches, the HASARG test and the switch-case. + + If collecting opcode statistics, turn off prediction so that + statistics are accurately maintained (the predictions bypass + the opcode frequency counter updates). */ +#ifdef DYNAMIC_EXECUTION_PROFILE +#define PREDICT(op) if (0) goto PRED_##op +#else #define PREDICT(op) if (*next_instr == op) goto PRED_##op +#endif + #define PREDICTED(op) PRED_##op: next_instr++ #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr[2]<<8) + \ next_instr[1]; next_instr += 3 |