summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* gh-112716: Fix SystemError when __builtins__ is not a dict (GH-112770)Serhiy Storchaka2023-12-141-2/+2
| | | | | | It was raised in two cases: * in the import statement when looking up __import__ * in pickling some builtin type when looking up built-ins iter, getattr, etc.
* A smattering of cleanups in uop debug output and lltrace (#112980)Guido van Rossum2023-12-121-8/+10
| | | | | | * Include destination T1 opcode in Error debug message * Include destination T1 opcode in DEOPT debug message * Remove obsolete comment from remove_unneeded_uops * Change lltrace_instruction() to print caller's opcode/oparg
* gh-112660: Do not clear arbitrary errors on import (GH-112661)Serhiy Storchaka2023-12-071-15/+31
| | | | | Previously arbitrary errors could be cleared during formatting error messages for ImportError or AttributeError for modules. Now all unexpected errors are reported.
* Rename ...Uop... to ...UOp... (uppercase O) for consistency (#112327)Guido van Rossum2023-11-291-6/+6
| | | | * Rename _PyUopExecute to _PyUOpExecute (uppercase O) for consistency * Also rename _PyUopName and _PyUOp_Replacements, and some output strings
* gh-112217: Add check to call result for `do_raise()` where cause is a type. ↵apaz2023-11-271-0/+7
| | | | (#112216)
* gh-111786: Use separate opcode vars for Tier 1 and Tier 2 (#112289)Michael Droettboom2023-11-201-12/+11
| | | | This makes Windows about 3% faster on pyperformance benchmarks.
* gh-112287: Speed up Tier 2 (uop) interpreter a little (#112286)Guido van Rossum2023-11-201-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | This makes the Tier 2 interpreter a little faster. I calculated by about 3%, though I hesitate to claim an exact number. This starts by doubling the trace size limit (to 512), making it more likely that loops fit in a trace. The rest of the approach is to only load `oparg` and `operand` in cases that use them. The code generator know when these are used. For `oparg`, it will conditionally emit ``` oparg = CURRENT_OPARG(); ``` at the top of the case block. (The `oparg` variable may be referenced multiple times by the instructions code block, so it must be in a variable.) For `operand`, it will use `CURRENT_OPERAND()` directly instead of referencing the `operand` variable, which no longer exists. (There is only one place where this will be used.)
* gh-106529: Make FOR_ITER a viable uop (#112134)Guido van Rossum2023-11-201-2/+2
| | | | | | | | | | This uses the new mechanism whereby certain uops are replaced by others during translation, using the `_PyUop_Replacements` table. We further special-case the `_FOR_ITER_TIER_TWO` uop to update the deoptimization target to point just past the corresponding `END_FOR` opcode. Two tiny code cleanups are also part of this PR.
* gh-111863: Rename `Py_NOGIL` to `Py_GIL_DISABLED` (#111864)Hugo van Kemenade2023-11-201-2/+2
| | | Rename Py_NOGIL to Py_GIL_DISABLED
* Various small improvements to uop debug output (#112218)Guido van Rossum2023-11-171-4/+11
| | | | | - Show uop name in Error/DEOPT messages - Add target to some messages - Expose uop_name() as _PyUopName()
* GH-111848: Set the IP when de-optimizing (GH-112065)Mark Shannon2023-11-151-0/+2
| | | | | | | | | | | | * Replace jumps with deopts in tier 2 * Fewer special cases of uop names * Add target field to uop IR * Remove more redundant SET_IP and _CHECK_VALIDITY micro-ops * Extend whitelist of non-escaping API functions.
* gh-111789: Simplify ceval.c by using PyDict_GetItemRef() (GH-111980)Serhiy Storchaka2023-11-141-18/+14
|
* GH-111520: Add back the operand local (GH-111813)Brandt Bucher2023-11-141-5/+1
|
* gh-111786: Optimize for space for _PyEval_EvalFrameDefault on MSVC for PGO ↵Michael Droettboom2023-11-091-0/+10
| | | | | | | (#111794) In PGO mode, this function caused a compiler error in MSVC. It turns out that optimizing for space only save the day, and is even faster. However, without PGO, this is neither necessary nor slower.
* GH-109369: Exit tier 2 if executor is invalid (GH-111657)Mark Shannon2023-11-091-1/+1
|
* gh-111663: Restore the Tier 2 uop count pystats (#111664)Michael Droettboom2023-11-021-0/+2
|
* gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 ↵Irit Katriel2023-11-021-1/+1
| | | | (#111459)
* gh-108082: Use PyErr_FormatUnraisable() (GH-111580)Serhiy Storchaka2023-11-021-4/+4
| | | | | | Replace most of calls of _PyErr_WriteUnraisableMsg() and some calls of PyErr_WriteUnraisable(NULL) with PyErr_FormatUnraisable(). Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-111520: Integrate the Tier 2 interpreter in the Tier 1 interpreter (#111428)Guido van Rossum2023-11-011-13/+143
| | | | | | | | | | | - There is no longer a separate Python/executor.c file. - Conventions in Python/bytecodes.c are slightly different -- don't use `goto error`, you must use `GOTO_ERROR(error)` (same for others like `unused_local_error`). - The `TIER_ONE` and `TIER_TWO` symbols are only valid in the generated (.c.h) files. - In Lib/test/support/__init__.py, `Py_C_RECURSION_LIMIT` is imported from `_testcapi`. - On Windows, in debug mode, stack allocation grows from 8MiB to 12MiB. - **Beware!** This changes the env vars to enable uops and their debugging to `PYTHON_UOPS` and `PYTHON_LLTRACE`.
* GH-111485: Increment `next_instr` consistently at the start of the ↵Mark Shannon2023-10-311-1/+1
| | | | instruction. (GH-111486)
* gh-110481: Implement biased reference counting (gh-110764)Sam Gross2023-10-301-1/+2
|
* gh-111354: define names for RESUME oparg values (#111365)Irit Katriel2023-10-261-1/+1
|
* gh-109094: replace frame->prev_instr by frame->instr_ptr (#109095)Irit Katriel2023-10-261-15/+15
|
* gh-110237: Check `PyList_Append` for errors in `_PyEval_MatchClass` (#110238)denballakh2023-10-081-3/+11
|
* GH-105848: Replace KW_NAMES + CALL with LOAD_CONST + CALL_KW (GH-109300)Brandt Bucher2023-09-131-2/+0
|
* GH-108390: Prevent non-local events being set with ↵Mark Shannon2023-09-051-15/+17
| | | | `sys.monitoring.set_local_events()` (GH-108420)
* gh-108765: Python.h no longer includes <ctype.h> (#108831)Victor Stinner2023-09-031-3/+1
| | | | | | | | | | | | | | | | | | | | | | | Remove <ctype.h> in C files which don't use it; only sre.c and _decimal.c still use it. Remove _PY_PORT_CTYPE_UTF8_ISSUE code from pyport.h: * Code added by commit b5047fd01948ab108edcc1b3c2c901d915814cfd in 2004 for MacOSX and FreeBSD. * Test removed by commit 52ddaefb6bab1a74ecffe8519c02735794ebfbe1 in 2007, since Python str type now uses locale independent functions like Py_ISALPHA() and Py_TOLOWER() and the Unicode database. Modules/_sre/sre.c replaces _PY_PORT_CTYPE_UTF8_ISSUE with new functions: sre_isalnum(), sre_tolower(), sre_toupper(). Remove unused includes: * _localemodule.c: remove <stdio.h>. * getargs.c: remove <float.h>. * dynload_win.c: remove <direct.h>, it no longer calls _getcwd() since commit fb1f68ed7cc1536482d1debd70a53c5442135fe2 (in 2001).
* GH-108614: Remove non-debug uses of `#if TIER_ONE` and `#if TIER_TWO` from ↵Mark Shannon2023-08-311-19/+32
| | | | `_POP_FRAME` op. (GH-108685)
* gh-108444: Replace _PyLong_AsInt() with PyLong_AsInt() (#108459)Victor Stinner2023-08-241-1/+1
| | | | | | Change generated by the command: sed -i -e 's!_PyLong_AsInt!PyLong_AsInt!g' \ $(find -name "*.c" -o -name "*.h")
* gh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. ↵Irit Katriel2023-08-231-2/+1
| | | | (#108367)
* gh-107944: Improve error message for function calls with bad keyword ↵Pablo Galindo Salgado2023-08-171-3/+28
| | | | arguments (#107969)
* gh-106581: Project through calls (#108067)Guido van Rossum2023-08-171-10/+4
| | | | This finishes the work begun in gh-107760. When, while projecting a superblock, we encounter a call to a short, simple function, the superblock will now enter the function using `_PUSH_FRAME`, continue through it, and leave it using `_POP_FRAME`, and then continue through the original code. Multiple frame pushes and pops are even possible. It is also possible to stop appending to the superblock in the middle of a called function, when running out of space or encountering an unsupported bytecode.
* GH-108035: Remove the `_PyCFrame` struct as it is no longer needed for ↵Mark Shannon2023-08-171-15/+7
| | | | performance. (GH-108036)
* gh-106581: Split `CALL_PY_EXACT_ARGS` into uops (#107760)Guido van Rossum2023-08-161-5/+1
| | | | | | | | | | | | * Split `CALL_PY_EXACT_ARGS` into uops This is only the first step for doing `CALL` in Tier 2. The next step involves tracing into the called code object and back. After that we'll have to do the remaining `CALL` specialization. Finally we'll have to deal with `KW_NAMES`. Note: this moves setting `frame->return_offset` directly in front of `DISPATCH_INLINED()`, to make it easier to move it into `_PUSH_FRAME`.
* GH-107724: Fix the signature of `PY_THROW` callback functions. (GH-107725)Mark Shannon2023-08-091-1/+1
|
* gh-107758: Improvements to lltrace feature (#107757)Guido van Rossum2023-08-081-6/+28
| | | | | | | | | - The `dump_stack()` method could call a `__repr__` method implemented in Python, causing (infinite) recursion. I rewrote it to only print out the values for some fundamental types (`int`, `str`, etc.); for everything else it just prints `<type_name @ 0xdeadbeef>`. - The lltrace-like feature for uops wrote to `stderr`, while the one in `ceval.c` writes to `stdout`; I changed the uops to write to stdout as well.
* GH-84436: Skip refcounting for known immortals (GH-107605)Brandt Bucher2023-08-041-1/+1
|