summaryrefslogtreecommitdiff
path: root/Objects/codeobject.c
Commit message (Collapse)AuthorAgeFilesLines
* GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython ↵Mark Shannon2023-04-121-69/+38
| | | | | | | | | | (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-101865: Deprecate `co_lnotab` from code objects as per PEP 626 (#101866)Nikita Sobolev2023-04-031-0/+5
| | | Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
* gh-102381: don't call watcher callback with dead object (#102382)Carl Meyer2023-03-071-1/+37
| | | Co-authored-by: T. Wouters <thomas@python.org>
* gh-101101: Unstable C API tier (PEP 689) (GH-101102)Petr Viktorin2023-02-281-4/+5
|
* gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)Steve Dower2023-02-201-10/+10
| | | | | | * gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h * Make cases_generator correct on Windows
* GH-100117: Make `co_lines` more efficient (GH-100447)Brandt Bucher2023-01-101-32/+18
|
* GH-100719: Remove the `co_nplaincellvars` field from code objects. (GH-100721)Mark Shannon2023-01-041-10/+4
|
* gh-94155: Reduce hash collisions for code objects (#100183)Dennis Sweeney2022-12-231-20/+33
| | | | | | | * Uses a better hashing algorithm to get better dispersion and remove commutativity. * Incorporates `co_firstlineno`, `Py_SIZE(co)`, and bytecode instructions. * This is now the entire set of criteria used in `code_richcompare`, except for `_PyCode_ConstantKey` (which would incorporate the types of `co_consts` rather than just their values).
* GH-100000: Cleanup and polish various watchers code (GH-99998)Itamar Ostricher2022-12-141-4/+11
| | | | | | * Initialize `type_watchers` array to `NULL`s * Optimize code watchers notification * Optimize func watchers notification
* GH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code ↵Mark Shannon2022-12-141-5/+6
| | | | unit. (GH-100223)
* GH-98522: Add version number to code objects. (GH-98525)Mark Shannon2022-12-091-2/+4
| | | | | | * Add version number to code object for better versioning of functions. * Improves specialization for closures and list comprehensions.
* GH-91054: Add code object watchers API (GH-99859)Itamar Ostricher2022-12-021-0/+63
| | | | | | * Add API to allow extensions to set callback function on creation and destruction of PyCodeObject Co-authored-by: Ye11ow-Flash <janshah@cs.stonybrook.edu>
* gh-99845: Clean up _PyObject_VAR_SIZE() usage (#99847)Victor Stinner2022-11-291-6/+4
| | | | | | * code_sizeof() now uses an unsigned type (size_t) to compute the result. * Fix _PyObject_ComputedDictPointer(): cast _PyObject_VAR_SIZE() to Py_ssize_t, rather than long: it's a different type on 64-bit Windows. * Clarify that _PyObject_VAR_SIZE() uses an unsigned type (size_t).
* gh-99300: Use Py_NewRef() in Objects/ directory (#99332)Victor Stinner2022-11-101-34/+17
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
* GH-96421: Insert shim frame on entry to interpreter (GH-96319)Mark Shannon2022-11-101-0/+75
| | | | | | * Adds EXIT_INTERPRETER instruction to exit PyEval_EvalDefault() * Simplifies RETURN_VALUE, YIELD_VALUE and RETURN_GENERATOR instructions as they no longer need to check for entry frames.
* GH-98686: Quicken everything (GH-98687)Brandt Bucher2022-11-021-10/+6
|
* gh-95756: Free and NULL-out code caches when needed (GH-98181)Ken Jin2022-10-111-0/+1
|
* gh-95756: Lazily created cached co_* attrs (GH-97791)Ken Jin2022-10-111-10/+67
|
* GH-97779: Ensure that *all* frame objects are backed by "complete" frames ↵Brandt Bucher2022-10-041-3/+19
| | | | (GH-97845)
* gh-94808: `_PyLineTable_StartsLine` was not used (GH-96609)Nikita Sobolev2022-10-031-27/+0
|
* GH-96187: Prevent _PyCode_GetExtra to return garbage for negative indexes ↵Pablo Galindo Salgado2022-08-231-1/+1
| | | | (GH-96188)
* gh-94936: C getters: co_varnames, co_cellvars, co_freevars (#95008)Ken Jin2022-08-041-0/+18
|
* GH-95150: Use position and exception tables for code hashing and equality ↵Brandt Bucher2022-08-011-1/+18
| | | | (GH-95509)
* GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121)Brandt Bucher2022-07-221-1/+1
|
* Fix PyCode_Addr2Location when addrq < 0 (GH-95091)Ken Jin2022-07-211-0/+1
|
* GH-94262: Don't create frame objects for frames that aren't yet complete. ↵Mark Shannon2022-07-011-6/+5
| | | | (GH-94371)
* gh-88116: Avoid undefined behavior when decoding varints in code objects ↵Pablo Galindo Salgado2022-06-281-8/+8
| | | | (#94375)
* gh-93382: Sync up `co_code` changes with 3.11 (GH-94227)Ken Jin2022-06-251-1/+1
| | | Sync up co_code changes with 3.11 commit 852b4d4bcd12b0b6839a015a262ce976b134f6f3.
* GH-93249: relax overly strict assertion on bounds->ar_start (GH-93961)Irit Katriel2022-06-201-1/+6
|
* GH-93516: Speedup line number checks when tracing. (GH-93763)Mark Shannon2022-06-201-0/+56
| | | | * Use a lookup table to reduce overhead of getting line numbers during tracing.
* GH-93897: Store frame size in code object and de-opt if insufficient space ↵Mark Shannon2022-06-201-0/+2
| | | | on thread frame stack. (GH-93908)
* GH-93516: Store offset of first traceable instruction in code object (GH-93769)Mark Shannon2022-06-141-0/+6
|
* gh-93728: fix memory leak in deepfrozen code objects (GH-93729)Kumar Aditya2022-06-121-0/+1
|
* gh-93382: Cache result of `PyCode_GetCode` in codeobject (GH-93383)Ken Jin2022-06-041-0/+7
| | | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* GH-92955: fix memory leak in code object lines and positions iterators ↵Kumar Aditya2022-05-191-4/+4
| | | | (gh-92956)
* gh-92031: Deoptimize Static Code at Finalization (GH-92039)Dennis Sweeney2022-05-031-10/+17
|
* gh-92154: Expose PyCode_GetCode in the C API (GH-92168)Ken Jin2022-05-031-0/+5
|
* gh-91719: Add pycore_opcode.h internal header file (#91906)Victor Stinner2022-04-261-0/+1
| | | | | | | | | | | Move the following API from Include/opcode.h (public C API) to a new Include/internal/pycore_opcode.h header file (internal C API): * EXTRA_CASES * _PyOpcode_Caches * _PyOpcode_Deopt * _PyOpcode_Jump * _PyOpcode_OpName * _PyOpcode_RelativeJump
* GH-88116: Document that PyCodeNew is dangerous, and make PyCode_NewEmpty ↵Mark Shannon2022-04-211-1/+15
| | | | less dangerous. (GH-91790)
* GH-88116: Use a compact format to represent end line and column offsets. ↵Mark Shannon2022-04-211-169/+318
| | | | | | | | | | | | (GH-91666) * Stores all location info in linetable to conform to PEP 626. * Remove column table from code objects. * Remove end-line table from code objects. * Document new location table format
* bpo-35134: Remove the Include/code.h header file (GH-32385)Victor Stinner2022-04-071-1/+0
| | | | | | Remove the Include/code.h header file. C extensions should only include the main <Python.h> header file. Python.h includes directly Include/cpython/code.h instead.
* bpo-46841: Use a `bytes` object for `_co_code_adaptive` (GH-32205)Brandt Bucher2022-04-011-2/+2
|
* bpo-46841: Avoid unnecessary allocations in code object comparisons (GH-32222)Brandt Bucher2022-04-011-13/+13
|
* bpo-46841: Quicken code in-place (GH-31888)Brandt Bucher2022-03-211-112/+101
| | | | | | | | | | | | | | | | | | | * Moves the bytecode to the end of the corresponding PyCodeObject, and quickens it in-place. * Removes the almost-always-unused co_varnames, co_freevars, and co_cellvars member caches * _PyOpcode_Deopt is a new mapping from all opcodes to their un-quickened forms. * _PyOpcode_InlineCacheEntries is renamed to _PyOpcode_Caches * _Py_IncrementCountAndMaybeQuicken is renamed to _PyCode_Warmup * _Py_Quicken is renamed to _PyCode_Quicken * _co_quickened is renamed to _co_code_adaptive (and is now a read-only memoryview). * Do not emit unused nonzero opargs anymore in the compiler.
* bpo-46841: Use inline caching for calls (GH-31709)Brandt Bucher2022-03-071-4/+1
|
* Propagate errors (however unlikely) from _Py_Deepfreeze_Init() (GH-31596)Kumar Aditya2022-02-261-5/+11
|
* bpo-45316: Move private PyCode C API to internal C API (GH-31576)Victor Stinner2022-02-251-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename private functions (no exported), add an underscore prefix: * PyLineTable_InitAddressRange() => _PyLineTable_InitAddressRange() * PyLineTable_NextAddressRange() => _PyLineTable_NextAddressRange() * PyLineTable_PreviousAddressRange() => _PyLineTable_PreviousAddressRange() Move private functions to the internal C API: * _PyCode_Addr2EndLine() * _PyCode_Addr2EndOffset() * _PyCode_Addr2Offset() * _PyCode_InitAddressRange() * _PyCode_InitEndAddressRange( * _PyLineTable_InitAddressRange() * _PyLineTable_NextAddressRange() * _PyLineTable_PreviousAddressRange() No longer export the following internal functions: * _PyCode_GetVarnames() * _PyCode_GetCellvars() * _PyCode_GetFreevars() * _Py_GetSpecializationStats() Add "extern" to pycore_code.h functions to identify them more easiliy (they are still not exported).
* Add (undocumented) _co_quickened attribute for code object. (GH-31552)Mark Shannon2022-02-241-2/+13
|
* bpo-46765: Replace Locally Cached Strings with Statically Initialized ↵Eric Snow2022-02-221-6/+1
| | | | | Objects (gh-31366) https://bugs.python.org/issue46765
* bpo-46745: Fix typo in PositionsIterator (#31322)Robert-André Mauchin2022-02-161-1/+1
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>