-
-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Tier 2 Optimizer Eliminate Type Version Guards #119258
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-feature
A feature request or enhancement
Comments
brandtbucher
added a commit
that referenced
this issue
May 28, 2024
Fidget-Spinner
added a commit
that referenced
this issue
Jun 8, 2024
…-119365) Co-authored-by: parmeggiani <parmeggiani@spaziodati.eu> Co-authored-by: dpdani <git@danieleparmeggiani.me> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com> Co-authored-by: Ken Jin <kenjin@python.org>
Fidget-Spinner
added a commit
that referenced
this issue
Jun 20, 2024
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this issue
Jul 11, 2024
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this issue
Jul 11, 2024
…er (pythonGH-119365) Co-authored-by: parmeggiani <parmeggiani@spaziodati.eu> Co-authored-by: dpdani <git@danieleparmeggiani.me> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com> Co-authored-by: Ken Jin <kenjin@python.org>
estyxx
pushed a commit
to estyxx/cpython
that referenced
this issue
Jul 17, 2024
estyxx
pushed a commit
to estyxx/cpython
that referenced
this issue
Jul 17, 2024
…er (pythonGH-119365) Co-authored-by: parmeggiani <parmeggiani@spaziodati.eu> Co-authored-by: dpdani <git@danieleparmeggiani.me> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com> Co-authored-by: Ken Jin <kenjin@python.org>
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
Feature or Enhancement:
Proposal:
Note: I made this issue at the PyCon sprints discussing with @Fidget-Spinner and in collaboration with @dpdani
The tier 2 optimizer should eliminate type version guards if it is safe to do.
It is safe if it has previously checked the type version guard at runtime and we haven't had an escape opt since then.
Note that this will need
Py_Decref
to be deferred before the 3.13 final release, to be usable, because otherwise there could be an escape anywhere we decrement the reference count.Example
For example, if we have this code:
then when
thing
is executed it should only run the type guard once.If we disassemble this code then we see it emits the
LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES
bytecode:If we look at the definition of
LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES
, we see it uses_GUARD_TYPE_VERSION
(inbytecodes.c
:So if this is executed one after the other, without any unknown function calls in the middle, it should remove the second
_GUARD_TYPE_VERSION
call.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
STORE_ATTR_WITH_HINT
in tier two #119481The text was updated successfully, but these errors were encountered: