FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-144179: Use recorded values to make optimizer more robust by markshannon · Pull Request #144437 · python/cpython · GitHub

/ cpython Public

GH-144179: Use recorded values to make optimizer more robust - #144437

Merged
markshannon merged 3 commits into
python:mainfrom
markshannon:optimize-using-recorded-values-2
Feb 5, 2026
Merged

GH-144179: Use recorded values to make optimizer more robust#144437
markshannon merged 3 commits into
python:mainfrom
markshannon:optimize-using-recorded-values-2

Conversation

markshannon commented Feb 3, 2026
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member
  • Add three new symbol kinds
  • Do not smuggle code object in _PUSH_FRAME operand
  • Fix small bug in predicate analysis

* Add three new symbol kinds
* Do not smuggle code object in _PUSH_FRAME operand
* Fix small bug in predicate analysis

Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You need tests for the new symbolic types in the optimizer_symbols.c as well.

Comment thread Python/bytecodes.c
tier2 op(_GUARD_CODE, (version/2 -- )) {
PyObject *code = PyStackRef_AsPyObjectBorrow(frame->f_executable);
EXIT_IF(code == Py_None);
EXIT_IF(((PyCodeObject *)code)->co_version != version);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why do we need this? Doesn't a _CHECK_VALIIDTY suffice?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

_CHECK_VALIDITY only checks if the executor is valid, not that we are executing the expected path.
We need to check that we have the expected code object.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't remember: do we have code version watchers? if so they should work with _CHECK_VALIDITY right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Watchers only work if they've been wired up, which is the job of the optimizer, not the front-end.

sym->tag = JIT_SYM_RECORDED_VALUE_TAG;
sym->recorded_value.known_type = true;
sym->recorded_value.value = value;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why do we not set bottom here and for the one below?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I presume you mean when sym->cls.type != Py_TYPE(value).
I'll add that.

markshannon merged commit b53fc7c into python:main Feb 5, 2026
75 checks passed
encukou pushed a commit to encukou/cpython that referenced this pull request Feb 5, 2026
…ythonGH-144437)

* Add three new symbol kinds
* Do not smuggle code object in _PUSH_FRAME operand
* Fix small bug in predicate analysis
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
…ythonGH-144437)

* Add three new symbol kinds
* Do not smuggle code object in _PUSH_FRAME operand
* Fix small bug in predicate analysis
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
…ythonGH-144437)

* Add three new symbol kinds
* Do not smuggle code object in _PUSH_FRAME operand
* Fix small bug in predicate analysis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL