Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-111485: Remove some special cases from the code generator and bytecodes.c#111540

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
markshannon merged 3 commits intopython:mainfromfaster-cpython:make-tiers-explicit
Oct 31, 2023

Conversation

markshannon
Copy link
Member

@markshannonmarkshannon commentedOct 31, 2023
edited by bedevere-appbot
Loading

  • Removes a bunch of special cases for tier-1-only instruction detection, making them explicit in bytecodes.c withTIER_ONE_ONLY.
  • Don't emit or check formats for psuedo-instructions. They don't exist in the bytecode, so don't have a format.
  • Make the counter inJUMP_BACKWARD explicit
  • Fix error handling inMAKE_CELL so it can be executed in tier 2.

@markshannonmarkshannon changed the titleRemove some special cases from the code generator and bytecodes.cGH-111485: Remove some special cases from the code generator and bytecodes.cOct 31, 2023
@markshannonmarkshannon merged commit2904d99 intopython:mainOct 31, 2023
"exception_unwind",
"import_from",
"import_name",
"_PyObject_CallNoArgs", # Proxy for BEFORE_WITH
Copy link
Member

@brandtbucherbrandtbucherNov 2, 2023
edited
Loading

Choose a reason for hiding this comment

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

@gvanrossum, do we know why we were special-casingBEFORE_WITH like this?

I ask because it looks like this PR madeBEFORE_ASYNC_WITH (which also uses_PyObject_CallNoArgs) a viable uop. Itseems fine, but maybe I'm missing something.

Copy link
Member

Choose a reason for hiding this comment

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

@gvanrossum, do we know why we were special-casingBEFORE_WITH like this?

I ask because it looks like this PR madeBEFORE_ASYNC_WITH (which also uses_PyObject_CallNoArgs) a viable uop. Itseems fine, but maybe I'm missing something.

Urgh, I have no idea. :-( Agreed that both seem fine. Either both should have theTIER_ONE_ONLY marker, or neither should. Let me dig through some history:

It's been like this since the cases_generator code first landed (#105924). And even then, commenting out that line makesBEFORE_*WITH appear in the output and it compiles just fine. In the PR I found this commit though:
e3471da

The commit message gives a clue:

Fix test_memoryview by excluding BEFORE_WITH

Unclear what's wrong with that opcode."

Commenting out the line, regenerating, and then running./python.exe -Xuops -m test test_memoryview gives this error:

test test_memoryview failed -- Traceback (most recent call last):  File "/Users/guido/cpython/Lib/test/test_memoryview.py", line 288, in test_contextmanager    self._check_released(m, tp)  File "/Users/guido/cpython/Lib/test/test_memoryview.py", line 273, in _check_released    with m:         ^ValueError: operation forbidden on released memoryview object

Doing the same on main, however, causes no crashes. Quite possibly whatever was defective in the original code generator and Tier 2 interpreter has since been fixed, and the TIER_ONE_ONLY marker can safely be removed from BEFORE_WITH. I don't feel like doing a bisection to figure out the exact commit that made the test_memoryview failure go away.

FullteaR pushed a commit to FullteaR/cpython that referenced this pull requestNov 3, 2023
aisk pushed a commit to aisk/cpython that referenced this pull requestFeb 11, 2024
@markshannonmarkshannon deleted the make-tiers-explicit branchAugust 6, 2024 10:17
Glyphack pushed a commit to Glyphack/cpython that referenced this pull requestSep 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gvanrossumgvanrossumgvanrossum left review comments

@brandtbucherbrandtbucherbrandtbucher left review comments

@iritkatrieliritkatrieliritkatriel approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@markshannon@iritkatriel@gvanrossum@brandtbucher

[8]ページ先頭

©2009-2025 Movatter.jp