◐ Shell
clean mode source ↗

gh-143158: Hot cold code splitting for JIT compiler by waterlens · Pull Request #149292 · python/cpython

Issue: gh-143158

This PR implements trace-level hot/cold code splitting for the JIT.

Previously, each uop stencil was emitted as one contiguous code block, so hot fast-path code and rarely executed cold/error-path code were interleaved
throughout the compiled trace:

[uop0 hot+cold][uop1 hot+cold][uop2 hot+cold]...

This change separates each stencil into hot and cold code and emits the trace as:

[uop0 hot][uop1 hot][uop2 hot]...[uop0 cold][uop1 cold][uop2 cold]...

Plan:

  • Move cold code after _JIT_CONTINUE and introduce _JIT_COLD_START for positioning.
  • Split cold / hot code when emitting stencils