summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-114746: Avoid quadratic behavior in free-threaded GC (GH-114817)Sam Gross2024-02-011-73/+29
| | | | | | | | | | | | | | The free-threaded build's GC implementation is non-generational, but was scheduled as if it were collecting a young generation leading to quadratic behavior. This increases the minimum threshold and scales it to the number of live objects as we do for the old generation in the default build. Note that the scheduling is still not thread-safe without the GIL. Those changes will come in later PRs. A few tests, like "test_sneaky_frame_object" rely on prompt scheduling of the GC. For now, to keep that test passing, we disable the scaled threshold after calls like `gc.set_threshold(1, 0, 0)`.
* gh-112606: Use pthread_cond_timedwait_relative_np() in parking_lot.c when ↵Matt Prodani2024-01-301-1/+5
| | | | | | | available (#112616) Add a configure define for HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP and replaces pthread_cond_timedwait() with pthread_cond_timedwait_relative_np() for relative time when supported in semaphore waiting logic.
* gh-103323: Remove current_fast_get() unused parameter (#114593)Victor Stinner2024-01-301-26/+24
| | | | The current_fast_get() static inline function doesn't use its 'runtime' parameter, so just remove it.
* gh-114569: Use PyMem_* APIs for non-PyObjects in compiler (#114587)Erlend E. Aasland2024-01-292-16/+15
|
* gh-114685: Fix incorrect use of PyBUF_READ in import.c (GH-114686)Nikita Sobolev2024-01-291-1/+1
|
* GH-113464: Add a JIT backend for tier 2 (GH-113465)Brandt Bucher2024-01-294-1/+407
| | | | | | | Add an option (--enable-experimental-jit for configure-based builds or --experimental-jit for PCbuild-based ones) to build an *experimental* just-in-time compiler, based on copy-and-patch (https://fredrikbk.com/publications/copy-and-patch.pdf). See Tools/jit/README.md for more information on how to install the required build-time tooling.
* gh-113055: Use pointer for interp->obmalloc state (gh-113412)Neil Schemenauer2024-01-272-8/+22
| | | | | | | | | For interpreters that share state with the main interpreter, this points to the same static memory structure. For interpreters with their own obmalloc state, it is heap allocated. Add free_obmalloc_arenas() which will free the obmalloc arenas and radix tree structures for interpreters with their own obmalloc state. Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-111968: Unify freelist naming schema to Eric's suggestion (gh-114581)Donghee Na2024-01-262-4/+4
|
* gh-107901: compiler replaces POP_BLOCK instruction by NOPs before ↵Irit Katriel2024-01-251-1/+2
| | | | optimisations (#114530)
* gh-112529: Implement GC for free-threaded builds (#114262)Sam Gross2024-01-254-6/+1794
| | | | | | | * gh-112529: Implement GC for free-threaded builds This implements a mark and sweep GC for the free-threaded builds of CPython. The implementation relies on mimalloc to find GC tracked objects (i.e., "containers").
* gh-114265: remove i_loc_propagated, jump threading does not consider line ↵Irit Katriel2024-01-251-41/+47
| | | | numbers anymore (#114535)
* gh-114312: Collect stats for unlikely events (GH-114493)Michael Droettboom2024-01-253-0/+30
|
* Update outdated comment in ``Python/bytecodes.c`` (#114522)Kirill Podoprigora2024-01-241-2/+2
|
* GH-112354: `END_FOR` instruction to only pop one value. (GH-114247)Mark Shannon2024-01-244-37/+39
| | | | * Compiler emits END_FOR; POP_TOP instead of END_FOR. To support tier 2 side exits in loops.
* GH-113710: Add a tier 2 peephole optimization pass. (GH-114487)Mark Shannon2024-01-245-3/+60
| | | | | * Convert _LOAD_CONST to inline versions * Remove PEP 523 checks
* gh-111964: Implement stop-the-world pauses (gh-112471)Sam Gross2024-01-232-14/+264
| | | | | | | | | | | | | | | | | The `--disable-gil` builds occasionally need to pause all but one thread. Some examples include: * Cyclic garbage collection, where this is often called a "stop the world event" * Before calling `fork()`, to ensure a consistent state for internal data structures * During interpreter shutdown, to ensure that daemon threads aren't accessing Python objects This adds the following functions to implement global and per-interpreter pauses: * `_PyEval_StopTheWorldAll()` and `_PyEval_StartTheWorldAll()` (for the global runtime) * `_PyEval_StopTheWorld()` and `_PyEval_StartTheWorld()` (per-interpreter) (The function names may change.) These functions are no-ops outside of the `--disable-gil` build.
* gh-114083: apply optimization of LOAD_CONST instructions to the whole CFG ↵Irit Katriel2024-01-221-140/+179
| | | | before optimize_basic_block. (#114408)
* gh-113102: Fix typo in INSTRUMENTED_RESUME (GH-114349)Guido van Rossum2024-01-222-2/+2
|
* gh-114384: Align sys.set_asyncgen_hooks signature in docs to reflect ↵Nikita Sobolev2024-01-211-1/+1
| | | | implementation (#114385)
* gh-112529: Use GC heaps for GC allocations in free-threaded builds (gh-114157)Sam Gross2024-01-201-6/+7
| | | | | | | | | | * gh-112529: Use GC heaps for GC allocations in free-threaded builds The free-threaded build's garbage collector implementation will need to find GC objects by traversing mimalloc heaps. This hooks up the allocation calls with the correct heaps by using a thread-local "current_obj_heap" variable. * Refactor out setting heap based on type
* gh-114265: move line number propagation before cfg optimization, remove ↵Irit Katriel2024-01-191-53/+54
| | | | guarantee_lineno_for_exits (#114267)
* gh-111968: Use per-thread freelists for generator in free-threading (gh-114189)Donghee Na2024-01-184-4/+3
|
* Delete unused macro (GH-114238)Mark Shannon2024-01-181-3/+0
|
* Update copyright years to 2024. (GH-113608)solya0x2024-01-161-1/+1
| | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-111968: Use per-thread freelists for PyContext in free-threading (gh-114122)Donghee Na2024-01-165-28/+18
|
* gh-113626: Add allow_code parameter in marshal functions (GH-113648)Serhiy Storchaka2024-01-162-43/+282
| | | | | Passing allow_code=False prevents serialization and de-serialization of code objects which is incompatible between Python versions.
* GH-113655: Lower the C recursion limit on various platforms (GH-113944)Mark Shannon2024-01-165-22/+13
|
* gh-111968: Use per-thread slice_cache in free-threading (gh-113972)Donghee Na2024-01-152-3/+2
|
* GH-112354: `_GUARD_IS_TRUE_POP` side-exits to target the next instruction, ↵Mark Shannon2024-01-153-14/+27
| | | | not themselves. (GH-114078)
* gh-113710: Add types to the interpreter DSL (#113711)Ken Jin2024-01-122-41/+26
| | | | Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-107901: duplicate blocks with no lineno that have an eval break and ↵Irit Katriel2024-01-121-10/+22
| | | | multiple predecessors (#113950)
* GH-113860: Get rid of `_PyUOpExecutorObject` (GH-113954)Brandt Bucher2024-01-126-29/+27
|
* gh-111968: Use per-thread freelists for tuple in free-threading (gh-113921)Donghee Na2024-01-114-3/+2
|
* gh-113845: Fix a compiler warning in Python/suggestions.c (GH-113949)Serhiy Storchaka2024-01-111-2/+0
|
* GH-113853: Guarantee forward progress in executors (GH-113854)Mark Shannon2024-01-113-73/+118
|
* gh-107901: jump leaving an exception handler doesn't need an eval break ↵Irit Katriel2024-01-111-1/+1
| | | | check (#113943)
* gh-89811: Check for valid tp_version_tag in specializer (GH-113558)Peter Lazorchak2024-01-111-1/+29
|
* gh-111968: Use per-thread freelists for float in free-threading (gh-113886)Donghee Na2024-01-104-3/+2
|
* GH-113860: All executors are now defined in terms of micro ops. Convert ↵Mark Shannon2024-01-104-130/+111
| | | | counter executor to use uops. (GH-113864)
* gh-111968: Introduce _PyFreeListState and _PyFreeListState_GET API (gh-113584)Donghee Na2024-01-095-17/+71
|
* Fix opcode name printing in debug mode (#113870)Guido van Rossum2024-01-091-3/+3
| | | Fix a few places where the lltrace debug output printed ``(null)`` instead of an opcode name, because it was calling ``_PyUOpName()`` on a Tier-1 opcode.
* gh-113842: Add missing error check for PyIter_Next() in Python/symtable.c ↵Yan Yanchii2024-01-091-0/+6
| | | | (GH-113843)
* gh-110721: Remove unused code from suggestions.c after moving PyErr_Display ↵Pablo Galindo Salgado2024-01-082-219/+1
| | | | to use the traceback module (#113712)
* gh-73965: Move PYTHON_HISTORY into the correct usage section (#113798)Hugo van Kemenade2024-01-081-1/+1
| | | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-73965: New environment variable PYTHON_HISTORY (#13208)Zackery Spytz2024-01-071-0/+1
| | | | | | | | It can be used to set the location of a .python_history file --------- Co-authored-by: Levi Sabah <0xl3vi@gmail.com> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* gh-107901: synthetic jumps which are not at end of loop no longer check the ↵Irit Katriel2024-01-062-23/+36
| | | | eval breaker (#113721)
* gh-113688: Split up gcmodule.c (gh-113715)Sam Gross2024-01-051-0/+1958
| | | | | This splits part of Modules/gcmodule.c of into Python/gc.c, which now contains the core garbage collection implementation. The Python module remain in the Modules/gcmodule.c file.
* gh-112532: Tag mimalloc heaps and pages (#113742)Sam Gross2024-01-051-2/+2
| | | | | | | | | | | | | | | | | | | | | * gh-112532: Tag mimalloc heaps and pages Mimalloc pages are data structures that contain contiguous allocations of the same block size. Note that they are distinct from operating system pages. Mimalloc pages are contained in segments. When a thread exits, it abandons any segments and contained pages that have live allocations. These segments and pages may be later reclaimed by another thread. To support GC and certain thread-safety guarantees in free-threaded builds, we want pages to only be reclaimed by the corresponding heap in the claimant thread. For example, we want pages containing GC objects to only be claimed by GC heaps. This allows heaps and pages to be tagged with an integer tag that is used to ensure that abandoned pages are only claimed by heaps with the same tag. Heaps can be initialized with a tag (0-15); any page allocated by that heap copies the corresponding tag. * Fix conversion warning
* GH-113486: Do not emit spurious PY_UNWIND events for optimized calls to ↵Mark Shannon2024-01-053-5/+6
| | | | classes. (GH-113680)
* gh-112532: Isolate abandoned segments by interpreter (#113717)Sam Gross2024-01-041-0/+5
| | | | | | | | | | | | | | | * gh-112532: Isolate abandoned segments by interpreter Mimalloc segments are data structures that contain memory allocations along with metadata. Each segment is "owned" by a thread. When a thread exits, it abandons its segments to a global pool to be later reclaimed by other threads. This changes the pool to be per-interpreter instead of process-wide. This will be important for when we use mimalloc to find GC objects in the `--disable-gil` builds. We want heaps to only store Python objects from a single interpreter. Absent this change, the abandoning and reclaiming process could break this isolation. * Add missing '&_mi_abandoned_default' to 'tld_empty'