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-135379: Remove types from stack items in code generator. by markshannon · Pull Request #135384 · python/cpython

Conversation

@markshannon

@markshannon markshannon commented Jun 11, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This removes the types from stack items in the code generator.
E.g

op(_SEND_GEN_FRAME, (receiver, v -- receiver, gen_frame: _PyInterpreterFrame *)) {

becomes

op(_SEND_GEN_FRAME, (receiver, v -- receiver, gen_frame) {

and the cast from _PyStackRef to _PyInterpreterFrame * is made explicit in the op definition.

This is a net zero change in terms of code size, but removes fiddly code generator code and replaces it with simple casts.
This also means that any future changes to the code generator, specifically for TOS caching, do not have to worry about inserting casts.

  • Issue: Top-of-stack caching in the JIT #135379

Sorry, something went wrong.

Uh oh!

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

efimov-mikhail reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@markshannon
Remove types from stack items in code generator. Make casts explicit …
8215f0e
…in the instruction definitions
@markshannon
markshannon requested a review from Fidget-Spinner as a code owner June 11, 2025 10:16
@bedevere-app bedevere-app Bot added the awaiting core review label Jun 11, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Jun 11, 2025
Top-of-stack caching in the JIT #135379
Closed
@markshannon markshannon added the skip news label Jun 11, 2025
markshannon added 2 commits June 11, 2025 11:19
@markshannon
Fix type error
d9c45c6
@markshannon
Fix up comments
2b8cc35
@Fidget-Spinner

Fidget-Spinner commented Jun 11, 2025

Copy link
Copy Markdown
Member

Looks good. However, can you add a news entry please? Downstream forks use the DSL now (like Cinder), so I think this should have a news entry. It's also big enough that it warrants it.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon

markshannon commented Jun 11, 2025

Copy link
Copy Markdown
Member Author

I know Cinder uses it, but it isn't part of any public API and we don't want it to be.
I guess a change note is fine, as long as it doesn't go in "what's new".

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

Fidget-Spinner commented Jun 11, 2025

Copy link
Copy Markdown
Member

Yeah I don't think it should be documented or in What's New either.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon
Add news
370059a
Fidget-Spinner
Fidget-Spinner approved these changes Jun 11, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Jun 11, 2025
@Fidget-Spinner Fidget-Spinner removed the skip news label Jun 11, 2025
@markshannon
markshannon merged commit c87b5b2 into python:main Jun 11, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 11, 2025
@markshannon
markshannon deleted the remove-stackitem-types branch June 11, 2025 14:52
@bedevere-bot

bedevere-bot commented Jun 11, 2025

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x RHEL9 3.x (tier-3) has failed when building commit c87b5b2.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1565/builds/2457) and take a look at the build logs.
  4. Check if the failure is related to this commit (c87b5b2) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1565/builds/2457

Failed tests:

  • test.test_multiprocessing_fork.test_processes

Failed subtests:

  • test_interrupt - test.test_multiprocessing_fork.test_processes.WithProcessesTestProcess.test_interrupt

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/test/_test_multiprocessing.py", line 588, in test_interrupt
    exitcode = self._kill_process(multiprocessing.Process.interrupt)
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/test/_test_multiprocessing.py", line 570, in _kill_process
    self.assertEqual(join(), None)
                     ~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/test/_test_multiprocessing.py", line 250, in __call__
    return self.func(*args, **kwds)
           ~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/multiprocessing/process.py", line 156, in join
    res = self._popen.wait(timeout)
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
    pid, sts = os.waitpid(self.pid, flag)
               ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/test/_test_multiprocessing.py", line 566, in handler
    raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-1' pid=3964973 parent=3964971 started daemon>


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/test/_test_multiprocessing.py", line 588, in test_interrupt
    exitcode = self._kill_process(multiprocessing.Process.interrupt)
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/test/_test_multiprocessing.py", line 570, in _kill_process
    self.assertEqual(join(), None)
                     ~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/test/_test_multiprocessing.py", line 250, in __call__
    return self.func(*args, **kwds)
           ~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/multiprocessing/process.py", line 156, in join
    res = self._popen.wait(timeout)
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
    pid, sts = os.waitpid(self.pid, flag)
               ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x/build/Lib/test/_test_multiprocessing.py", line 566, in handler
    raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-158' pid=3956945 parent=3954168 started daemon>
All reactions

Sorry, something went wrong.

Uh oh!

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

lkollar pushed a commit to lkollar/cpython that referenced this pull request Jun 19, 2025
@markshannon @lkollar
pythonGH-135379: Remove types from stack items in code generator. (py…
76eb7da
…thonGH-135384)

* Make casts explicit in the instruction definitions
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@markshannon @Pranjal095
pythonGH-135379: Remove types from stack items in code generator. (py…
62cd7da
…thonGH-135384)

* Make casts explicit in the instruction definitions
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@markshannon @taegyunkim
pythonGH-135379: Remove types from stack items in code generator. (py…
49e9079
…thonGH-135384)

* Make casts explicit in the instruction definitions
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@markshannon @Agent-Hellboy
pythonGH-135379: Remove types from stack items in code generator. (py…
c6e800f
…thonGH-135384)

* Make casts explicit in the instruction definitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Fidget-Spinner Fidget-Spinner Fidget-Spinner approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

3 participants

@markshannon @Fidget-Spinner @bedevere-bot
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.