Skip to content

GH-139109: Partial reworking of JIT data structures - #144105

Merged
markshannon merged 2 commits into
python:mainfrom
markshannon:refactor-tracing-structs
Jan 22, 2026
Merged

markshannon merged 2 commits into
python:mainfrom
markshannon:refactor-tracing-structs

Conversation

@markshannon

@markshannon markshannon commented Jan 21, 2026 •

Copy link
Copy Markdown
Member
  • Halve size of buffers by reusing combined trace + optimizer buffers for TOS caching
  • Add simple buffer struct for more maintainable handling of buffers
  • Decouple JIT structs from threadstate struct
  • Ensure terminator is correctly added to trace, when optimizer gives up.

This is the first PR of a series to reducing coupling, particularly hidden coupling, in the tracer.
This is a bit of a mixed assortment of small changes to prepare for more significant changes later.
It also fixes a bug that was exposed by the refactoring.

* Halve size of buffers by reusing combined trace + optimizer buffers for TOS caching
* Add simple buffer struct for more maintainable handling of buffers
* Decouple JIT structs from thread state struct
* Ensure terminator is added to trace, when optimizer gives up

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just 2 nits, please address them and merge.

Comment thread Include/internal/pycore_optimizer.h Resolved
Comment thread Include/internal/pycore_optimizer.h Resolved
@markshannon
markshannon merged commit d77aaa7 into python:main Jan 22, 2026
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
…44105)

* Halve size of buffers by reusing combined trace + optimizer buffers for TOS caching
* Add simple buffer struct for more maintainable handling of buffers
* Decouple JIT structs from thread state struct
* Ensure terminator is added to trace, when optimizer gives up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants