Commit Graph
332 Commits
Author SHA1 Message Date
65695ebffa [3.15] GH-151619: Ensure non-module global/builtin namespaces are watched for lazy imports (GH-151762) (#152533)
GH-151619: Ensure non-module global/builtin namespaces are watched for lazy imports (GH-151762)
(cherry picked from commit 7ed9062dd0)

Co-authored-by: Brandt Bucher <[email protected]>
2026-06-28 22:53:20 +00:00
eaf4d73112 [3.15] gh-148825: Fix build error if specialization is disabled (GH-148826) (#152206)
gh-148825: Fix build error if specialization is disabled (GH-148826)
(cherry picked from commit 56ae0b8e4f)

Co-authored-by: Marc Mueller <[email protected]>
2026-06-25 14:36:04 +00:00
Wulian233andGitHub 0b75b7338d gh-100239: specialize mixed int/float inplace binary ops (GH-149413) 2026-05-06 13:59:08 +01:00
Mark ShannonandGitHub 70bd1c2dd2 GH-143732: SEND specialization (GH-148963)
* SEND specialization. Adds 2 new specialized instructions:

* SEND_VIRTUAL: for sends to virtual iterators e.g lists and tuples
* SEND_ASYNC_GEN: for sends to async generators

Tweak FOR_ITER_VIRTUAL so that SEND_VIRTUAL and FOR_ITER_VIRTUAL use equivalent guards
2026-05-05 15:19:16 +01:00
Kumar AdityaandGitHub 5847931d11 gh-143732: allow dict subclasses to be specialized (GH-148128) 2026-05-04 09:39:03 +01:00
Dino ViehlandandGitHub c0af5c024b gh-146031: Allow keeping specialization enabled when specifying eval frame function (#146032)
Allow keeping specialization enabled when specifying eval frame function
2026-04-16 09:44:26 -07:00
Mark ShannonandGitHub 600f4dbd54 GH-145668: Add FOR_ITER specialization for virtual iterators. Specialize GET_ITER. (GH-147967)
* Add FOR_ITER_VIRTUAL to specialize FOR_ITER for virtual iterators
* Add GET_ITER_SELF to specialize GET_ITER for iterators (including generators)
* Add GET_ITER_VIRTUAL to specialize GET_ITER for iterables as virtual iterators
* Add new (internal) _tp_iteritem function slot to PyTypeObject
* Put limited RESUME at start of genexpr for free-threading. Fix up exception handling in genexpr
2026-04-16 15:22:22 +01:00
Pieter EendebakandGitHub 1f6a09fb36 gh-100239: Specialize more binary operations using BINARY_OP_EXTEND (GH-128956) 2026-04-16 09:22:41 +01:00
Neko AsakuraandGitHub 52a7f1b7f8 gh-148510: restore func_version check in _LOAD_ATTR_PROPERTY_FRAME (GH-148528) 2026-04-14 22:44:39 +08:00
e371ce10cd gh-95004: specialize access to enums and fix scaling on free-threading (#148184)
Co-authored-by: Ken Jin <[email protected]>
2026-04-07 21:43:50 +05:30
Pieter EendebakandGitHub efda60e2ec gh-100239: Propagate type info through _BINARY_OP_EXTEND in tier 2 (GH-148146) 2026-04-06 20:52:42 +08:00
Mark ShannonandGitHub 879c85f6e4 GH-145667: Merge GET_ITER and GET_YIELD_FROM_ITER (GH-146120)
* Merge GET_ITER and GET_YIELD_FROM_ITER. Modify SEND to make it a bit more like FOR_ITER
2026-03-21 10:48:13 +00:00
Ken JinandGitHub 3d0824aef2 gh-127958: Trace from RESUME in the JIT (GH-145905) 2026-03-17 00:18:59 +08:00
Chris EiblandGitHub b5c8e6e133 gh-100239: Use `PyFloat_AS_DOUBLE and _PyLong_IsZero`` in the float / compactlong specializations (#144826) 2026-02-19 21:45:59 +02:00
Donghee NaandGitHub 3e2f5c133f gh-141510: Update specializer to support frozendict (gh-144949) 2026-02-19 01:10:53 +09:00
Pablo Galindo SalgadoandGitHub 072cd7c336 gh-142349: Fix refcount corruption in lazy import specialization (#144733)
Remove spurious Py_DECREF on borrowed ref in LOAD_GLOBAL specialization

_PyDict_LookupIndexAndValue() returns a borrowed reference via
_Py_dict_lookup(), but specialize_load_global_lock_held() called
Py_DECREF(value) on it when bailing out for lazy imports. Each time
the adaptive counter fired while a lazy import was still in globals,
this stole one reference from the dict's object. With 8+ threads
racing through LOAD_GLOBAL during concurrent lazy import resolution,
enough triggers accumulated to drive the refcount to zero while the
dict and other threads still referenced the object, causing
use-after-free.
2026-02-12 11:45:28 +00:00
46d5106cfa gh-142349: Implement PEP 810 - Explicit lazy imports (#142351)
Co-authored-by: T. Wouters <[email protected] >
Co-authored-by: Brittany Reynoso <[email protected]>
Co-authored-by: Dino Viehland <[email protected]>
2026-02-12 00:15:33 +00:00
Sam GrossandGitHub 6ea3f8cd7f gh-144289: Remove ENABLE_SPECIALIZATION_FT (gh-144290)
Now that the specializing interpreter works with free threading,
replace ENABLE_SPECIALIZATION_FT with ENABLE_SPECIALIZATION and
replace requires_specialization_ft with requires_specialization.

Also limit the uniquely referenced check to FOR_ITER_RANGE. It's not
necessary for FOR_ITER_GEN and would cause test_for_iter_gen to fail.
2026-01-27 17:52:50 -05:00
Neil SchemenauerandGitHub 48b6866047 gh-144054: no deferred refcount for untracked (gh-144081)
This reverts gh-144055 and fixes the bug in a different way.  Deferred
reference counting relies on the object being tracked by the GC,
otherwise the object will live until interpreter shutdown.  So, take
care that we do not enable deferred reference counting for objects that
are untracked.  Also, if a tuple has deferred reference counting
enabled, don't untrack it.
2026-01-20 10:01:09 -08:00
Neil SchemenauerandGitHub bb25f7280a gh-132657: Add maybe_enable_deferred_ref_count() (gh-142843)
If we are specializing to `LOAD_GLOBAL_MODULE` or `LOAD_ATTR_MODULE`, try
to enable deferred reference counting for the value, if the object is owned by
a different thread.  This applies to the free-threaded build only and should
improve scaling of multi-threaded programs.
2026-01-17 01:54:43 +00:00
Donghee NaandGitHub 794f758cd8 gh-141504: Refactor policy object into a single opt_config (gh-143644) 2026-01-15 09:53:00 +09:00
Sam GrossandGitHub 8cf5c4d89a gh-142908: Don't use DK_IS_UNICODE in interpreter (gh-142909)
`DK_IS_UNICODE()` includes split keys and we don't want to specialize on
those accesses..
2026-01-08 09:32:20 -05:00
Ken JinandGitHub df355348f0 gh-142982: Specialize CALL_FUNCTION_EX (GH-143391) 2026-01-06 20:34:08 +00:00
Kumar AdityaandGitHub faa3dc7c64 gh-143469: enable LOAD_ATTR_MODULE specialization even if __getattr__ is defined (#143470) 2026-01-06 22:09:18 +05:30
Serhiy StorchakaandGitHub 4d21297d28 gh-41779: Allow defining any __slots__ for a class derived from tuple (GH-141763) 2026-01-06 11:36:00 +02:00
Chris EiblandGitHub e6bfe4d886 gh-139757: Add BINARY_OP_SUBSCR_USTR_INT (GH-143389) 2026-01-04 14:14:27 +00:00
Donghee NaandGitHub 12283f6373 gh-141504: Factor out tracing and optimization heuristics into a single object (gh-143381) 2026-01-03 15:22:14 +00:00
Donghee NaandGitHub 61f2ad9a3a gh-139757: Fix unintended bytecode specialization for non-ascii string (gh-143352) 2026-01-02 14:05:08 +00:00
Ken JinandGitHub cf6758ff9e gh-143092: Make CALL_LIST_APPEND and BINARY_OP_INPLACE_ADD_UNICODE normal instructions (GH-143124)
These super instructions need many special cases in the interpreter, specializer, and JIT. It's best we convert them to normal instructions.
2025-12-24 22:03:00 +00:00
1281be1caf gh-141367: Use CALL_LIST_APPEND instruction only for lists, not for list subclasses (GH-141398)
Co-authored-by: Ken Jin <[email protected]>
2025-11-14 21:38:39 +00:00
Neil SchemenauerandGitHub c98c5b3449 gh-131253: free-threaded build support for pystats (gh-137189)
Allow the --enable-pystats build option to be used with free-threading.  The
stats are now stored on a per-interpreter basis, rather than process global.
For free-threaded builds, the stats structure is allocated per-thread and
then periodically merged into the per-interpreter stats structure (on thread
exit or when the reporting function is called). Most of the pystats related
code has be moved into the file Python/pystats.c.
2025-11-03 11:36:37 -08:00
Dino ViehlandandGitHub ff0cf0af10 gh-139525: Don't specialize functions which have a modified vectorcall (#139524)
Don't specialize functions which have a modified vectorcall
2025-10-03 09:58:32 -07:00
TapelineandGitHub ea77feecbb gh-138302: Specialize int ops only if ints are compact (GH-138347) 2025-09-02 01:33:15 +08:00
Sam GrossandGitHub 485b16b4f7 gh-137238: Fix data race in _Py_slot_tp_getattr_hook (gh-137240)
Replacing the slot isn't thread-safe if the GIL is disabled. Don't
require that the slot has been replaced when specializing.
2025-08-05 09:32:22 -04:00
PuQingandGitHub a9e66a7c50 gh-132815: Add support for JUMP_BACKWARD in specialization stats (#135606) 2025-06-17 14:11:09 +02:00
Mark ShannonandGitHub f6f4e8a662 GH-132554: "Virtual" iterators (GH-132555)
* FOR_ITER now pushes either the iterator and NULL or leaves the iterable and pushes tagged zero

* NEXT_ITER uses the tagged int as the index into the sequence or, if TOS is NULL, iterates as before.
2025-05-27 15:59:45 +01:00
Tomas R.andGitHub c492ac7252 GH-131798: Split up and optimize CALL_ISINSTANCE (GH-133339) 2025-05-08 14:26:30 -07:00
Irit KatrielandGitHub 296cd128bf Revert "gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396)" (#133498) 2025-05-06 13:12:26 +03:00
Diego RussoandGitHub 9cc77aaf9d GH-131798: Split CALL_LEN into several uops (GH-133180) 2025-05-05 14:31:48 -07:00
Irit KatrielandGitHub 082dbf7788 gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396) 2025-05-05 17:46:56 +01:00
Irit KatrielandGitHub 5529213d4e gh-100239: specialize BINARY_OP/SUBSCR for list-slice (#132626) 2025-05-01 10:28:52 +00:00
Mark ShannonandGitHub 3831752689 PyStats: Make sure that the failure_kinds array is big enough. (#133245) 2025-05-01 10:02:51 +00:00
Mark ShannonandGitHub 622300bdfa GH-132554: Add stats for GET_ITER (GH-132592)
* Add stats for GET_ITER

* Look for common iterable types, not iterator types

* Add stats for self iter and fix naming in summary
2025-04-29 09:00:14 +01:00
Kumar AdityaandGitHub f3d877a27a gh-132643: use atomic load for dict in specializer (#132653) 2025-04-18 15:06:27 +05:30
mpageandGitHub 619edb802e gh-132336: Mark a few "slow path" functions used by the interpreter loop as noinline (#132337)
Mark a few functions used by the interpreter loop as noinline

These are all the slow path and should not be inlined into the interpreter
loop. Unfortunately, they end up being inlined with LTO and the current PGO
task.
2025-04-10 10:41:15 +02:00
Irit KatrielandGitHub 8c9ef8f1f8 gh-100239: more stats for BINARY_OP/SUBSCR specialization (#132230) 2025-04-08 08:50:51 +00:00
Irit KatrielandGitHub 68e72cf3a8 gh-100239: fix bug in comparison (#132093) 2025-04-04 18:09:49 +01:00
Irit KatrielandGitHub df59226997 gh-100239: more refined specialisation stats for BINARY_OP/SUBSCR (#132068) 2025-04-04 15:33:31 +01:00
Dino ViehlandandGitHub 2984ff9e51 gh-130373: Avoid locking in _LOAD_ATTR_WITH_HINT (#130372)
Avoid locking in _LOAD_ATTR_WITH_HINT
2025-03-28 15:16:41 -07:00
Victor StinnerandGitHub 5c44d7d99c gh-130931: Add pycore_interpframe.h internal header (#131249)
Move _PyInterpreterFrame and associated functions
to a new pycore_interpframe.h header.
2025-03-19 18:17:44 +01:00