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 — Spill the stack pointer across calls in the interpreter. · Issue #119866 · python/cpython

Spill the stack pointer across calls in the interpreter. #119866

New issue
Copy link
New issue
Copy link
Closed
Closed
Spill the stack pointer across calls in the interpreter.#119866
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)

Description

@markshannon
markshannon
opened on May 31, 2024
Issue body actions

For performance we keep the stack pointer in a register, however this means that the stack pointer is invisible to debuggers and other tools. If we spill the stack pointer across "escaping" calls, then most of the time we want to inspect the evaluation the stack pointer should be in memory.
Spilling the stack pointer is also a necessary precursor to deferred reference counting: faster-cpython/ideas#677, #117139, as it means there is no need to redundantly set the unused part of the stack to NULL.

Since the C compiler needs to spill values around calls, manually spilling the stack pointer has quite a low cost. It limits the freedom of the C compiler to allocate registers, but not that much.

Linked PRs

  • GH-119866: Spill stack pointer when making "escaping" calls. #119875
  • GH-119866: Spill before escaping calls in all cases. #124392
  • GH-119866: Don't clear frame->stackpointer on release builds #131750

Activity

  1. Eclips4
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on May 31, 2024
  2. python
    deleted a comment from Renatoff67 on May 31, 2024
  3. markshannon commented on Jun 6, 2024

    @markshannon
    markshannon
    on Jun 6, 2024
    MemberAuthor
    More actions

    Benchmarking shows negligible slowdown even when spilling the stack pointer on all escaping calls.

  4. colesbury commented on Aug 13, 2024

    @colesbury
    colesbury
    on Aug 13, 2024
    Contributor
    More actions

    @markshannon, are you still planning to work on this? If not, I can take a look at it.

  5. markshannon
    added a commit that references this issue on Oct 7, 2024

    GH-119866: Spill the stack around escaping calls. (GH-124392)

    da071fa
  6. markshannon
    closed this as completedon Oct 28, 2024
  7. brandtbucher
    added a commit that references this issue on Mar 26, 2025

    GH-119866: Don't clear frame->stackpointer on release builds (GH-131750)

    4b3d5b6
  8. diegorusso
    added a commit that references this issue on Apr 1, 2025

    pythonGH-119866: Don't clear frame->stackpointer on release builds (p…

    c797eca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — 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.