Skip to content

Commit

Permalink
Refactor LOAD_GLOBAL specializations to avoid reloading {globals, b…
Browse files Browse the repository at this point in the history
…uiltins} keys

Each of the `LOAD_GLOBAL` specializations is implemented roughly as:

1. Load keys version.
2. Load cached keys version.
3. Deopt if (1) and (2) don't match.
4. Load keys.
5. Load cached index into keys.
6. Load object from (4) at offset from (5).

This is not thread-safe in free-threaded builds; the keys object may be replaced
in between steps (3) and (4).

This change refactors the specializations to avoid reloading the keys object and
instead pass the keys object from guards to be consumed by downstream uops.
  • Loading branch information
mpage committed Oct 3, 2024
1 parent c8db0e8 commit 0a98bc0
Show file tree
Hide file tree
Showing 8 changed files with 354 additions and 159 deletions.
4 changes: 2 additions & 2 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

209 changes: 106 additions & 103 deletions Include/internal/pycore_uop_ids.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 20 additions & 8 deletions Include/internal/pycore_uop_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0a98bc0

Please sign in to comment.