mirror of
https://github.com/python/cpython.git
synced 2026-04-20 02:40:59 +00:00
gh-134584 : Optimize and eliminate redundant ref-counting for MAKE_FUNCTION in the JIT (GH-144963)
This commit is contained in:
parent
2acb8d9257
commit
38d3aef375
11 changed files with 1152 additions and 1107 deletions
|
|
@ -5511,20 +5511,25 @@ dummy_func(
|
|||
_DO_CALL_FUNCTION_EX +
|
||||
_CHECK_PERIODIC_AT_END;
|
||||
|
||||
inst(MAKE_FUNCTION, (codeobj_st -- func)) {
|
||||
op(_MAKE_FUNCTION, (codeobj_st -- func, co)) {
|
||||
PyObject *codeobj = PyStackRef_AsPyObjectBorrow(codeobj_st);
|
||||
|
||||
PyFunctionObject *func_obj = (PyFunctionObject *)
|
||||
PyFunction_New(codeobj, GLOBALS());
|
||||
|
||||
PyStackRef_CLOSE(codeobj_st);
|
||||
ERROR_IF(func_obj == NULL);
|
||||
if (func_obj == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
co = codeobj_st;
|
||||
DEAD(codeobj_st);
|
||||
|
||||
_PyFunction_SetVersion(
|
||||
func_obj, ((PyCodeObject *)codeobj)->co_version);
|
||||
func = PyStackRef_FromPyObjectSteal((PyObject *)func_obj);
|
||||
}
|
||||
|
||||
macro(MAKE_FUNCTION) = _MAKE_FUNCTION + POP_TOP;
|
||||
|
||||
inst(SET_FUNCTION_ATTRIBUTE, (attr_st, func_in -- func_out)) {
|
||||
PyObject *func = PyStackRef_AsPyObjectBorrow(func_in);
|
||||
PyObject *attr = PyStackRef_AsPyObjectSteal(attr_st);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue