summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_frame.h
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-99110: Initialize frame->previous in init_frame to fix ↵Bill Fisher2022-12-241-1/+4
| | | | | | | segmentation fault (GH-100182) (#100478) (cherry picked from commit 88d565f32a709140664444c6dea20ecd35a10e94) Co-authored-by: Bill Fisher <william.w.fisher@gmail.com>
* [3.11] GH-96569: Avoid undefined behavior (#96616)Mark Shannon2022-09-081-8/+16
| | | Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* [3.11] GH-94262: Don't create frame objects for frames that aren't yet ↵Miss Islington (bot)2022-07-041-0/+17
| | | | | complete. (GH-94371) (#94482) Co-authored-by: Mark Shannon <mark@hotpy.org>
* GH-89480: Document motivation, design and implementation of 3.11 frame ↵Mark Shannon2022-04-111-0/+8
| | | | stack. (GH-32304)
* bpo-47177: Replace `f_lasti` with `prev_instr` (GH-32208)Brandt Bucher2022-04-071-7/+10
|
* Revert "bpo-44800: Document internal frame naming conventions (GH-32281)" ↵Mark Shannon2022-04-041-69/+0
| | | | | (#32301) This reverts commit 124227c95f310d2ecd4b567271ab1919fc7000cb.
* bpo-44800: Document internal frame naming conventions (GH-32281)Nick Coghlan2022-04-031-0/+69
| | | | | | | | | | The fact interpreter frames were split out from full frame objects rather than always being part of the eval loop implementation means that it's tricky to infer the expected naming conventions simply from looking at the code. Documenting the de facto conventions in pycore_frame.h means future readers of the code will have a clear explanation of the rationale for those conventions (i.e. minimising non-functional code churn).
* bpo-42197: Don't create `f_locals` dictionary unless we actually need it. ↵Mark Shannon2022-03-251-0/+1
| | | | | | | | | | | (GH-32055) * `PyFrame_FastToLocalsWithError` and `PyFrame_LocalsToFast` are no longer called during profile and tracing. (Contributed by Fabio Zadrozny) * Make accesses to a frame's `f_locals` safe from C code, not relying on calls to `PyFrame_FastToLocals` or `PyFrame_LocalsToFast`. * Document new `PyFrame_GetLocals` C-API function.
* bpo-47045: Remove `f_state` field (GH-31963)Mark Shannon2022-03-221-26/+20
| | | | | * Remove the f_state field from _PyInterpreterFrame * Make ownership of the frame explicit, replacing the is_generator field with an owner field.
* bpo-45786: Remove _PyFrame_Fini() and _PyFrame_DebugMallocStats() (GH-31874)Victor Stinner2022-03-181-4/+0
| | | | Remove private empty _PyFrame_Fini() and _PyFrame_DebugMallocStats() functions.
* bpo-45431: Rename CFrame to _PyCFrame in the C API (GH-31584)Victor Stinner2022-02-281-1/+1
| | | | | | Rename also struct _cframe to struct _PyCFrame. Add a comment suggesting using public functions rather than using directly the private _PyCFrame structure.
* bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame (GH-31583)Victor Stinner2022-02-251-29/+29
| | | | | Rename also struct _interpreter_frame to struct _PyInterpreterFrame. Reduce risk of name conflicts if a project includes pycore_frame.h.
* bpo-45316: Move private functions to internal C API (GH-31579)Victor Stinner2022-02-251-0/+2
| | | | | | | | | Move the unexported private functions to the internal C API: * pycore_frame.h: _PyFrame_New_NoTrack() * pycore_function.h: _PyFunction_GetVersionForCurrentState() * pycore_genobject.h: _PyAsyncGenValueWrapperNew() * pycore_genobject.h: _PyCoro_GetAwaitableIter() * pycore_genobject.h: _PyGen_yf()
* bpo-46836: Move PyFrameObject to pycore_frame.h (GH-31530)Victor Stinner2022-02-251-0/+12
| | | | Move the PyFrameObject type definition (struct _frame) to the internal C API pycore_frame.h header file.
* Pass reference to func, as well as args, when pushing frame. (GH-31100)Mark Shannon2022-02-031-4/+2
|
* bpo-46329: Split calls into precall and call instructions. (GH-30855)Mark Shannon2022-01-281-0/+3
| | | | | | | | | | | | | | * Add PRECALL_FUNCTION opcode. * Move 'call shape' varaibles into struct. * Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions. * Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol. * Allow kwnames for specialized calls to builtin types. * Specialize calls to tuple(arg) and str(arg).
* bpo-46409: Make generators in bytecode (GH-30633)Mark Shannon2022-01-201-2/+2
| | | | | | | | | | | | * Add RETURN_GENERATOR and JUMP_NO_INTERRUPT opcodes. * Trim frame and generator by word each. * Minor refactor of frame.c * Update test.test_sys to account for smaller frames. * Treat generator functions as normal functions when evaluating and specializing.
* bpo-45256: Don't track the exact depth of each `InterpreterFrame` (GH-30372)Brandt Bucher2022-01-051-2/+4
|
* bpo-46090: Allow PyThreadState.datastack_* members to be NULL (GH-30234)Brandt Bucher2021-12-281-4/+7
|
* bpo-46039: Split yield from in two (GH-30035)Mark Shannon2021-12-151-0/+1
| | | | | | * Split YIELD_FROM opcode into SEND and JUMP_ABSOLUTE. * Remove YIELD_FROM opcode.
* bpo-46008: Make runtime-global object/type lifecycle functions and state ↵Eric Snow2021-12-091-0/+8
| | | | | | | | | | | | consistent. (gh-29998) This change is strictly renames and moving code around. It helps in the following ways: * ensures type-related init functions focus strictly on one of the three aspects (state, objects, types) * passes in PyInterpreterState * to all those functions, simplifying work on moving types/objects/state to the interpreter * consistent naming conventions help make what's going on more clear * keeping API related to a type in the corresponding header file makes it more obvious where to look for it https://bugs.python.org/issue46008
* bpo-45963: Make space for the InterpreterFrame of a generator in that ↵Mark Shannon2021-12-061-1/+1
| | | | | | | generator. (GH-29891) * Make generator, coroutine and async gen structs all the same size. * Store interpreter frame in generator (and coroutine). Reduces the number of allocations neeeded for a generator from two to one.
* bpo-45753: Interpreter internal tweaks (GH-29575)Mark Shannon2021-12-011-0/+5
| | | | | | | | | | * Split exit paths into exceptional and non-exceptional. * Move exit tracing code to individual bytecodes. * Wrap all trace entry and exit events in macros to make them clearer and easier to enhance. * Move return sequence into RETURN_VALUE, YIELD_VALUE and YIELD_FROM. Distinguish between normal trace events and dtrace events.
* bpo-45786: Allocate space for frame in frame object. (GH-29729)Mark Shannon2021-11-291-4/+3
|
* bpo-44525: Copy free variables in bytecode to allow calls to inner functions ↵Mark Shannon2021-11-231-13/+15
| | | | | | | | | | | to be specialized (GH-29595) * Make internal APIs that take PyFrameConstructor take a PyFunctionObject instead. * Add reference to function to frame, borrow references to builtins and globals. * Add COPY_FREE_VARS instruction to allow specialization of calls to inner functions.
* bpo-45256: Rationalize code around Python-to-Python calls a bit. (GH-29235)Mark Shannon2021-10-281-0/+15
|
* bpo-45256: Remove the usage of the C stack in Python to Python calls (GH-28488)Pablo Galindo Salgado2021-10-091-0/+2
| | | | Ths commit inlines calls to Python functions in the eval loop and steals all the arguments in the call from the caller for performance.
* Fix typos in the Include directory (GH-28745)Christian Clauss2021-10-061-1/+1
|
* bpo-44990: Change layout of evaluation frames. "Layout B" (GH-27933)Mark Shannon2021-08-251-7/+37
| | | Places the locals between the specials and stack. This is the more "natural" layout for a C struct, makes the code simpler and gives a slight speedup (~1%)
* bpo-44590: Lazily allocate frame objects (GH-27077)Mark Shannon2021-07-261-22/+104
| | | | | | | | | | | | | | * Convert "specials" array to InterpreterFrame struct, adding f_lasti, f_state and other non-debug FrameObject fields to it. * Refactor, calls pushing the call to the interpreter upward toward _PyEval_Vector. * Compute f_back when on thread stack, only filling in value when frame object outlives stack invocation. * Move ownership of InterpreterFrame in generator from frame object to generator object. * Do not create frame objects for Python calls. * Do not create frame objects for generators.
* bpo-44032: Move pointer to code object from frame-object to frame specials ↵Mark Shannon2021-06-181-1/+9
| | | | array. (GH-26771)
* bpo-43693: Eliminate unused "fast locals". (gh-26587)Eric Snow2021-06-151-2/+0
| | | | | Currently, if an arg value escapes (into the closure for an inner function) we end up allocating two indices in the fast locals even though only one gets used. Additionally, using the lower index would be better in some cases, such as with no-arg `super()`. To address this, we update the compiler to fix the offsets so each variable only gets one "fast local". As a consequence, now some cell offsets are interspersed with the locals (only when an arg escapes to an inner function). https://bugs.python.org/issue43693
* bpo-43693: Un-revert commit f3fa63e. (#26609)Eric Snow2021-06-081-0/+2
| | | | | | | | | This was reverted in GH-26596 (commit 6d518bb) due to some bad memory accesses. * Add the MAKE_CELL opcode. (gh-26396) The memory accesses have been fixed. https://bugs.python.org/issue43693
* Revert "bpo-43693: Add the MAKE_CELL opcode and interleave fast locals ↵Pablo Galindo2021-06-081-2/+0
| | | | | offsets. (gh-26396)" (GH-26597) This reverts commit 631f9938b1604d4f893417ec339b9e0fa9196fb1.
* bpo-43693: Add the MAKE_CELL opcode and interleave fast locals offsets. ↵Eric Snow2021-06-071-0/+2
| | | | | | | (gh-26396) This moves logic out of the frame initialization code and into the compiler and eval loop. Doing so simplifies the runtime code and allows us to optimize it better. https://bugs.python.org/issue43693
* bpo-44032: Move data stack to thread from FrameObject. (GH-26076)Mark Shannon2021-05-211-0/+38
* Remove 'zombie' frames. We won't need them once we are allocating fixed-size frames. * Add co_nlocalplus field to code object to avoid recomputing size of locals + frees + cells. * Move locals, cells and freevars out of frame object into separate memory buffer. * Use per-threadstate allocated memory chunks for local variables. * Move globals and builtins from frame object to per-thread stack. * Move (slow) locals frame object to per-thread stack. * Move internal frame functions to internal header.