aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/optimizer.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/optimizer.c')
-rw-r--r--Python/optimizer.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c
index 08073193c02..8d4162b44c2 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -372,9 +372,7 @@ translate_bytecode_to_trace(
_PyUOpInstruction *trace,
int buffer_size)
{
-#ifdef Py_DEBUG
_Py_CODEUNIT *initial_instr = instr;
-#endif
int trace_length = 0;
int max_length = buffer_size;
@@ -456,6 +454,19 @@ translate_bytecode_to_trace(
break;
}
+ case JUMP_BACKWARD:
+ {
+ if (instr + 2 - oparg == initial_instr
+ && trace_length + 3 <= max_length)
+ {
+ ADD_TO_TRACE(JUMP_TO_TOP, 0);
+ }
+ else {
+ DPRINTF(2, "JUMP_BACKWARD not to top ends trace\n");
+ }
+ goto done;
+ }
+
default:
{
const struct opcode_macro_expansion *expansion = &_PyOpcode_macro_expansion[opcode];