summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* bpo-46039: Split yield from in two (GH-30035)Mark Shannon2021-12-151-16/+39
| | | | | | * Split YIELD_FROM opcode into SEND and JUMP_ABSOLUTE. * Remove YIELD_FROM opcode.
* bpo-44525: Split calls into PRECALL and CALL (GH-30011)Mark Shannon2021-12-141-15/+16
| | | | | | | | | | * Add 3 new opcodes for calls: PRECALL_METHOD, CALL_NO_KW, CALL_KW. * Update specialization to handle new CALL opcodes. * Specialize call to method descriptors. * Remove old CALL opcodes: CALL_FUNCTION, CALL_METHOD, CALL_METHOD_KW, CALL_FUNCTION_KW.
* bpo-45292: [PEP-654] add except* (GH-29581)Irit Katriel2021-12-141-1/+338
|
* bpo-37971: fix the position of decorator application (GH-30027)Carl Friedrich Bolz-Tereick2021-12-101-8/+25
| | | | | | | The line numbers of actually calling the decorator functions of functions and classes was wrong (as opposed to loading them, were they have been correct previously too). Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* Delete orphaned comment (#29917)Guido van Rossum2021-12-051-5/+0
| | | (The function this described was deleted by PR #23743, the comment was accidentally retained.)
* bpo-44525: Copy free variables in bytecode to allow calls to inner functions ↵Mark Shannon2021-11-231-2/+19
| | | | | | | | | | | 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.
* Fix link to exception handling notes (GH-29617)Irit Katriel2021-11-191-1/+1
|
* bpo-45773: Stop "optimizing" certain jump patterns (GH-29505)Brandt Bucher2021-11-111-76/+41
|
* bpo-45636: Merge all numeric operators (GH-29482)Brandt Bucher2021-11-111-106/+59
|
* bpo-45711: remove unnecessary DUP_TOP and POP in exception handling (GH-29495)Irit Katriel2021-11-101-6/+4
|
* bpo-44511: Improve the bytecode for class and mapping patterns (GH-26922)Brandt Bucher2021-10-271-29/+44
| | | | | | | * Refactor mapping patterns and speed up class patterns. * Simplify MATCH_KEYS and MATCH_CLASS. * Add COPY opcode.
* Fix typos in the Python directory (GH-28767)Christian Clauss2021-10-061-2/+2
|
* Normalize jumps in compiler. All forward jumps to use JUMP_FORWARD. (GH-28755)Mark Shannon2021-10-061-0/+23
|
* bpo-45355: More use of sizeof(_Py_CODEUNIT) (GH-28720)Serhiy Storchaka2021-10-041-1/+1
|
* bpo-45152: Add HAS_CONST macro and get_const_value() function and use… ↵Irit Katriel2021-09-141-7/+39
| | | | (#28262)
* bpo-45056: Remove trailing unused constants from co_consts (GH-28109)Inada Naoki2021-09-021-0/+33
|
* bpo-45039: Consistently use ADDOP_LOAD_CONST in compiler rather than ↵Irit Katriel2021-08-311-2/+4
| | | | ADDOP_O(c, LOAD_CONST,...) (GH-28015)
* bpo-45000: Raise SyntaxError when try to delete __debug__ (GH-27947)Dong-hee Na2021-08-251-0/+4
| | | Automerge-Triggered-By: GH:pablogsal
* Remove unused variable. (GH-27677)Mark Shannon2021-08-091-3/+0
|
* bpo-44840: Compiler: Move duplication of exit blocks with no line numbers to ↵Mark Shannon2021-08-091-16/+25
| | | | after CFG optimization. (GH-27656)
* bpo-44600: Fix line numbers for pattern matching cleanup code (GH-27346)Charles Burkland2021-07-251-4/+12
|
* bpo-44626: Merge basic blocks earlier to enable better handling of exit ↵Mark Shannon2021-07-151-16/+48
| | | | blocks without line numbers (GH-27138)
* bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. ↵Mark Shannon2021-07-151-1/+3
| | | | (GH-27160)