Skip to content

Move the bodies of large instructions into helper functions. #122598

@markshannon

Description

@markshannon

There are two reasons for this:

  1. Big chunks of code slow down the JIT and the resulting machine code.
  2. These big chunks of code usually have complex control flow which makes analysis of the code for stack spilling and top-of-stack much harder.

Using tokens are (a quite approximate) guide to complexity, here are the uops with over 200 tokens:

_CALL_BUILTIN_FAST_WITH_KEYWORDS 200
_BINARY_SUBSCR_GETITEM 203
_LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 210
_CALL_METHOD_DESCRIPTOR_NOARGS 212
_CALL_METHOD_DESCRIPTOR_O 214
_LOAD_FROM_DICT_OR_GLOBALS 215
_YIELD_VALUE 219
_LOAD_SUPER_ATTR 241
_CALL_METHOD_DESCRIPTOR_FAST 247
_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 258
_DYNAMIC_EXIT 269
_STORE_ATTR_WITH_HINT 273
_SEND 274
_EXIT_TRACE 335
_CALL_ALLOC_AND_ENTER_INIT 358
_DO_CALL 365
_CALL_FUNCTION_EX 469
_CALL_KW 498

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions