summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-116098: Revert "gh-107674: Improve performance of `sys.settrace` ↵Tian Gao2024-03-016-63/+53
| | | | | | | (GH-114986)" (GH-116178) Revert "gh-107674: Improve performance of `sys.settrace` (GH-114986)" This reverts commit 0a61e237009bf6b833e13ac635299ee063377699.
* gh-115999: Disable the specializing adaptive interpreter in free-threaded ↵Brett Simmers2024-03-012-0/+63
| | | | | builds (#116013) For now, disable all specialization when the GIL might be disabled.
* gh-115685: Type/values propagate for TO_BOOL in tier 2 (GH-115686)Ken Jin2024-02-294-10/+140
|
* gh-116088: Insert bottom checks after all sym_set_...() calls (#116089)Guido van Rossum2024-02-294-32/+85
| | | | | | | | | This changes the `sym_set_...()` functions to return a `bool` which is `false` when the symbol is `bottom` after the operation. All calls to such functions now check this result and go to `hit_bottom`, a special error label that prints a different message and then reports that it wasn't able to optimize the trace. No executor will be produced in this case.
* GH-115802: JIT "small" code for Windows (GH-115964)Brandt Bucher2024-02-296-30/+33
|
* gh-115816: Generate calls to sym_new_const() etc. without _Py_uop prefix ↵Guido van Rossum2024-02-291-98/+98
| | | | | | | | | (#116077) This was left behind by GH-115987. Basically a lot of diffs like this: ``` - res = _Py_uop_sym_new_unknown(ctx); + res = sym_new_unknown(ctx); ```
* gh-115859: Re-enable T2 optimizer pass by default (#116062)Guido van Rossum2024-02-285-27/+74
| | | | | | | | | | | | | This undoes the *temporary* default disabling of the T2 optimizer pass in gh-115860. - Add a new test that reproduces Brandt's example from gh-115859; it indeed crashes before gh-116028 with PYTHONUOPSOPTIMIZE=1 - Re-enable the optimizer pass in T2, stop checking PYTHONUOPSOPTIMIZE - Rename the env var to disable T2 entirely to PYTHON_UOPS_OPTIMIZE (must be explicitly set to 0 to disable) - Fix skipIf conditions on tests in test_opt.py accordingly - Export sym_is_bottom() (for debugging) - Fix various things in the `_BINARY_OP_` specializations in the abstract interpreter: - DECREF(temp) - out-of-space check after sym_new_const() - add sym_matches_type() checks, so even if we somehow reach a binary op with symbolic constants of the wrong type on the stack we won't trigger the type assert
* gh-112529: Simplify PyObject_GC_IsTracked and PyObject_GC_IsFinalized (#114732)Sam Gross2024-02-281-8/+2
|
* gh-115816: Improve internal symbols API in optimizer (#116028)Guido van Rossum2024-02-283-62/+184
| | | | | | | - Any `sym_set_...` call that attempts to set conflicting information cause the symbol to become `bottom` (contradiction). - All `sym_is...` and similar calls return false or NULL for `bottom`. - Everything's tested. - The tests still pass with `PYTHONUOPSOPTIMIZE=1`.
* gh-107674: Improve performance of `sys.settrace` (GH-114986)Tian Gao2024-02-286-53/+63
|
* gh-116012: Preserve GetLastError() across calls to TlsGetValue on Windows ↵Steve Dower2024-02-282-10/+6
| | | | (GH-116014)
* gh-105858: Improve AST node constructors (#105880)Jelle Zijlstra2024-02-281-7/+4326
| | | | | | | | | | | | | | | | | Demonstration: >>> ast.FunctionDef.__annotations__ {'name': <class 'str'>, 'args': <class 'ast.arguments'>, 'body': list[ast.stmt], 'decorator_list': list[ast.expr], 'returns': ast.expr | None, 'type_comment': str | None, 'type_params': list[ast.type_param]} >>> ast.FunctionDef() <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'name'. This will become an error in Python 3.15. <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'args'. This will become an error in Python 3.15. <ast.FunctionDef object at 0x101959460> >>> node = ast.FunctionDef(name="foo", args=ast.arguments()) >>> node.decorator_list [] >>> ast.FunctionDef(whatever="you want", name="x", args=ast.arguments()) <stdin>:1: DeprecationWarning: FunctionDef.__init__ got an unexpected keyword argument 'whatever'. Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15. <ast.FunctionDef object at 0x1019581f0>
* GH-115816: Assorted naming and formatting changes to improve ↵Mark Shannon2024-02-274-428/+453
| | | | | | | maintainability. (GH-115987) * Rename _Py_UOpsAbstractInterpContext to _Py_UOpsContext and _Py_UOpsSymType to _Py_UopsSymbol. * #define shortened form of _Py_uop_... names for improved readability.
* GH-115816: Make tier2 optimizer symbols testable, and add a few tests. ↵Mark Shannon2024-02-274-599/+612
| | | | (GH-115953)
* gh-115168: Add pystats counter for invalidated executors (GH-115169)Michael Droettboom2024-02-267-10/+17
|
* Rename tier 2 redundancy eliminator to optimizer (#115888)Guido van Rossum2024-02-263-6/+6
| | | | The original name is just too much of a mouthful.
* GH-115802: JIT "small" code for macOS and Linux (GH-115826)Brandt Bucher2024-02-261-16/+103
|
* gh-115914: minor cleanup: simplify filename_obj assignment in ↵Sergii K2024-02-251-4/+1
| | | | | PyRun_AnyFileExFlags (gh-115916) This simplifies the code: less lines, easier to read. Logically equivalent, as any compiler likely already determined.
* gh-115859: Disable the tier 2 redundancy eliminator by default (GH-115860)Ken Jin2024-02-231-3/+6
|
* gh-115778: Add `tierN` annotation for instruction definitions (#115815)Kirill Podoprigora2024-02-234-137/+35
| | | | | This replaces the old `TIER_{ONE,TWO}_ONLY` macros. Note that `specialized` implies `tier1`. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-114058: Improve method information in redundancy eliminator (GH-115848)Ken Jin2024-02-232-6/+14
|
* gh-111789: Use PyDict_GetItemRef() in Python/compile.c (GH-112083)Serhiy Storchaka2024-02-231-5/+4
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-90300: Reformat the Python CLI help output (GH-93415)Serhiy Storchaka2024-02-231-108/+106
|
* gh-114058: More robust method handling in redundancy eliminator (GH-115779)Ken Jin2024-02-233-16/+41
|
* gh-115727: Reduce confidence even on 100% predicted jumps (#115748)Guido van Rossum2024-02-221-7/+13
| | | | | | | | The theory is that even if we saw a jump go in the same direction the last 16 times we got there, we shouldn't be overly confident that it's still going to go the same way in the future. This PR makes it so that in the extreme cases, the confidence is multiplied by 0.9 instead of remaining unchanged. For unpredictable jumps, there is no difference (still 0.5). For somewhat predictable jumps, we interpolate.
* GH-115651: Convert `LOAD_MODULE_ATTR` into `LOAD_INLINE_CONST` when the ↵Mark Shannon2024-02-226-95/+182
| | | | module is itself a constant. (GH-115711)
* gh-115796: fix exception table construction in ↵Irit Katriel2024-02-221-6/+11
| | | | _testinternalcapi.assemble_code_object (#115797)
* gh-110850: Cleanup PyTime API: PyTime_t are nanoseconds (#115753)Victor Stinner2024-02-214-59/+26
| | | | | | | | | | PyTime_t no longer uses an arbitrary unit, it's always a number of nanoseconds (64-bit signed integer). * Rename _PyTime_FromNanosecondsObject() to _PyTime_FromLong(). * Rename _PyTime_AsNanosecondsObject() to _PyTime_AsLong(). * Remove pytime_from_nanoseconds(). * Remove pytime_as_nanoseconds(). * Remove _PyTime_FromNanoseconds().
* gh-110850: Replace private _PyTime_MAX with public PyTime_MAX (#115751)Victor Stinner2024-02-211-2/+2
| | | | | | | Remove references to the old names _PyTime_MIN and _PyTime_MAX, now that PyTime_MIN and PyTime_MAX are public. Replace also _PyTime_MIN with PyTime_MIN.
* Delete unused sym_clear_flag function. (#115744)Benjamin Peterson2024-02-211-6/+0
|
* gh-110850: Use public PyTime functions (#115746)Victor Stinner2024-02-202-2/+2
| | | | | Replace private _PyTime functions with public PyTime functions. random_seed_time_pid() now reports errors to its caller.
* gh-110850: Rename internal PyTime C API functions (#115734)Victor Stinner2024-02-208-32/+30
| | | | | | | | | | | | | | | | | Rename functions: * _PyTime_GetSystemClock() => _PyTime_TimeUnchecked() * _PyTime_GetPerfCounter() => _PyTime_PerfCounterUnchecked() * _PyTime_GetMonotonicClock() => _PyTime_MonotonicUnchecked() * _PyTime_GetSystemClockWithInfo() => _PyTime_TimeWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() Changes: * Remove "typedef PyTime_t PyTime_t;" which was "typedef PyTime_t _PyTime_t;" before a previous rename. * Update comments of "Unchecked" functions. * Remove invalid PyTime_Time() comment.
* Tier 2 cleanups and tweaks (#115534)Guido van Rossum2024-02-204-44/+109
| | | | | | | | | * Rename `_testinternalcapi.get_{uop,counter}_optimizer` to `new_*_optimizer` * Use `_PyUOpName()` instead of` _PyOpcode_uop_name[]` * Add `target` to executor iterator items -- `list(ex)` now returns `(opcode, oparg, target, operand)` quadruples * Add executor methods `get_opcode()` and `get_oparg()` to get `vmdata.opcode`, `vmdata.oparg` * Define a helper for printing uops, and unify various places where they are printed * Add a hack to summarize_stats.py to fix legacy uop names (e.g. `POP_TOP` -> `_POP_TOP`) * Define helpers in `test_opt.py` for accessing the set or list of opnames of an executor
* gh-115733: Fix crash involving exhausted list iterator (#115740)Sam Gross2024-02-203-2/+4
| | | | | * gh-115733: Fix crash involving exhausted iterator * Add blurb
* gh-115735: Fix current executor NULL before _START_EXECUTOR (#115736)Ken Jin2024-02-201-2/+2
| | | This fixes level 3 or higher lltrace debug output `--with-pydebug` runs.
* gh-115103: Implement delayed free mechanism for free-threaded builds (#115367)Sam Gross2024-02-202-0/+9
| | | | | | This adds `_PyMem_FreeDelayed()` and supporting functions. The `_PyMem_FreeDelayed()` function frees memory with the same allocator as `PyMem_Free()`, but after some delay to ensure that concurrent lock-free readers have finished.
* gh-110850: Cleanup pycore_time.h includes (#115724)Victor Stinner2024-02-207-8/+15
| | | | | <pycore_time.h> include is no longer needed to get the PyTime_t type in internal header files. This type is now provided by <Python.h> include. Add <pycore_time.h> includes to C files instead.
* gh-115491: Keep some fields valid across allocations (free-threading) (#115573)Sam Gross2024-02-201-0/+15
| | | | | This avoids filling the memory occupied by ob_tid, ob_ref_local, and ob_ref_shared with debug bytes (e.g., 0xDD) in mimalloc in the free-threaded build.
* gh-110850: Replace _PyTime_t with PyTime_t (#115719)Victor Stinner2024-02-2010-182/+182
| | | | | Run command: sed -i -e 's!\<_PyTime_t\>!PyTime_t!g' $(find -name "*.c" -o -name "*.h")
* gh-112175: Add `eval_breaker` to `PyThreadState` (#115194)Brett Simmers2024-02-2012-130/+218
| | | | | | | | | | | This change adds an `eval_breaker` field to `PyThreadState`. The primary motivation is for performance in free-threaded builds: with thread-local eval breakers, we can stop a specific thread (e.g., for an async exception) without interrupting other threads. The source of truth for the global instrumentation version is stored in the `instrumentation_version` field in PyInterpreterState. Threads usually read the version from their local `eval_breaker`, where it continues to be colocated with the eval breaker bits.
* gh-110850: PyTime_Time() return 0 on success (GH-115713)Victor Stinner2024-02-201-1/+1
| | | Thanks!
* gh-115687: Split up guards from COMPARE_OP (GH-115688)Ken Jin2024-02-205-55/+88
|
* GH-115457: Support splitting and replication of micro ops. (GH-115558)Mark Shannon2024-02-206-51/+422
|
* GH-112354: Initial implementation of warm up on exits and trace-stitching ↵Mark Shannon2024-02-2011-135/+580
| | | | (GH-114142)
* gh-96497: Mangle name before symtable lookup in ↵wookie1842024-02-171-4/+10
| | | | 'symtable_extend_namedexpr_scope' (GH-96561)
* gh-115103: Implement delayed memory reclamation (QSBR) (#115180)Sam Gross2024-02-163-0/+323
| | | | | | This adds a safe memory reclamation scheme based on FreeBSD's "GUS" and quiescent state based reclamation (QSBR). The API provides a mechanism for callers to detect when it is safe to free memory that may be concurrently accessed by readers.
* gh-115480: Type / constant propagation for float binary uops (GH-115550)Peter Lazorchak2024-02-162-6/+117
| | | Co-authored-by: Ken Jin <kenjin@python.org>
* gh-112529: Make the GC scheduling thread-safe (#114880)Sam Gross2024-02-161-15/+48
| | | | | | | | | | The GC keeps track of the number of allocations (less deallocations) since the last GC. This buffers the count in thread-local state and uses atomic operations to modify the per-interpreter count. The thread-local buffering avoids contention on shared state. A consequence is that the GC scheduling is not as precise, so "test_sneaky_frame_object" is skipped because it requires that the GC be run exactly after allocating a frame object.
* gh-115480: Minor fixups in int constant propagation (GH-115507)Ken Jin2024-02-163-132/+59
|
* gh-115503: Fix `run_presite` error handling (#115504)Nikita Sobolev2024-02-161-1/+0
|