Skip to content

Commit 7e75686

Browse files
committed
specialize: make specialization thread-safe
1 parent 149ea9d commit 7e75686

File tree

15 files changed

+549
-223
lines changed

15 files changed

+549
-223
lines changed

Include/cpython/code.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ typedef union {
3030
static inline void
3131
_py_set_opcode(_Py_CODEUNIT *word, uint8_t opcode)
3232
{
33-
word->opcode = opcode;
33+
_Py_CODEUNIT new_word = *word;
34+
new_word.opcode = opcode;
35+
_Py_atomic_store_uint16(&word->cache, new_word.cache);
3436
}
3537

3638
#define _Py_SET_OPCODE(word, opcode) _py_set_opocde(&(word), opcode)

Include/internal/pycore_code.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct callable_cache {
9999
PyObject *len;
100100
PyObject *list_append;
101101
PyObject *object__getattribute__;
102+
PyObject *object__class__;
102103
};
103104

104105
/* "Locals plus" for a code object is the set of locals + cell vars +

Include/internal/pycore_opcode.h

Lines changed: 55 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)