Commit graph

2122 commits

Author SHA1 Message Date
Diego Russo
fc2f0fea6b
JIT: Move executor to a register (#143072) 2025-12-24 09:44:16 +00:00
Sam Gross
50ecd6b880
gh-143108: Don't instrument faulthandler.c for TSan (#143109)
The dumping of tracebacks has data races and that's okay (it's best
effort).
2025-12-24 02:12:55 +01:00
Hai Zhu
cc48bf0fde
gh-134584: Eliminate redundant refcounting from _BINARY_OP_SUBSCR_TUPLE_INT (GH-143094) 2025-12-23 21:47:12 +00:00
Diego Russo
450e836aef
JIT: don't leak shim memory when shutting down the interpreter (#142984) 2025-12-23 17:50:00 +00:00
Mark Shannon
20aeb3a463
GH-143026: Fix assertion error in executor management. (GH-143104) 2025-12-23 17:19:34 +00:00
Tomas R.
25c294b6ea
gh-134584: Eliminate redundant refcounting from _CALL_TYPE_1 (GH-135818) 2025-12-23 17:01:10 +00:00
Hai Zhu
5b5ee3c4bf
gh-134584: Eliminate redundant refcounting from _LOAD_ATTR_WITH_HINT (GH-143062)
Eliminate redundant refcounting from _LOAD_ATTR_WITH_HINT
2025-12-23 00:28:08 +00:00
Pablo Galindo Salgado
9e51301234
gh-138122: Allow tachyon to write and read binary output (#142730) 2025-12-22 23:57:20 +00:00
Chris Eibl
be3c131640
GH-139922: Tail calling for MSVC (VS 2026) (GH-143068)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandt@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-12-22 23:01:34 +00:00
Kumar Aditya
e728b006de
gh-143057: avoid locking in tracemalloc C-APIs when it is not enabled (#143065) 2025-12-22 21:08:07 +05:30
Sam Gross
2b4feee648
gh-122581: Use parser mutex in default build for subinterpreters (gh-142959) 2025-12-20 15:37:31 -05:00
Sam Gross
08bc03ff2a
gh-120321: Make gi_frame_state transitions atomic in FT build (gh-142599)
This makes generator frame state transitions atomic in the free
threading build, which avoids segfaults when trying to execute
a generator from multiple threads concurrently.

There are still a few operations that aren't thread-safe and may crash
if performed concurrently on the same generator/coroutine:

 * Accessing gi_yieldfrom/cr_await/ag_await
 * Accessing gi_frame/cr_frame/ag_frame
 * Async generator operations
2025-12-19 19:10:37 +00:00
Ken Jin
786f464c74
gh-142961: Fix constant folding len(tuple) in JIT (GH-142963) 2025-12-19 17:43:36 +00:00
Diego Russo
685272eb8a
JIT: Rename trampoline.c to shim.c (#142974) 2025-12-19 14:39:41 +00:00
Savannah Ostrowski
1391ee664c
GH-134584: Remove redundant refcount for BINARY_OP_SUBSCR_STR_INT (#142844) 2025-12-18 21:29:54 +00:00
LloydZ
33d94abafd
gh-134584: Eliminate redundant refcounting from _BINARY_OP_SUBSCR_LIST_INT (GH-142926) 2025-12-18 18:25:36 +00:00
Kumar Aditya
e22c49522b
gh-142890: remove unnecessary interp parameter from dict functions and _PyDict_NotifyEvent (#142923) 2025-12-18 22:48:56 +05:30
Mark Shannon
e4058d7cb1
GH-142513: Reimplement executor management (GH-142931)
* Invalidating an executor does not cause arbitrary code to run
* Executors are only freed at safe points
2025-12-18 16:43:44 +00:00
Donghee Na
14f0b5191a
gh-142419: Add mmap.set_name method for user custom annotation (gh-142480) 2025-12-18 23:33:49 +09:00
Donghee Na
71a7cb8887
gh-134584: Remove redundant refcount from _BINARY_OP_ADD_UNICODE (gh-142825) 2025-12-18 21:33:18 +09:00
Nadeshiko Manju
4345253981
gh-134584: Eliminate redundant refcounting from _STORE_ATTR_WITH_HINT (GH-142767)
Signed-off-by: Manjusaka <me@manjusaka.me>
2025-12-16 22:21:04 +00:00
Nadeshiko Manju
6ee51a36b3
gh-134584: Eliminate redundant refcounting from _LOAD_ATTR_INSTANCE_VALUE (GH-142769)
Signed-off-by: Manjusaka <me@manjusaka.me>
2025-12-16 20:39:20 +00:00
Savannah Ostrowski
bef63d2fb8
GH-134584: Remove redundant refcount from _STORE_ATTR_SLOT (#142729) 2025-12-15 15:18:44 -08:00
Ken Jin
790a46a449
gh-134584: JIT: Eliminate redundant refcount ops for X_INT (GH-142765) 2025-12-15 22:22:18 +00:00
Nadeshiko Manju
059316ade6
gh-134584: Eliminate redundant refcounting from _STORE_ATTR_INSTANCE_VALUE (GH-142759)
Signed-off-by: Manjusaka <me@manjusaka.me>
2025-12-15 20:17:12 +00:00
Ken Jin
0ac4e6c6cd
gh-134584: Remove custom float decref ops (GH-142576) 2025-12-15 19:38:58 +00:00
Mark Shannon
27a2e49d18
GH-142718: JIT: Fix crash due to incorrect caching on side exits when exiting jitted code. (GH-142762)
JIT: Fix crash due to incorrect caching on side exits when exiting jitted code.

* Make sure that stack is in correct state at side exits with TOS cached values
* Simplify choice of cached items for side exits
2025-12-15 19:01:29 +00:00
Sam Gross
a882ae198a
gh-142472: Clean-up _PyStackRef functions (gh-142479)
This combines most _PyStackRef functions and macros between the free
threaded and default builds.

- Remove Py_TAG_DEFERRED (same as Py_TAG_REFCNT)
- Remove PyStackRef_IsDeferred (same as !PyStackRef_RefcountOnObject)
2025-12-15 12:03:49 -05:00
Donghee Na
abaaeee6a0
gh-134584: Eliminate redundant refcounting from _STORE_SUBSCR_DICT (GH-142712)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2025-12-15 16:42:32 +00:00
Nadeshiko Manju
872ab51f32
gh-134584: Eliminate redundant refcounting from _CALL_LIST_APPEND (GH-142711)
Signed-off-by: Manjusaka <me@manjusaka.me>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2025-12-15 15:49:36 +00:00
Pablo Galindo Salgado
6658e2cb07
gh-138122: Add --subprocesses flag to profile child processes in tachyon (#142636) 2025-12-15 12:11:40 +00:00
Kumar Aditya
fb554ad68d
gh-140414: streamline thread state access in asyncio (#142742) 2025-12-15 16:57:51 +05:30
Donghee Na
04da416e6b
gh-134584: Eliminate redundant refcounting from _STORE_SUBSCR_LIST_INT (gh-142703) 2025-12-14 12:26:00 +00:00
PuQing
a2a400af1e
gh-134584: Eliminate redundant refcounting from _CALL_BUILTION_O (GH-142695)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2025-12-14 10:28:02 +00:00
Nadeshiko Manju
a154c9ed4e
gh-134584: Eliminate redundant refcounting from _CALL_STR_1 (GH-136070)
Signed-off-by: Manjusaka <me@manjusaka.me>
2025-12-14 09:33:05 +00:00
Ken Jin
e02a35c365
gh-134584: Cleanups for GH-135860 (GH-142604) 2025-12-13 14:38:10 +00:00
Neil Schemenauer
c98182be8d
gh-132657: Add lock-free set contains implementation (#132290)
This roughly follows what was done for dictobject to make a lock-free
lookup operation. With this change, the set contains operation scales much
better when used from multiple-threads. The frozenset contains performance
seems unchanged (as already lock-free).

Summary of changes:

* refactor set_lookkey() into set_do_lookup() which now takes a function
  pointer that does the entry comparison. This is similar to dictobject and
  do_lookup(). In an optimized build, the comparison function is inlined and
  there should be no performance cost to this.

* change set_do_lookup() to return a status separately from the entry value

* add set_compare_frozenset() and use if the object is a frozenset. For the
  free-threaded build, this avoids some overhead (locking, atomic operations,
  incref/decref on key)

* use FT_ATOMIC_* macros as needed for atomic loads and stores

* use a deferred free on the set table array, if shared (only on free-threaded
  build, normal build always does an immediate free)

* for free-threaded build, use explicit for loop to zero the table, rather than memcpy()

* when mutating the set, assign so->table to NULL while the change is a
  happening. Assign the real table array after the change is done.
2025-12-13 09:50:23 +00:00
Ken Jin
a3a611b042
gh-134584: Revert partially GH-135860 (GH-142620) 2025-12-12 14:04:11 +00:00
Sam Gross
0a62f8277e
gh-142534: Avoid TSan warnings in dictobject.c (gh-142544)
There are places we use "relaxed" loads where C11 requires "consume" or
stronger. Unfortunately, compilers don't really implement "consume" so
fake it for our use in a way that avoids upsetting TSan.
2025-12-11 16:23:19 -05:00
Pablo Galindo Salgado
6a0135a392
gh-138122: Add exception profiling mode to the sampling profiler (#142561) 2025-12-11 20:46:34 +00:00
Donghee Na
a27538540e
gh-134584: Eliminate redundant refcounting from `_CALL_LEN` (gh-136104) 2025-12-11 15:24:34 +00:00
Noam Cohen
a78f43b001
gh-134584: Eliminate redundant refcounting from _CALL_TUPLE_1 (GH-135860) 2025-12-11 14:31:28 +00:00
Mark Shannon
469f191a85
GH-135379: Top of stack caching for the JIT. (GH-135465)
Uses three registers to cache values at the top of the evaluation stack
This significantly reduces memory traffic for smaller, more common uops.
2025-12-11 10:32:52 +00:00
Dino Viehland
da8199f884
gh-123241: Don't modify ref count during visitation (GH-142232) 2025-12-11 09:54:29 +01:00
Pablo Galindo Salgado
5b19c75b47
gh-138122: Make the tachyon profiler opcode-aware (#142394) 2025-12-11 03:41:47 +00:00
Victor Stinner
b20722c300
gh-142447: Fix cast warning in pycore_backoff.h (#142465)
MAKE_VALUE_AND_BACKOFF() macro casts its result to uint16_t.

Add pycore_backoff.h header to test_cppext tests.
2025-12-09 17:03:13 +01:00
Victor Stinner
49207a5226
gh-140222: Increase stack margin on debug build (#142452)
Increase _PyOS_MIN_STACK_SIZE if Python is built in debug mode.
2025-12-09 16:25:46 +01:00
John Paul Adrian Glaubitz
02c085d48b
gh-142342: Fix m68k assembler operand constraints for %fpcr access (gh-142343)
On m68k, an fmove instruction accessing %fpcr may only move from
or to a data register or a memory operand. The constraint "g" also
permits the use of address registers, which is invalid. The correct
constraint is "dm". Beginning with GCC 15, the register allocator
picks an address register in the code which causes SIGILL during
runtime.

Co-authored-by: Michael Karcher <github@mkarcher.dialup.fu-berlin.de>
2025-12-09 13:46:40 +00:00
Sam Gross
f2fba4c99a
gh-124379: Document _PyStackRef (gh-142321) 2025-12-08 12:14:50 -05:00
Donghee Na
c4ccaf4b10
gh-141770: Annotate anonymous mmap usage if "-X dev" is used (gh-142079) 2025-12-08 14:47:19 +00:00