Skip to content

Commit

Permalink
specialize: make specialization thread-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Apr 23, 2023
1 parent 149ea9d commit 7e75686
Show file tree
Hide file tree
Showing 15 changed files with 549 additions and 223 deletions.
4 changes: 3 additions & 1 deletion Include/cpython/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ typedef union {
static inline void
_py_set_opcode(_Py_CODEUNIT *word, uint8_t opcode)
{
word->opcode = opcode;
_Py_CODEUNIT new_word = *word;
new_word.opcode = opcode;
_Py_atomic_store_uint16(&word->cache, new_word.cache);
}

#define _Py_SET_OPCODE(word, opcode) _py_set_opocde(&(word), opcode)
Expand Down
1 change: 1 addition & 0 deletions Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ struct callable_cache {
PyObject *len;
PyObject *list_append;
PyObject *object__getattribute__;
PyObject *object__class__;
};

/* "Locals plus" for a code object is the set of locals + cell vars +
Expand Down
110 changes: 55 additions & 55 deletions Include/internal/pycore_opcode.h

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

Loading

0 comments on commit 7e75686

Please sign in to comment.