GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-128563: Move labels in ceval.c to bytecodes.c by Fidget-Spinner · Pull Request #129112 · python/cpython

Conversation

@Fidget-Spinner

@Fidget-Spinner Fidget-Spinner commented Jan 21, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: A new tail-calling interpreter for significantly better interpreter performance #128563

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Fidget-Spinner
Move labels in ceval.c to bytecodes.c
2082537
@Fidget-Spinner
Fidget-Spinner requested review from a team, erlend-aasland and markshannon as code owners January 21, 2025 00:55
@bedevere-app bedevere-app Bot mentioned this pull request Jan 21, 2025
A new tail-calling interpreter for significantly better interpreter performance #128563
Closed
@Fidget-Spinner Fidget-Spinner added the skip news label Jan 21, 2025
@bedevere-app bedevere-app Bot added the awaiting core review label Jan 21, 2025
Fidget-Spinner added 3 commits January 21, 2025 08:58
@Fidget-Spinner
Fix mypy
5cccb98
@Fidget-Spinner
lint
3ae88a5
@Fidget-Spinner
Add to generated files
af4bf1a
@Fidget-Spinner
Fidget-Spinner requested a review from ericsnowcurrently as a code owner January 21, 2025 07:52
@markshannon

markshannon commented Jan 21, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I don't think adding another code generator is the way to go.
The code in labels is part of the interpreter, so they should be handled similarly to instructions.

For code in labels we will, in the future, want to:

  • Spill the stack around escaping calls
  • Use the same dispatching mechanism as for instructions
  • Potentially access stack variables without cumbersome explicit pops and pushes.

I'm not suggesting that we do any of the above in this PR. The simple code you generate is fine for now, but it needs to be a bit more closely integrated into the interpreter/JIT generators.

Since labels exist outside the dispatch loop, we'll need to generate the dispatch loop as well. We can simply copy the few lines of code surrounding #include "generated_cases.c.h" into the tier1 code generator.

The tier 1 code generator would then generate:

  • The dispatch preamble (from /* Start instructions */ onwards)
  • The cases
  • The dispatch loop end including EXTRA_CASES up to Py_UNREACHABLE();
  • All the labels
Fidget-Spinner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fidget-Spinner
Move labels into tier 1 generator
b911bb1
@Fidget-Spinner

Fidget-Spinner commented Jan 21, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Alright. I've moved the labels generator back into the tier 1 generator. We need to port over tier 2 in a separate PR as well.

I've combined the switch-case generator into the cases generator as well.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner added 6 commits January 21, 2025 20:13
@Fidget-Spinner
remove outdated file
63a88ab
@Fidget-Spinner
cleanup diff
c6df7a1
@Fidget-Spinner
Lint
1ec8033
@Fidget-Spinner
Merge remote-tracking branch 'upstream/main' into labels-in-dsl
fdd4540
@Fidget-Spinner
fix upstream changes
15ca6dd
@Fidget-Spinner
Remove entry_frame
e1f9475
markshannon
markshannon reviewed Jan 22, 2025
View reviewed changes

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Mostly looks good. One thing doesn't look right

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Tools/cases_generator/tier1_generator.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner added 2 commits January 23, 2025 02:00
@Fidget-Spinner
Address review by removing in test cases generator
5d56130
@Fidget-Spinner
Regen files
e4a9de7
@Fidget-Spinner
Fidget-Spinner requested a review from markshannon January 23, 2025 14:32
markshannon
markshannon requested changes Jan 24, 2025
View reviewed changes

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Adding the markers to the generated code for testing looks good, but the parsing in the test is a bit cumbersome.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_generated_cases.py Outdated
lines.pop(0)
while lines and lines[-1].startswith(("#", "\n")):
lines.pop(-1)
while lines and tier1_generator.INSTRUCTION_START_MARKER not in lines[0]:

@markshannon markshannon Jan 24, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

You can replace this line by line processing, including the start and end comment stripping, by splitting the whole file on INSTRUCTION_START_MARKER and INSTRUCTION_START_MARKER, discarding the first and last parts.

text = temp_output.read()
_, rest = text.split(INSTRUCTION_START_MARKER)
actual, _ = rest.split(LABEL_START_MARKER)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Fidget-Spinner Fidget-Spinner Jan 25, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good observation. Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting core review labels Jan 24, 2025
@bedevere-app

bedevere-app Bot commented Jan 24, 2025

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner added 2 commits January 25, 2025 11:18
@Fidget-Spinner
Address review
f89f147
@Fidget-Spinner
fixup
56413ae
Fidget-Spinner added a commit to Fidget-Spinner/cpython that referenced this pull request Jan 25, 2025
@Fidget-Spinner
partial fix (waiting for python#129112 )
fda19f4
@markshannon
markshannon self-requested a review January 27, 2025 10:25
markshannon
markshannon approved these changes Jan 27, 2025
View reviewed changes

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for doing this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting changes labels Jan 27, 2025
@Fidget-Spinner
Fidget-Spinner merged commit 87fb8b1 into python:main Jan 27, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Jan 27, 2025
colesbury added a commit to colesbury/cpython that referenced this pull request Jan 29, 2025
@colesbury
Revert "pythongh-128563: Move labels in ceval.c to bytecodes.c (pytho…
8014514
…nGH-129112)"

This reverts commit 87fb8b1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon markshannon approved these changes
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Fidget-Spinner @markshannon
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.