summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304)Serhiy Storchaka2023-07-091-10/+6
| | | | It simplifies and speed up the code.
* Delete dead ceval code. (gh-106486)Benjamin Peterson2023-07-071-5/+0
|
* gh-104584: Fix error handling from backedge optimization (#106484)Guido van Rossum2023-07-061-2/+2
| | | | | | | | | | | | When `_PyOptimizer_BackEdge` returns `NULL`, we should restore `next_instr` (and `stack_pointer`). To accomplish this we should jump to `resume_with_error` instead of just `error`. The problem this causes is subtle -- the only repro I have is in PR gh-106393, at commit d7df54b139bcc47f5ea094bfaa9824f79bc45adc. But the fix is real (as shown later in that PR). While we're at it, also improve the debug output: the offsets at which traces are identified are now measured in bytes, and always show the start offset. This makes it easier to correlate executor calls with optimizer calls, and either with `dis` output. <!-- gh-issue-number: gh-104584 --> * Issue: gh-104584 <!-- /gh-issue-number -->
* gh-105340: include hidden fast-locals in locals() (#105715)Carl Meyer2023-07-051-0/+13
| | | * gh-105340: include hidden fast-locals in locals()
* GH-104584: Fix ENTER_EXECUTOR (GH-106141)Mark Shannon2023-07-031-69/+1
| | | | | | * Check eval-breaker in ENTER_EXECUTOR. * Make sure that frame->prev_instr is set before entering executor.
* gh-106290: Fix edge cases around uops (#106319)Guido van Rossum2023-07-031-31/+31
| | | | | | | | | | - Tweak uops debugging output - Fix the bug from gh-106290 - Rename `SET_IP` to `SAVE_IP` (per https://github.com/faster-cpython/ideas/issues/558) - Add a `SAVE_IP` uop at the start of the trace (ditto) - Allow `unbound_local_error`; this gives us uops for `LOAD_FAST_CHECK`, `LOAD_CLOSURE`, and `DELETE_FAST` - Longer traces - Support `STORE_FAST_LOAD_FAST`, `STORE_FAST_STORE_FAST` - Add deps on pycore_uops.h to Makefile(.pre.in)
* gh-106280: Remove unnecessary unreachable code (gh-106285)Dong-hee Na2023-06-301-3/+0
|
* gh-106023: Update code using _PyObject_FastCall() (#106257)Victor Stinner2023-06-301-15/+12
| | | Replace _PyObject_FastCall() calls with PyObject_Vectorcall().
* gh-104584: Emit macro expansions to opcode_metadata.h (#106163)Guido van Rossum2023-06-281-3/+3
| | | | | | | This produces longer traces (superblocks?). Also improved debug output (uop names are now printed instead of numeric opcodes). This would be simpler if the numeric opcode values were generated by generate_cases.py, but that's another project. Refactored some code in generate_cases.py so the essential algorithm for cache effects is only run once. (Deciding which effects are used and what the total cache size is, regardless of what's used.)
* gh-104584: Change DEOPT_IF in uops executor (#106146)Guido van Rossum2023-06-271-10/+6
| | | This effectively reverts bb578a0, restoring the original DEOPT_IF() macro in ceval_macros.h, and redefining it in the Tier 2 interpreter. We can get rid of the PREDICTED() macros there as well!
* gh-104584: Baby steps towards generating and executing traces (#105924)Guido van Rossum2023-06-271-8/+129
| | | | | Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose). All of this code is likely to change dramatically before the 3.13 feature freeze. But this is a first step.
* GH-91095: Specialize calls to normal Python classes. (GH-99331)Mark Shannon2023-06-221-1/+3
|
* gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and ↵Irit Katriel2023-06-171-2/+3
| | | | replace by their new versions (#105865)
* GH-77273: Better bytecodes for f-strings (GH-6132)Mark Shannon2023-06-141-0/+8
|
* GH-100987: Allow objects other than code objects as the "executable" of an ↵Mark Shannon2023-06-141-15/+22
| | | | | | | | | | internal frame. (GH-105727) * Add table describing possible executable classes for out-of-process debuggers. * Remove shim code object creation code as it is no longer needed. * Make lltrace a bit more robust w.r.t. non-standard frames.
* gh-104812: Run Pending Calls in any Thread (gh-104813)Eric Snow2023-06-131-0/+55
| | | For a while now, pending calls only run in the main thread (in the main interpreter). This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run.
* gh-105214: Use named constants for MAKE_FUNCTION oparg (#105215)Jelle Zijlstra2023-06-021-0/+1
|
* remove unused #includes of pycore_pymem.h (#105166)Irit Katriel2023-06-011-1/+0
|
* GH-104580: Don't cache eval breaker in interpreter (GH-104581)Mark Shannon2023-05-181-1/+0
| | | Move eval-breaker to the front of the interpreter state.
* GH-103082: Filter LINE events in VM, to simplify tool implementation. ↵Mark Shannon2023-05-121-0/+35
| | | | | | | | (GH-104387) When monitoring LINE events, instrument all instructions that can have a predecessor on a different line. Then check that the a new line has been hit in the instrumentation code. This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
* GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque ↵Mark Shannon2023-05-051-1/+2
| | | | for users of PEP 523. (GH-96849)
* gh-98003: Inline call frames for CALL_FUNCTION_EX (GH-98004)Ken Jin2023-04-301-0/+46
|
* gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)Carl Meyer2023-04-241-0/+1
| | | | | This speeds up `super()` (by around 85%, for a simple one-level `super().meth()` microbenchmark) by avoiding allocation of a new single-use `super()` object on each use.
* gh-84436: Implement Immortal Objects (gh-19474)Eddie Elizondo2023-04-221-2/+8
| | | | | | | | | This is the implementation of PEP683 Motivation: The PR introduces the ability to immortalize instances in CPython which bypasses reference counting. Tagging objects as immortal allows up to skip certain operations when we know that the object will be around for the entire execution of the runtime. Note that this by itself will bring a performance regression to the runtime due to the extra reference count checks. However, this brings the ability of having truly immutable objects that are useful in other contexts such as immutable data sharing between sub-interpreters.
* GH-100530: Change the error message for non-class class patterns (GH-103576)Nikita Sobolev2023-04-181-1/+1
|
* GH-103488: Use return-offset, not yield-offset. (GH-103502)Mark Shannon2023-04-131-1/+2
| | | | * Use return-offset, not yield-offset, so that instruction pointer is correct when sending to a generator or coroutine.
* GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython ↵Mark Shannon2023-04-121-537/+98
| | | | | | | | | | (GH-103083) * The majority of the monitoring code is in instrumentation.c * The new instrumentation bytecodes are in bytecodes.c * legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
* GH-100987: Don't cache references to the names and consts array in ↵Mark Shannon2023-03-131-7/+0
| | | | | | | `_PyEval_EvalFrameDefault`. (#102640) * Rename local variables, names and consts, from the interpeter loop. Will allow non-code objects in frames for better introspection of C builtins and extensions. * Remove unused dummy variables.
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-03-131-23/+19
| | | | (#102631)
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-02-281-33/+16
| | | | (in Python/) (#102193)
* gh-101101: Unstable C API tier (PEP 689) (GH-101102)Petr Viktorin2023-02-281-1/+1
|
* GH-100719: Remove redundant `gi_code` field from generator object. (GH-100749)Mark Shannon2023-02-231-37/+36
|
* gh-101903: Remove obsolete undefs for previously removed macros ↵Owain Davies2023-02-211-4/+0
| | | | Py_EnterRecursiveCall and Py_LeaveRecursiveCall (#101923)
* gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)Steve Dower2023-02-201-6/+6
| | | | | | * gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h * Make cases_generator correct on Windows
* gh-101967: add a missing error check (#101968)Eclips42023-02-181-1/+3
|
* gh-101758: Clean Up Uses of Import State (gh-101919)Eric Snow2023-02-151-1/+1
| | | | | | | | | | | | | | | This change is almost entirely moving code around and hiding import state behind internal API. We introduce no changes to behavior, nor to non-internal API. (Since there was already going to be a lot of churn, I took this as an opportunity to re-organize import.c into topically-grouped sections of code.) The motivation is to simplify a number of upcoming changes. Specific changes: * move existing import-related code to import.c, wherever possible * add internal API for interacting with import state (both global and per-interpreter) * use only API outside of import.c (to limit churn there when changing the location, etc.) * consolidate the import-related state of PyInterpreterState into a single struct field (this changes layout slightly) * add macros for import state in import.c (to simplify changing the location) * group code in import.c into sections *remove _PyState_AddModule() https://github.com/python/cpython/issues/101758
* gh-98831: Modernize CALL and family (#101508)Guido van Rossum2023-02-081-6/+0
| | | Includes a slight improvement to `DECREF_INPUTS()`.
* GH-101578: Normalize the current exception (GH-101607)Mark Shannon2023-02-081-7/+5
| | | | | | | | | | * Make sure that the current exception is always normalized. * Remove redundant type and traceback fields for the current exception. * Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException * Add new API functions: PyException_GetArgs, PyException_SetArgs
* gh-101072: support default and kw default in PyEval_EvalCodeEx for 3.11+ ↵Matthieu Dartiailh2023-02-071-3/+0
| | | | | (#101127) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* Fix some comments in ceval.c and fix lltrace output (#101297)Guido van Rossum2023-01-241-6/+4
| | | | | The comment at the top was rather outdated. :-) Also added a note about the dangers of dump_stack().
* gh-98831: rewrite CHECK_EG_MATCH opcode in the instruction definition DSL ↵Irit Katriel2023-01-241-1/+1
| | | | (#101269)
* GH-98831: Move assorted macros from ceval.h to a new header (#101116)Guido van Rossum2023-01-181-348/+1
|
* GH-100892: consolidate `HEAD_LOCK/HEAD_UNLOCK` macros (#100953)Kumar Aditya2023-01-151-5/+0
|
* GH-100126: Skip incomplete frames in more places (GH-100613)Brandt Bucher2023-01-091-7/+4
|
* gh-100758: Refactor initialisation of frame headers into a single function ↵Irit Katriel2023-01-061-4/+1
| | | | (_PyFrame_Initialize) (GH-100759)
* GH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)Mark Shannon2023-01-051-90/+1
| | | | | | | | * Remove PRINT_EXPR instruction * Remove STOPITERATION_ERROR instruction * Remove IMPORT_STAR instruction
* GH-100719: Remove the `co_nplaincellvars` field from code objects. (GH-100721)Mark Shannon2023-01-041-1/+1
|
* GH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code ↵Mark Shannon2022-12-141-2/+2
| | | | unit. (GH-100223)
* GH-99729: Unlink frames before clearing them (GH-100030)Brandt Bucher2022-12-061-9/+4
|
* gh-88226: Emit TARGET labels in Python/ceval.c when debugging, even if ↵Skip Montanaro2022-11-221-4/+21
| | | | | | | computed gotos aren't enabled (GH-98265) Keep target labels when debugging, but don't warn about lack of use. Co-authored-by: Eryk Sun <eryksun@gmail.com>