mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
gh-120619: Optimize through _Py_FRAME_GENERAL
(GH-124518)
* Optimize through _Py_FRAME_GENERAL * refactor
This commit is contained in:
parent
8cc5aa47ee
commit
b84a763dca
3 changed files with 54 additions and 47 deletions
|
@ -385,6 +385,30 @@ get_code(_PyUOpInstruction *op)
|
|||
return co;
|
||||
}
|
||||
|
||||
static PyCodeObject *
|
||||
get_code_with_logging(_PyUOpInstruction *op)
|
||||
{
|
||||
PyCodeObject *co = NULL;
|
||||
uint64_t push_operand = op->operand;
|
||||
if (push_operand & 1) {
|
||||
co = (PyCodeObject *)(push_operand & ~1);
|
||||
DPRINTF(3, "code=%p ", co);
|
||||
assert(PyCode_Check(co));
|
||||
}
|
||||
else {
|
||||
PyFunctionObject *func = (PyFunctionObject *)push_operand;
|
||||
DPRINTF(3, "func=%p ", func);
|
||||
if (func == NULL) {
|
||||
DPRINTF(3, "\n");
|
||||
DPRINTF(1, "Missing function\n");
|
||||
return NULL;
|
||||
}
|
||||
co = (PyCodeObject *)func->func_code;
|
||||
DPRINTF(3, "code=%p ", co);
|
||||
}
|
||||
return co;
|
||||
}
|
||||
|
||||
/* 1 for success, 0 for not ready, cannot error at the moment. */
|
||||
static int
|
||||
optimize_uops(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue