Skip to content

Conversation

@markshannon
Copy link
Member

@markshannonmarkshannon commented Jan 21, 2026

  • 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
Copy link
Member

@Fidget-SpinnerFidget-Spinner left a comment

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.

staticinlineint
uop_buffer_length(_PyJitUopBuffer*trace)
{
returntrace->next-trace->start;

Choose a reason for hiding this comment

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

Needs an (int) cast here.

staticinlineint
uop_buffer_remaining_space(_PyJitUopBuffer*trace)
{
returntrace->end-trace->next;

Choose a reason for hiding this comment

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

Same here

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@markshannon@Fidget-Spinner