#endif
DPRINTF(3,
- "Entering _PyUopExecute for %s (%s:%d) at offset %ld\n",
+ "Entering _PyUopExecute for %s (%s:%d) at byte offset %ld\n",
PyUnicode_AsUTF8(_PyFrame_GetCode(frame)->co_qualname),
PyUnicode_AsUTF8(_PyFrame_GetCode(frame)->co_filename),
_PyFrame_GetCode(frame)->co_firstlineno,
- (long)(frame->prev_instr + 1 -
+ 2 * (long)(frame->prev_instr + 1 -
(_Py_CODEUNIT *)_PyFrame_GetCode(frame)->co_code_adaptive));
PyThreadState *tstate = _PyThreadState_GET();
}
insert_executor(code, src, index, executor);
assert(frame->prev_instr == src);
+ frame->prev_instr = dest - 1;
return executor->execute(executor, frame, stack_pointer);
jump_to_destination:
frame->prev_instr = dest - 1;
}
i += _PyInstruction_GetLength(code, i);
}
- PyErr_SetString(PyExc_ValueError, "no executor at given offset");
+ PyErr_SetString(PyExc_ValueError, "no executor at given byte offset");
return NULL;
}
_PyUOpInstruction *trace,
int max_length)
{
+#ifdef Py_DEBUG
+ _Py_CODEUNIT *initial_instr = instr;
+#endif
int trace_length = 0;
#ifdef Py_DEBUG
trace_length++;
DPRINTF(4,
- "Optimizing %s (%s:%d) at offset %ld\n",
+ "Optimizing %s (%s:%d) at byte offset %ld\n",
PyUnicode_AsUTF8(code->co_qualname),
PyUnicode_AsUTF8(code->co_filename),
code->co_firstlineno,
- (long)(instr - (_Py_CODEUNIT *)code->co_code_adaptive));
+ 2 * (long)(initial_instr - (_Py_CODEUNIT *)code->co_code_adaptive));
for (;;) {
ADD_TO_TRACE(SAVE_IP, (int)(instr - (_Py_CODEUNIT *)code->co_code_adaptive));
if (trace_length > 3) {
ADD_TO_TRACE(EXIT_TRACE, 0);
DPRINTF(1,
- "Created a trace for %s (%s:%d) at offset %ld -- length %d\n",
+ "Created a trace for %s (%s:%d) at byte offset %ld -- length %d\n",
PyUnicode_AsUTF8(code->co_qualname),
PyUnicode_AsUTF8(code->co_filename),
code->co_firstlineno,
- (long)(instr - (_Py_CODEUNIT *)code->co_code_adaptive),
+ 2 * (long)(initial_instr - (_Py_CODEUNIT *)code->co_code_adaptive),
trace_length);
return trace_length;
}
else {
DPRINTF(4,
- "No trace for %s (%s:%d) at offset %ld\n",
+ "No trace for %s (%s:%d) at byte offset %ld\n",
PyUnicode_AsUTF8(code->co_qualname),
PyUnicode_AsUTF8(code->co_filename),
code->co_firstlineno,
- (long)(instr - (_Py_CODEUNIT *)code->co_code_adaptive));
+ 2 * (long)(initial_instr - (_Py_CODEUNIT *)code->co_code_adaptive));
}
return 0;