summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-122239: Add actual count in unbalanced unpacking error message when ↵Tushar Sadhwani2024-09-101-0/+11
| | | | possible (#122244)
* gh-117376: Make `Py_DECREF` a macro in ceval.c in free-threaded build (#122975)Sam Gross2024-08-231-15/+44
| | | | | | | | | | | `Py_DECREF` and `PyStackRef_CLOSE` are now implemented as macros in the free-threaded build in ceval.c. There are two motivations; * MSVC has problems inlining functions in ceval.c in the PGO build. * We will want to mark escaping calls in order to spill the stack pointer in ceval.c and we will want to do this around `_Py_Dealloc` (or `_Py_MergeZeroLocalRefcount` or `_Py_DecRefShared`), not around the entire `Py_DECREF` or `PyStackRef_CLOSE` call.
* GH-118093: Make `CALL_ALLOC_AND_ENTER_INIT` suitable for tier 2. (GH-123140)Mark Shannon2024-08-201-11/+9
| | | | | * Convert CALL_ALLOC_AND_ENTER_INIT to micro-ops such that tier 2 supports it * Allow inexact arguments for CALL_ALLOC_AND_ENTER_INIT.
* gh-122728: Fix SystemError in PyEval_GetLocals() (#122735)Victor Stinner2024-08-061-1/+1
| | | | | | | Fix PyEval_GetLocals() to avoid SystemError ("bad argument to internal function"). Don't redefine the 'ret' variable in the if block. Add an unit test on PyEval_GetLocals().
* GH-117224: Move the body of a few large-ish micro-ops into helper functions ↵Mark Shannon2024-08-021-0/+135
| | | | (GH-122601)
* GH-116090: Fire RAISE events from _FOR_ITER_TIER_TWO (GH-122413)Brandt Bucher2024-07-291-6/+3
|
* GH-121131: Clean up and fix some instrumented instructions. (GH-121132)Mark Shannon2024-07-261-40/+0
| | | | * Add support for 'prev_instr' to code generator and refactor some INSTRUMENTED instructions
* GH-118093: Add tier two support to several instructions (GH-121884)Brandt Bucher2024-07-181-7/+4
|
* GH-120024: Use pointer for stack pointer (GH-121923)Mark Shannon2024-07-181-1/+1
|
* gh-118934: Make PyEval_GetLocals return borrowed reference (#119769)Tian Gao2024-07-161-1/+32
| | | Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
* gh-121338: Remove #pragma optimize (#121340)Michael Droettboom2024-07-081-10/+0
|
* gh-117139: Add _PyTuple_FromStackRefSteal and use it (#121244)Sam Gross2024-07-021-7/+1
| | | Avoids the extra conversion from stack refs to PyObjects.
* GH-116017: Get rid of _COLD_EXITs (GH-120960)Brandt Bucher2024-07-011-21/+2
|
* gh-117139: Fix a few wrong steals in bytecodes.c (GH-121127)Ken Jin2024-06-281-1/+1
| | | Fix a few wrong steals in bytecodes.c
* gh-117139: Convert the evaluation stack to stack refs (#118450)Ken Jin2024-06-261-61/+122
| | | | | | | | | | | | | | | | | 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>
* gh-120834: fix type of *_iframe field in _PyGenObject_HEAD declaration (#120835)Irit Katriel2024-06-241-1/+1
|
* GH-120507: Lower the `BEFORE_WITH` and `BEFORE_ASYNC_WITH` instructions. ↵Mark Shannon2024-06-181-0/+23
| | | | | | | | | (#120640) * Remove BEFORE_WITH and BEFORE_ASYNC_WITH instructions. * Add LOAD_SPECIAL instruction * Reimplement `with` and `async with` statements using LOAD_SPECIAL
* Fix typos in documentation and comments (#119763)Xie Yanbo2024-06-041-1/+1
|
* gh-118692: Avoid creating unnecessary StopIteration instances for monitoring ↵Irit Katriel2024-05-211-3/+11
| | | | (#119216)
* gh-118613: Fix error handling of `_PyEval_GetFrameLocals` in `ceval.c` (#118614)Nikita Sobolev2024-05-061-4/+8
|
* gh-74929: Implement PEP 667 (GH-115153)Tian Gao2024-05-041-7/+41
|
* GH-118095: Use broader specializations of CALL in tier 1, for better tier 2 ↵Mark Shannon2024-05-041-5/+3
| | | | | | | | | | support of calls. (GH-118322) * Add CALL_PY_GENERAL, CALL_BOUND_METHOD_GENERAL and call CALL_NON_PY_GENERAL specializations. * Remove CALL_PY_WITH_DEFAULTS specialization * Use CALL_NON_PY_GENERAL in more cases when otherwise failing to specialize
* gh-107674: Improve performance of `sys.settrace` (GH-117133)Tian Gao2024-05-031-11/+17
| | | | | | * Check tracing in RESUME_CHECK * Only change to RESUME_CHECK if not tracing
* gh-118335: Configure Tier 2 interpreter at build time (#118339)Guido van Rossum2024-05-011-1/+4
| | | | | | | | | | | | | | | | | | | | | | The code for Tier 2 is now only compiled when configured with `--enable-experimental-jit[=yes|interpreter]`. We drop support for `PYTHON_UOPS` and -`Xuops`, but you can disable the interpreter or JIT at runtime by setting `PYTHON_JIT=0`. You can also build it without enabling it by default using `--enable-experimental-jit=yes-off`; enable with `PYTHON_JIT=1`. On Windows, the `build.bat` script supports `--experimental-jit`, `--experimental-jit-off`, `--experimental-interpreter`. In the C code, `_Py_JIT` is defined as before when the JIT is enabled; the new variable `_Py_TIER2` is defined when the JIT *or* the interpreter is enabled. It is actually a bitmask: 1: JIT; 2: default-off; 4: interpreter.
* gh-117657: Fix small issues with instrumentation and TSAN (#118064)Dino Viehland2024-04-301-1/+1
| | | Small TSAN fixups for instrumentation
* GH-118095: Add dynamic exit support and FOR_ITER_GEN support to tier 2 ↵Mark Shannon2024-04-261-0/+4
| | | | (GH-118279)
* gh-116818: Make `sys.settrace`, `sys.setprofile`, and monitoring thread-safe ↵Dino Viehland2024-04-191-0/+1
| | | | | | | (#116775) Makes sys.settrace, sys.setprofile, and monitoring generally thread-safe. Mostly uses a stop-the-world approach and synchronization around the code object's _co_instrumentation_version. There may be a little bit of extra synchronization around the monitoring data that's required to be TSAN clean.
* GH-118036: Fix a bug with CALL_STAT_INC (#117933)Guido van Rossum2024-04-181-2/+0
| | | | | | | We were under-counting calls in `_PyEvalFramePushAndInit` because the `CALL_STAT_INC` macro was redefined to a no-op for the Tier 2 interpreter. The fix is not to `#undef` it at all. This results in ~37% more "Frames pushed" reported under "Call stats".
* gh-115178: Add Counts of UOp Pairs to pystats (GH-115181)Jeff Glass2024-04-161-0/+2
|
* GH-117457: Correct pystats uop "miss" counts (GH-117477)Michael Droettboom2024-04-041-2/+0
|
* gh-116968: Reimplement Tier 2 counters (#117144)Guido van Rossum2024-04-041-2/+3
| | | | | | | | | | | | 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.
* Fix successor opcode name printing in Tier 2 DEOPT debug message (#117471)Guido van Rossum2024-04-021-1/+1
|
* gh-117323: Make `cell` thread-safe in free-threaded builds (#117330)Sam Gross2024-03-291-0/+1
| | | Use critical sections to lock around accesses to cell contents. The critical sections are no-ops in the default (with GIL) build.
* GH-117121: Add pystats to JIT builds (GH-117346)Michael Droettboom2024-03-281-1/+1
|
* GH-116422: Tier2 hot/cold splitting (GH-116813)Mark Shannon2024-03-261-38/+19
| | | | | Splits the "cold" path, deopts and exits, from the "hot" path, reducing the size of most jitted instructions, at the cost of slower exits.
* gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781)Bogdan Romanyuk2024-03-191-1/+1
|
* Cleanup tier2 debug output (#116920)Guido van Rossum2024-03-181-2/+7
| | | Various tweaks, including a slight refactor of the special cases for `_PUSH_FRAME`/`_POP_FRAME` to show the actual operand emitted.
* gh-116098: Revert "gh-107674: Improve performance of `sys.settrace` ↵Tian Gao2024-03-011-17/+11
| | | | | | | (GH-114986)" (GH-116178) Revert "gh-107674: Improve performance of `sys.settrace` (GH-114986)" This reverts commit 0a61e237009bf6b833e13ac635299ee063377699.
* GH-115802: JIT "small" code for Windows (GH-115964)Brandt Bucher2024-02-291-0/+6
|
* gh-107674: Improve performance of `sys.settrace` (GH-114986)Tian Gao2024-02-281-11/+17
|
* Tier 2 cleanups and tweaks (#115534)Guido van Rossum2024-02-201-21/+40
| | | | | | | | | * 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-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-112175: Add `eval_breaker` to `PyThreadState` (#115194)Brett Simmers2024-02-201-1/+1
| | | | | | | | | | | 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-115457: Support splitting and replication of micro ops. (GH-115558)Mark Shannon2024-02-201-1/+1
|
* GH-112354: Initial implementation of warm up on exits and trace-stitching ↵Mark Shannon2024-02-201-20/+27
| | | | (GH-114142)
* GH-113464: Add a JIT backend for tier 2 (GH-113465)Brandt Bucher2024-01-291-1/+19
| | | | | | | 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-113860: Get rid of `_PyUOpExecutorObject` (GH-113954)Brandt Bucher2024-01-121-2/+1
|
* GH-113486: Do not emit spurious PY_UNWIND events for optimized calls to ↵Mark Shannon2024-01-051-0/+3
| | | | classes. (GH-113680)
* GH-111485: Generate instruction and uop metadata (GH-113287)Mark Shannon2023-12-201-0/+1
|
* GH-112354: Treat _EXIT_TRACE like an unconditional side exit (GH-113104)Mark Shannon2023-12-141-17/+2
|