summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-91869: Fix tracing of specialized instructions with extended args (GH-91945)Dennis Sweeney2022-04-281-3/+4
|
* gh-91719: Add pycore_opcode.h internal header file (#91906)Victor Stinner2022-04-251-5/+6
| | | | | | | | | | | 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: Use a compact format to represent end line and column offsets. ↵Mark Shannon2022-04-211-163/+144
| | | | | | | | | | | | (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-46712: share more global strings in deepfreeze (gh-32152)Kumar Aditya2022-04-191-0/+3
| | | (for gh-90868)
* Fix an out of date comment in compile.c (GH-91615)Irit Katriel2022-04-161-1/+2
|
* gh-91276: Make JUMP_IF_TRUE_OR_POP/JUMP_IF_FALSE_OR_POP relative (GH-32215)Irit Katriel2022-04-151-0/+15
|
* Fill holes in internal compiler structs (#91458)L. A. F. Pereira2022-04-131-18/+18
|
* bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative (GH-32400)Irit Katriel2022-04-111-17/+74
|
* bpo-47120: make JUMP_NO_INTERRUPT relative (GH-32221)Irit Katriel2022-04-051-20/+29
|
* bpo-47186: Replace JUMP_IF_NOT_EG_MATCH by CHECK_EG_MATCH + jump (GH-32309)Irit Katriel2022-04-051-7/+21
|
* bpo-47172: Compiler enhancements (GH-32200)Irit Katriel2022-04-011-36/+41
| | | | | | | | * Make virtual opcodes negative. * Make is_jump detect only actual jumps. * Use is_block_push for the exception block setup opcodes.
* bpo-47186: Replace JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH + jump (GH-32231)Irit Katriel2022-04-011-4/+6
|
* bpo-47120: Replace the JUMP_ABSOLUTE opcode by the relative JUMP_BACKWARD ↵Irit Katriel2022-03-311-68/+88
| | | | (GH-32115)
* bpo-43224: Implement PEP 646 grammar changes (GH-31018)Matthew Rahtz2022-03-261-2/+12
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-46841: Quicken code in-place (GH-31888)Brandt Bucher2022-03-211-4/+4
| | | | | | | | | | | | | | | | | | | * 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.
* Use low bit of LOAD_GLOBAL's oparg to indicate whether it should push an ↵Mark Shannon2022-03-171-2/+13
| | | | additional NULL. (GH-31933)
* bpo-46841: Fix error message hacks in `GET_AWAITABLE` (GH-31664)Brandt Bucher2022-03-041-6/+6
|
* bpo-46831: Update __build_class__ comment (#31522)Shantanu2022-03-031-3/+2
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* compiler: Merge except_table and cnotab (GH-31614)Inada Naoki2022-03-011-0/+6
|
* bpo-46841: Move the cache for `LOAD_GLOBAL` inline. (GH-31575)Mark Shannon2022-02-281-2/+2
|
* bpo-46808: remove NEXT_BLOCK() from compile.c (GH-31448)Irit Katriel2022-02-251-63/+72
|
* bpo-46841: Use *inline* caching for `BINARY_OP` (GH-31543)Brandt Bucher2022-02-251-11/+47
|
* bpo-46765: Replace Locally Cached Strings with Statically Initialized ↵Eric Snow2022-02-231-31/+7
| | | | | Objects (gh-31366) https://bugs.python.org/issue46765
* bpo-46329: Streamline calling sequence a bit. (GH-31465)Mark Shannon2022-02-211-16/+7
| | | | | | | | | | | | | | * Move handling of bound-methods to PRECALL. * Remove call_shape.postcall_shrink * Remove call_shape.callable * Remove call_shape.callable. Change CALL oparg to match PRECALL oparg. * Move KW_NAMES before PRECALL. * Update opcode docs in dis.rst
* bpo-46329: Change calling sequence (again) (GH-31373)Mark Shannon2022-02-181-15/+17
| | | | * Change calling sequence: Add PUSH_NULL. Merge PRECALL_FUNCTION and PRECALL_METHOD into PRECALL.
* bpo-46724: Use `JUMP_ABSOLUTE` for all backward jumps. (GH-31326)Mark Shannon2022-02-151-0/+5
| | | | | | | | | * Make sure all backward jumps use JUMP_ABSOLUTE. * Add news. * Fix up news item. * Make test use consistent style.
* bpo-46541: Discover the global strings. (gh-31346)Eric Snow2022-02-151-0/+7
| | | | | | | Instead of manually enumerating the global strings in generate_global_objects.py, we extrapolate the list from usage of _Py_ID() and _Py_STR() in the source files. This is partly inspired by gh-31261. https://bugs.python.org/issue46541
* Remove unnecessary basic block from comprehensions (GH-31263)Brandt Bucher2022-02-141-6/+3
|
* bpo-46528: Attempt SWAPs at compile-time (GH-30970)Brandt Bucher2022-02-091-0/+67
|
* bpo-46528: Check PyMem_Malloc for NULL (GH-30998)Brandt Bucher2022-02-091-8/+15
|
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-081-86/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | global objects. (gh-30928) We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code. It is still used in a number of non-builtin stdlib modules. The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime. A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings). https://bugs.python.org/issue46541#msg411799 explains the rationale for this change. The core of the change is in: * (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros * Include/internal/pycore_runtime_init.h - added the static initializers for the global strings * Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState * Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings. That check is added to the PR CI config. The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()). This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *. The following are not changed (yet): * stop using _Py_IDENTIFIER() in the stdlib modules * (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API * (maybe) intern the strings during runtime init https://bugs.python.org/issue46541
* bpo-46670: Remove unused macros in the Python directory (GH-31192)Victor Stinner2022-02-071-13/+0
|
* bpo-45773: Remove invalid peephole optimizations (GH-31066)Brandt Bucher2022-02-031-2/+0
|
* bpo-46528: Simplify BUILD_TUPLE/UNPACK_SEQUENCE folding (GH-31039)Brandt Bucher2022-02-011-14/+7
|
* bpo-46329: Split calls into precall and call instructions. (GH-30855)Mark Shannon2022-01-281-26/+39
| | | | | | | | | | | | | | * 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-46458: emit code for else of a try block immediately after the try body ↵Irit Katriel2022-01-271-6/+7
| | | | (GH-30751)
* bpo-46528: Simplify the VM's stack manipulations (GH-30902)Brandt Bucher2022-01-261-105/+161
|
* bpo-43683: Streamline YIELD_VALUE and SEND (GH-30723)Mark Shannon2022-01-241-6/+19
| | | | | | | | * Split YIELD_VALUE into ASYNC_GEN_WRAP; YIELD_VALUE for async generators. * Split SEND into SEND; YIELD_VALUE. * Document new opcodes.
* bpo-46409: Make generators in bytecode (GH-30633)Mark Shannon2022-01-201-20/+36
| | | | | | | | | | | | * 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-46161: Fix bug in starunpack_helper in compile.c (GH-30235)zq19972022-01-171-1/+4
|
* bpo-46344: Fix trace bug in else of try and try-star blocks (GH-30544)Irit Katriel2022-01-131-2/+0
|
* bpo-46331: Do not set line number of instruction storing doc-string. (GH-30518)Mark Shannon2022-01-111-0/+1
|
* bpo-46314: Remove extra RESUME when compiling a lamdba. (GH-30513)Mark Shannon2022-01-101-144/+142
|
* bpo-46286: use the new POP_JUMP_IF_NOT_NONE opcode to simplify except* ↵Irit Katriel2022-01-061-6/+2
| | | | | (GH-30439) Automerge-Triggered-By: GH:iritkatriel
* bpo-45923: Handle call events in bytecode (GH-30364)Mark Shannon2022-01-061-27/+43
| | | | * Add a RESUME instruction to handle "call" events.
* bpo-46031: add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE (GH-30019)penguin_wwy2022-01-061-0/+27
|
* bpo-46009: Remove GEN_START (GH-30367)Brandt Bucher2022-01-041-17/+4
|
* bpo-46202: Remove opcode POP_EXCEPT_AND_RERAISE (GH-30302)Irit Katriel2022-01-041-11/+26
| | | | | | * bpo-46202: remove opcode POP_EXCEPT_AND_RERAISE * do not assume that an exception group is truthy
* bpo-46219, 46221: simplify except* implementation following exc_info ↵Irit Katriel2022-01-021-9/+16
| | | | changes. Move helpers to exceptions.c. Do not assume that exception groups are truthy. (GH-30289)
* bpo-45711: Remove type and traceback from exc_info (GH-30122)Irit Katriel2021-12-171-92/+64
| | | | | | | | * Do not PUSH/POP traceback or type to the stack as part of exc_info * Remove exc_traceback and exc_type from _PyErr_StackItem * Add to what's new, because this change breaks things like Cython