Skip to content

_CHECK_FUNCTION interferes with partial evaluation #126902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Fidget-Spinner opened this issue Nov 16, 2024 · 0 comments
Open

_CHECK_FUNCTION interferes with partial evaluation #126902

Fidget-Spinner opened this issue Nov 16, 2024 · 0 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@Fidget-Spinner
Copy link
Member

Fidget-Spinner commented Nov 16, 2024

Feature or enhancement

Proposal:

A reminder of how _CHECK_FUNCTION looks like:

        tier2 op(_CHECK_FUNCTION, (func_version/2 -- )) {
            assert(PyStackRef_FunctionCheck(frame->f_funcobj));
            PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj);
            DEOPT_IF(func->func_version != func_version);
        }

frame->f_funcobj becomes invalid once we start inlining functions. Thus we should "burn in" the function object version to be checked whenever possible, to not interfere with inlining and partial evaluation.

An added benefit is that the "burned in" version is also cheaper as it doesn't have to read from the frame struct, rather reading from the instruction itself in the JIT.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

@Fidget-Spinner Fidget-Spinner added the type-feature A feature request or enhancement label Nov 16, 2024
@picnixz picnixz added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants