◐ Shell
clean mode source ↗

gh-106529: Implement POP_JUMP_IF_XXX uops by gvanrossum · Pull Request #106551 · python/cpython

This adds:

- Hand-written uops JUMP_IF_{TRUE,FALSE,NONE,NOT_NONE}.
  These peek at the top of the stack.
  The jump target (in superblock space) is absolute.

- Hand-written translation for POP_JUMP_IF_TRUE,
  assuming the jump is unlikely.
  This can serve as an example for the rest.
  (Probably adding the others will cause a little refactoring.)
  Once we implement jump-likelihood profiling,
  we can implement the jump-unlikely case.

Note that the stubs are placed at the end of the trace array.
There is a gap between the main superblock and the stubs.
We could close the gap, we'd just have to patch up the JUMP uops.

@bedevere-bot mentioned this pull request

Jul 8, 2023

11 tasks

Also include them in the returned trace length.
This required improving len(ex) and ex[i] a bit.
There is now a sentinel opcode (0) at the end,
*unless* the trace array is full.

gvanrossum added a commit that referenced this pull request

Jul 11, 2023
(gh-106551 caused a compiler warning about on Windows.)