Skip to content

Commit c11c043

Browse files
Merge branch 'main' of https://github.com/python/cpython into jit-load-special
2 parents 9da1b9d + e0b56f0 commit c11c043

File tree

125 files changed

+4679
-2221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+4679
-2221
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ jobs:
354354
with:
355355
persist-credentials: false
356356
- name: Build and test
357-
run: ./Android/android.py ci --fast-ci ${{ matrix.arch }}-linux-android
357+
run: python3 Platforms/Android ci --fast-ci ${{ matrix.arch }}-linux-android
358358

359359
build-ios:
360360
name: iOS

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.cover
66
*.iml
77
*.o
8+
*.o.tmp
89
*.lto
910
*.a
1011
*.so

Doc/library/argparse.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1970,7 +1970,7 @@ FileType objects
19701970
run and then use the :keyword:`with`-statement to manage the files.
19711971

19721972
.. versionchanged:: 3.4
1973-
Added the *encodings* and *errors* parameters.
1973+
Added the *encoding* and *errors* parameters.
19741974

19751975
.. deprecated:: 3.14
19761976

Doc/whatsnew/3.15.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,11 @@ pprint
15511551
:func:`pprint.pformat`, :func:`pprint.pp`. If true, the output will be
15521552
formatted similar to pretty-printed :func:`json.dumps` when
15531553
*indent* is supplied.
1554-
(Contributed by Stefan Todoran and Semyon Moroz in :gh:`112632`.)
1554+
(Contributed by Stefan Todoran, Semyon Moroz and Hugo van Kemenade in
1555+
:gh:`112632`.)
1556+
1557+
* Add t-string support to :mod:`pprint`.
1558+
(Contributed by Loïc Simon and Hugo van Kemenade in :gh:`134551`.)
15551559

15561560

15571561
sre_*

Include/internal/pycore_dict.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ _PyDict_NotifyEvent(PyDict_WatchEvent event,
292292
PyObject *value)
293293
{
294294
assert(Py_REFCNT((PyObject*)mp) > 0);
295-
int watcher_bits = mp->_ma_watcher_tag & DICT_WATCHER_MASK;
295+
int watcher_bits = FT_ATOMIC_LOAD_UINT64_ACQUIRE(mp->_ma_watcher_tag) & DICT_WATCHER_MASK;
296296
if (watcher_bits) {
297297
RARE_EVENT_STAT_INC(watched_dict_modification);
298298
_PyDict_SendEvent(watcher_bits, event, mp, key, value);
@@ -368,7 +368,7 @@ PyDictObject *_PyObject_MaterializeManagedDict_LockHeld(PyObject *);
368368
static inline Py_ssize_t
369369
_PyDict_UniqueId(PyDictObject *mp)
370370
{
371-
return (Py_ssize_t)(mp->_ma_watcher_tag >> DICT_UNIQUE_ID_SHIFT);
371+
return (Py_ssize_t)(FT_ATOMIC_LOAD_UINT64_RELAXED(mp->_ma_watcher_tag) >> DICT_UNIQUE_ID_SHIFT);
372372
}
373373

374374
static inline void

Include/internal/pycore_opcode_metadata.h

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

Include/internal/pycore_optimizer.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ typedef struct _PyJitTracerInitialState {
9191
_Py_CODEUNIT *jump_backward_instr;
9292
} _PyJitTracerInitialState;
9393

94+
#define MAX_RECORDED_VALUES 3
9495
typedef struct _PyJitTracerPreviousState {
9596
int instr_oparg;
9697
int instr_stacklevel;
9798
_Py_CODEUNIT *instr;
9899
PyCodeObject *instr_code; // Strong
99100
struct _PyInterpreterFrame *instr_frame;
100-
PyObject *recorded_value; // Strong, may be NULL
101+
PyObject *recorded_values[MAX_RECORDED_VALUES]; // Strong, may be NULL
102+
int recorded_count;
101103
} _PyJitTracerPreviousState;
102104

103105
typedef struct _PyJitTracerTranslatorState {
@@ -400,6 +402,7 @@ extern JitOptRef _Py_uop_sym_new_null(JitOptContext *ctx);
400402
extern bool _Py_uop_sym_has_type(JitOptRef sym);
401403
extern bool _Py_uop_sym_matches_type(JitOptRef sym, PyTypeObject *typ);
402404
extern bool _Py_uop_sym_matches_type_version(JitOptRef sym, unsigned int version);
405+
extern unsigned int _Py_uop_sym_get_type_version(JitOptRef sym);
403406
extern void _Py_uop_sym_set_null(JitOptContext *ctx, JitOptRef sym);
404407
extern void _Py_uop_sym_set_non_null(JitOptContext *ctx, JitOptRef sym);
405408
extern void _Py_uop_sym_set_type(JitOptContext *ctx, JitOptRef sym, PyTypeObject *typ);
@@ -424,8 +427,6 @@ extern PyCodeObject *_Py_uop_sym_get_probable_func_code(JitOptRef sym);
424427
extern PyObject *_Py_uop_sym_get_probable_value(JitOptRef sym);
425428
extern PyTypeObject *_Py_uop_sym_get_probable_type(JitOptRef sym);
426429
extern JitOptRef *_Py_uop_sym_set_stack_depth(JitOptContext *ctx, int stack_depth, JitOptRef *current_sp);
427-
extern uint32_t _Py_uop_sym_get_func_version(JitOptRef ref);
428-
bool _Py_uop_sym_set_func_version(JitOptContext *ctx, JitOptRef ref, uint32_t version);
429430

430431
extern void _Py_uop_abstractcontext_init(JitOptContext *ctx, _PyBloomFilter *dependencies);
431432
extern void _Py_uop_abstractcontext_fini(JitOptContext *ctx);
@@ -483,7 +484,12 @@ void _PyJit_TracerFree(_PyThreadStateImpl *_tstate);
483484
#ifdef _Py_TIER2
484485
typedef void (*_Py_RecordFuncPtr)(_PyInterpreterFrame *frame, _PyStackRef *stackpointer, int oparg, PyObject **recorded_value);
485486
PyAPI_DATA(const _Py_RecordFuncPtr) _PyOpcode_RecordFunctions[];
486-
PyAPI_DATA(const uint8_t) _PyOpcode_RecordFunctionIndices[256];
487+
488+
typedef struct {
489+
uint8_t count;
490+
uint8_t indices[MAX_RECORDED_VALUES];
491+
} _PyOpcodeRecordEntry;
492+
PyAPI_DATA(const _PyOpcodeRecordEntry) _PyOpcode_RecordEntries[256];
487493
#endif
488494

489495
#ifdef __cplusplus

Include/internal/pycore_optimizer_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ typedef enum _JitSymType {
3636
JIT_SYM_NON_NULL_TAG = 3,
3737
JIT_SYM_BOTTOM_TAG = 4,
3838
JIT_SYM_TYPE_VERSION_TAG = 5,
39-
JIT_SYM_FUNC_VERSION_TAG = 6,
4039
JIT_SYM_KNOWN_CLASS_TAG = 7,
4140
JIT_SYM_KNOWN_VALUE_TAG = 8,
4241
JIT_SYM_TUPLE_TAG = 9,

Include/internal/pycore_pyatomic_ft_wrappers.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ extern "C" {
4949
_Py_atomic_load_uint16_relaxed(&value)
5050
#define FT_ATOMIC_LOAD_UINT32_RELAXED(value) \
5151
_Py_atomic_load_uint32_relaxed(&value)
52+
#define FT_ATOMIC_LOAD_UINT64_ACQUIRE(value) \
53+
_Py_atomic_load_uint64_acquire(&value)
54+
#define FT_ATOMIC_LOAD_UINT64_RELAXED(value) \
55+
_Py_atomic_load_uint64_relaxed(&value)
5256
#define FT_ATOMIC_LOAD_ULONG_RELAXED(value) \
5357
_Py_atomic_load_ulong_relaxed(&value)
5458
#define FT_ATOMIC_STORE_PTR_RELAXED(value, new_value) \
@@ -71,6 +75,12 @@ extern "C" {
7175
_Py_atomic_store_uint16_relaxed(&value, new_value)
7276
#define FT_ATOMIC_STORE_UINT32_RELAXED(value, new_value) \
7377
_Py_atomic_store_uint32_relaxed(&value, new_value)
78+
#define FT_ATOMIC_AND_UINT64(value, new_value) \
79+
(void)_Py_atomic_and_uint64(&value, new_value)
80+
#define FT_ATOMIC_OR_UINT64(value, new_value) \
81+
(void)_Py_atomic_or_uint64(&value, new_value)
82+
#define FT_ATOMIC_ADD_UINT64(value, new_value) \
83+
(void)_Py_atomic_add_uint64(&value, new_value)
7484
#define FT_ATOMIC_STORE_CHAR_RELAXED(value, new_value) \
7585
_Py_atomic_store_char_relaxed(&value, new_value)
7686
#define FT_ATOMIC_LOAD_CHAR_RELAXED(value) \
@@ -146,6 +156,8 @@ extern "C" {
146156
#define FT_ATOMIC_LOAD_UINT8_RELAXED(value) value
147157
#define FT_ATOMIC_LOAD_UINT16_RELAXED(value) value
148158
#define FT_ATOMIC_LOAD_UINT32_RELAXED(value) value
159+
#define FT_ATOMIC_LOAD_UINT64_ACQUIRE(value) value
160+
#define FT_ATOMIC_LOAD_UINT64_RELAXED(value) value
149161
#define FT_ATOMIC_LOAD_ULONG_RELAXED(value) value
150162
#define FT_ATOMIC_STORE_PTR_RELAXED(value, new_value) value = new_value
151163
#define FT_ATOMIC_STORE_PTR_RELEASE(value, new_value) value = new_value
@@ -157,6 +169,9 @@ extern "C" {
157169
#define FT_ATOMIC_STORE_UINT8_RELAXED(value, new_value) value = new_value
158170
#define FT_ATOMIC_STORE_UINT16_RELAXED(value, new_value) value = new_value
159171
#define FT_ATOMIC_STORE_UINT32_RELAXED(value, new_value) value = new_value
172+
#define FT_ATOMIC_AND_UINT64(value, new_value) (void)(value &= new_value)
173+
#define FT_ATOMIC_OR_UINT64(value, new_value) (void)(value |= new_value)
174+
#define FT_ATOMIC_ADD_UINT64(value, new_value) (void)(value += new_value)
160175
#define FT_ATOMIC_LOAD_CHAR_RELAXED(value) value
161176
#define FT_ATOMIC_STORE_CHAR_RELAXED(value, new_value) value = new_value
162177
#define FT_ATOMIC_LOAD_UCHAR_RELAXED(value) value

0 commit comments

Comments
 (0)