| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
BINARY_OP/SUBSCR, apply to arrays (#133396)" (#133498)
|
| |
|
|
| |
(#133497)
|
| | |
|
| |
|
|
|
|
|
|
| |
"Stateless" code is a function or code object which does not rely on external state or internal state.
It may rely on arguments and builtins, but not globals or a closure. I've left a comment in
pycore_code.h that provides more detail.
We also add _PyFunction_VerifyStateless(). The new functions will be used in several later changes
that facilitate "sharing" functions and code objects between interpreters.
|
| |
|
|
|
|
| |
This reverts commit 811edcf (gh-133232), which itself reverted the original commit 811edcf (gh-133128).
We reverted the original change due to failing s390 builds (a big-endian architecture).
It ended up that I had not accommodated op caches.
|
| |
|
|
| |
apply to arrays (#133396)
|
| |
|
|
|
| |
The change broke the s390 builds, so I'm reverting it while I investigate.
This reverts commit 94b4fcd806e7b692955173d309ea3b70a193ad96.
|
| |
|
|
|
|
|
| |
This helper is useful in a variety of ways, including in demonstrating how the different counts relate to one another.
It will be used in a later change to help identify if a function is "stateless", meaning it doesn't have any free vars or globals.
Note that a majority of this change is tests.
|
| |
|
|
|
|
|
| |
* Add stats for GET_ITER
* Look for common iterable types, not iterator types
* Add stats for self iter and fix naming in summary
|
| |
|
|
|
| |
Doing this was always the intention. I was finally motivated to find the time to do it.
See #87859 (comment).
|
| |
|
|
|
| |
The function indicates whether or not the function has a return statement.
This is used by a later change related treating some functions like scripts.
|
| |
|
| |
Remove also now unused includes in C files.
|
| |
|
|
| |
PyMutex type is now part of <Python.h>, it's no longer needed to
include <pycore_lock.h> to get it.
|
| |
|
|
| |
Adds new pycore_stats.h header file to help break dependencies involving the pycore_code.h header.
|
| |
|
|
|
| |
* Moves most structs in pycore_ header files into pycore_structs.h and pycore_runtime_structs.h
* Removes many cross-header dependencies
|
| | |
|
| | |
|
| |
|
|
| |
(#129700)
|
| | |
|
| |
|
|
|
|
|
| |
the code generators (GH-128918)" (GH-129202)
The commit introduced a ~2.5-3% regression in the free threading build.
This reverts commit ab61d3f4303d14a413bc9ae6557c730ffdf7579e.
|
| |
|
|
| |
generators (GH-128918)
|
| | |
|
| |
|
|
| |
(GH-122564)
|
| |
|
|
|
| |
(#127466)
Cast the result of the load to the correct type
|
| |
|
|
|
|
|
|
|
| |
`BINARY_OP` (#123926)
Each thread specializes a thread-local copy of the bytecode, created on the first RESUME, in free-threaded builds. All copies of the bytecode for a code object are stored in the co_tlbc array on the code object. Threads reserve a globally unique index identifying its copy of the bytecode in all co_tlbc arrays at thread creation and release the index at thread destruction. The first entry in every co_tlbc array always points to the "main" copy of the bytecode that is stored at the end of the code object. This ensures that no bytecode is copied for programs that do not use threads.
Thread-local bytecode can be disabled at runtime by providing either -X tlbc=0 or PYTHON_TLBC=0. Disabling thread-local bytecode also disables specialization.
Concurrent modifications to the bytecode made by the specializing interpreter and instrumentation use atomics, with specialization taking care not to overwrite an instruction that was instrumented concurrently.
|
| | |
|
| |
|
|
|
| |
(GH-123222)
Only count an instruction as deferred if hasn't deopted first.
|
| |
|
|
|
| |
* Convert CALL_ALLOC_AND_ENTER_INIT to micro-ops such that tier 2 supports it
* Allow inexact arguments for CALL_ALLOC_AND_ENTER_INIT.
|
| | |
|
| | |
|
| |
|
|
| |
Move _PyCode_CODE() and _PyCode_NBYTES() macros to the internal C API
since they use _Py_CODEUNIT which is only part of the internal C API.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This PR sets up tagged pointers for CPython.
The general idea is to create a separate struct _PyStackRef for everything on the evaluation stack to store the bits. This forces the C compiler to warn us if we try to cast things or pull things out of the struct directly.
Only for free threading: We tag the low bit if something is deferred - that means we skip incref and decref operations on it. This behavior may change in the future if Mark's plans to defer all objects in the interpreter loop pans out.
This implies a strict stack reference discipline is required. ALL incref and decref operations on stackrefs must use the stackref variants. It is unsafe to untag something then do normal incref/decref ops on it.
The new incref and decref variants are called dup and close. They mimic a "handle" API operating on these stackrefs.
Please read Include/internal/pycore_stackref.h for more information!
---------
Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Move _Py_CODEUNIT and related functions to pycore_code.h.
* Move _Py_BackoffCounter to pycore_backoff.h.
* Move Include/cpython/optimizer.h content to pycore_optimizer.h.
* Remove Include/cpython/optimizer.h.
* Remove PyUnstable_Replace_Executor().
Rename functions:
* PyUnstable_GetExecutor() => _Py_GetExecutor()
* PyUnstable_GetOptimizer() => _Py_GetOptimizer()
* PyUnstable_SetOptimizer() => _Py_SetTier2Optimizer()
* PyUnstable_Optimizer_NewCounter() => _PyOptimizer_NewCounter()
* PyUnstable_Optimizer_NewUOpOptimizer() => _PyOptimizer_NewUOpOptimizer()
|
| |
|
|
|
|
| |
We already intern and immortalize most string constants. In the
free-threaded build, other constants can be a source of reference count
contention because they are shared by all threads running the same code
objects.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Introduce a unified 16-bit backoff counter type (``_Py_BackoffCounter``),
shared between the Tier 1 adaptive specializer and the Tier 2 optimizer. The
API used for adaptive specialization counters is changed but the behavior is
(supposed to be) identical.
The behavior of the Tier 2 counters is changed:
- There are no longer dynamic thresholds (we never varied these).
- All counters now use the same exponential backoff.
- The counter for ``JUMP_BACKWARD`` starts counting down from 16.
- The ``temperature`` in side exits starts counting down from 64.
|
| |
|
|
| |
objects. (GH-116115)
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
| |
builds (#116013)
For now, disable all specialization when the GIL might be disabled.
|
| |
|
|
|
| |
For the most part, these changes make is substantially easier to backport subinterpreter-related code to 3.12, especially the related modules (e.g. _xxsubinterpreters). The main motivation is to support releasing a PyPI package with the 3.13 capabilities compiled for 3.12.
A lot of the changes here involve either hiding details behind macros/functions or splitting up some files.
|
| | |
|
| |
|
|
| |
Fix sign conversion in pycore_code.h: use unsigned integers and cast
explicitly when needed.
|
| | |
|
| |
|
| |
This keeps a separate 'miss' counter for each micro-opcode, incremented whenever a guard uop takes a deoptimization side exit.
|
| | |
|
| | |
|
| | |
|