[3.11] GH-93516: Backport GH-93769 (GH-94231)

* Store offset of first traceable instruction to avoid having to recompute it all the time when tracing.
This commit is contained in:
Mark Shannon 2022-06-28 16:30:22 +01:00 committed by GitHub
parent 50a2e36ce9
commit 3b4f5ed168
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 217 additions and 209 deletions

View file

@ -341,6 +341,12 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
co->_co_linearray = NULL;
memcpy(_PyCode_CODE(co), PyBytes_AS_STRING(con->code),
PyBytes_GET_SIZE(con->code));
int entry_point = 0;
while (entry_point < Py_SIZE(co) &&
_Py_OPCODE(_PyCode_CODE(co)[entry_point]) != RESUME) {
entry_point++;
}
co->_co_firsttraceable = entry_point;
}
static int