summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-116396: Pass "detached_state" argument to tstate_set_detached (#116398)Sam Gross2024-03-071-6/+6
| | | | The stop-the-world code was incorrectly setting suspended threads' states to _Py_THREAD_DETACHED instead of _Py_THREAD_SUSPENDED.
* gh-116381: Remove bad specializations, add fail stats (GH-116464)Ken Jin2024-03-076-194/+41
| | | * Remove bad specializations, add fail stats
* gh-116420: Fix unused var compilation warnings (GH-116466)Ken Jin2024-03-072-0/+24
| | | Fix unused var compilation warnings
* gh-116437: Use new C API PyDict_Pop() to simplify the code (GH-116438)Serhiy Storchaka2024-03-076-39/+36
|
* gh-116397: Move the _PyGC_ClearAllFreeLists to the safe point (gh-116414)Donghee Na2024-03-061-2/+5
|
* gh-116381: Specialize CONTAINS_OP (GH-116385)Ken Jin2024-03-066-8/+373
| | | | | | | | | | | * Specialize CONTAINS_OP * 📜🤖 Added by blurb_it. * Add PyAPI_FUNC for JIT --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-115103: Delay reuse of mimalloc pages that store PyObjects (#115435)Sam Gross2024-03-062-10/+9
| | | | | | | | | | | | | | | | | | This implements the delayed reuse of mimalloc pages that contain Python objects in the free-threaded build. Allocations of the same size class are grouped in data structures called pages. These are different from operating system pages. For thread-safety, we want to ensure that memory used to store PyObjects remains valid as long as there may be concurrent lock-free readers; we want to delay using it for other size classes, in other heaps, or returning it to the operating system. When a mimalloc page becomes empty, instead of immediately freeing it, we tag it with a QSBR goal and insert it into a per-thread state linked list of pages to be freed. When mimalloc needs a fresh page, we process the queue and free any still empty pages that are now deemed safe to be freed. Pages waiting to be freed are still available for allocations of the same size class and allocating from a page prevent it from being freed. There is additional logic to handle abandoned pages when threads exit.
* GH-113710: Tier 2 optimizer: check the function instead of checking globals. ↵Mark Shannon2024-03-064-36/+27
| | | | (GH-116410)
* GH-115687: Most comparisons create Booleans, so propagate that information ↵Mark Shannon2024-03-062-16/+68
| | | | | (GH-116360) Most comparisons create booleans
* gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (#116359)Victor Stinner2024-03-061-40/+50
| | | | | | _PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type. Update tests for these changes.
* Fix debug output for optimized executor (#116337)Guido van Rossum2024-03-051-3/+4
| | | | This adjusts `length` rather than using `length+1` all over the place.
* GH-115685: Split `_TO_BOOL_ALWAYS_TRUE` into micro-ops (GH-116352)Mark Shannon2024-03-055-21/+27
|
* GH-115819: Eliminate Boolean guards when value is known (GH-116355)Mark Shannon2024-03-054-0/+97
|
* gh-116326: Handler errors correctly in `getwindowsversion` in `sysmodule` ↵Nikita Sobolev2024-03-051-20/+32
| | | | (#116339)
* GH-115685: Optimize `TO_BOOL` and variants based on truthiness of input. ↵Mark Shannon2024-03-054-55/+149
| | | | (GH-116311)
* gh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow errors ↵Nikita Sobolev2024-03-041-23/+25
| | | | (#115321)
* GH-116134: JIT aarch64-pc-windows-msvc (GH-116130)Brandt Bucher2024-03-041-0/+7
|
* gh-115832: Fix instrumentation version mismatch during interpreter shutdown ↵Brett Simmers2024-03-042-1/+12
| | | | | | | | | | | | | (#115856) A previous commit introduced a bug to `interpreter_clear()`: it set `interp->ceval.instrumentation_version` to 0, without making the corresponding change to `tstate->eval_breaker` (which holds a thread-local copy of the version). After this happens, Python code can still run due to object finalizers during a GC, and the version check in bytecodes.c will see a different result than the one in instrumentation.c causing an infinite loop. The fix itself is straightforward: clear `tstate->eval_breaker` when clearing `interp->ceval.instrumentation_version`.
* gh-115103: Update refleak checker to trigger _PyMem_ProcessDelayed (gh-116238)Donghee Na2024-03-021-0/+18
|
* gh-114271: Make `_thread.ThreadHandle` thread-safe in free-threaded builds ↵mpage2024-03-011-0/+31
| | | | | | | | | | | | | | | | | (GH-115190) Make `_thread.ThreadHandle` thread-safe in free-threaded builds We protect the mutable state of `ThreadHandle` using a `_PyOnceFlag`. Concurrent operations (i.e. `join` or `detach`) on `ThreadHandle` block until it is their turn to execute or an earlier operation succeeds. Once an operation has been applied successfully all future operations complete immediately. The `join()` method is now idempotent. It may be called multiple times but the underlying OS thread will only be joined once. After `join()` succeeds, any future calls to `join()` will succeed immediately. The internal thread handle `detach()` method has been removed.
* gh-115480: Type propagate _BINARY_OP_ADD_UNICODE (GH-115710)Ken Jin2024-03-012-2/+33
|
* 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.