summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)Ken Jin2022-12-231-0/+25
|
* gh-99761: Add `_PyLong_IsPositiveSingleDigit` function to check for single ↵Pieter Eendebak2022-12-221-5/+3
| | | | digit integers (#100064)
* GH-98831: Add DECREF_INPUTS(), expanding to DECREF() each stack input (#100205)Guido van Rossum2022-12-171-18/+13
| | | | | | | | | | | | | | | | | | | The presence of this macro indicates that a particular instruction may be considered for conversion to a register-based format (see https://github.com/faster-cpython/ideas/issues/485). An invariant (currently unchecked) is that `DEOPT_IF()` may only occur *before* `DECREF_INPUTS()`, and `ERROR_IF()` may only occur *after* it. One reason not to check this is that there are a few places where we insert *two* `DECREF_INPUTS()` calls, in different branches of the code. The invariant checking would have to be able to do some flow control analysis to understand this. Note that many instructions, especially specialized ones, can't be converted to use this macro straightforwardly. This is because the generator currently only generates plain `Py_DECREF(variable)` statements, and cannot generate things like `_Py_DECREF_SPECIALIZED()` let alone deal with `_PyList_AppendTakeRef()`.
* GH-90043: Handle NaNs in COMPARE_OP_FLOAT_JUMP (GH-100278)Brandt Bucher2022-12-161-7/+5
|
* GH-98522: Add version number to code objects. (GH-98525)Mark Shannon2022-12-091-0/+1
| | | | | | * Add version number to code object for better versioning of functions. * Improves specialization for closures and list comprehensions.
* GH-100110: Specialize FOR_ITER for tuples (GH-100109)Ken Jin2022-12-091-0/+23
| | | * Specialize FOR_ITER for tuples
* GH-98831: Typed stack effects, and more instructions converted (#99764)Guido van Rossum2022-12-081-225/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stack effects can now have a type, e.g. `inst(X, (left, right -- jump/uint64_t)) { ... }`. Instructions converted to the non-legacy format: * COMPARE_OP * COMPARE_OP_FLOAT_JUMP * COMPARE_OP_INT_JUMP * COMPARE_OP_STR_JUMP * STORE_ATTR * DELETE_ATTR * STORE_GLOBAL * STORE_ATTR_INSTANCE_VALUE * STORE_ATTR_WITH_HINT * STORE_ATTR_SLOT, and complete the store_attr family * Complete the store_subscr family: STORE_SUBSCR{,DICT,LIST_INT} (STORE_SUBSCR was alread half converted, but wasn't using cache effects yet.) * DELETE_SUBSCR * PRINT_EXPR * INTERPRETER_EXIT (a bit weird, ends in return) * RETURN_VALUE * GET_AITER (had to restructure it some) The original had mysterious `SET_TOP(NULL)` before `goto error`. I assume those just account for `obj` having been decref'ed, so I got rid of them in favor of the cleanup implied by `ERROR_IF()`. * LIST_APPEND (a bit unhappy with it) * SET_ADD (also a bit unhappy with it) Various other improvements/refactorings as well.
* GH-99729: Unlink frames before clearing them (GH-100030)Brandt Bucher2022-12-061-1/+4
|
* gh-89189: More compact range iterator (GH-27986)Serhiy Storchaka2022-11-301-3/+4
|
* GH-98831: Add `macro` and `op` and their implementation to DSL (#99495)Guido van Rossum2022-11-231-19/+13
| | | | | | | | | | | | | | Newly supported interpreter definition syntax: - `op(NAME, (input_stack_effects -- output_stack_effects)) { ... }` - `macro(NAME) = OP1 + OP2;` Also some other random improvements: - Convert `WITH_EXCEPT_START` to use stack effects - Fix lexer to balk at unrecognized characters, e.g. `@` - Fix moved output names; support object pointers in cache - Introduce `error()` method to print errors - Introduce read_uint16(p) as equivalent to `*p` Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* GH-98831: Refactor and fix cases generator (#99526)Guido van Rossum2022-11-181-38/+25
| | | | Also complete cache effects for BINARY_SUBSCR family.
* GH-99298: Clean up attribute specializations (GH-99398)Brandt Bucher2022-11-171-10/+2
|
* GH-98686: Get rid of BINARY_OP_GENERIC and COMPARE_OP_GENERIC (GH-99399)Brandt Bucher2022-11-171-31/+20
|
* Add a macro for "inlining" new frames (GH-99490)Brandt Bucher2022-11-171-43/+9
|
* GH-98831: Implement basic cache effects (#99313)Guido van Rossum2022-11-161-39/+30
|
* gh-99460 Emscripten trampolines on optimized METH_O and METH_NOARGS code ↵Hood Chatham2022-11-151-3/+3
| | | | paths (#99461)
* GH-98831: Remove all remaining DISPATCH() calls from bytecodes.c (#99271)Guido van Rossum2022-11-101-94/+88
| | | | | Also mark those opcodes that have no stack effect as such. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* GH-99298: Don't perform jumps before error handling (GH-99299)Brandt Bucher2022-11-101-15/+19
|
* GH-96421: Insert shim frame on entry to interpreter (GH-96319)Mark Shannon2022-11-101-80/+61
| | | | | | * 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-99300: Use Py_NewRef() in Python/ceval.c (#99318)Victor Stinner2022-11-101-56/+30
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Python/ceval.c and related files.
* GH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182)Brandt Bucher2022-11-091-207/+116
|
* GH-98831: Simple input-output stack effects for bytecodes.c (#99120)Guido van Rossum2022-11-081-192/+88
|
* GH-96793: Specialize FOR_ITER for generators. (GH-98772)Mark Shannon2022-11-071-4/+40
|
* GH-98831: Implement super-instruction generation (#99084)Guido van Rossum2022-11-061-61/+6
| | | Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
* GH-99104: Update headers for bytecodes.c and generate_cases.py (#99112)Guido van Rossum2022-11-051-7/+16
| | | Also tweak the labels near the end of bytecodes.c.
* GH-98831: Add some macros definitions to bytecodes.c to reduce IDE warnings. ↵Mark Shannon2022-11-041-2/+29
| | | | (#99093)
* GH-98831: Auto-generate PREDICTED() macro calls (#99102)Guido van Rossum2022-11-041-16/+0
| | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* GH-96793: Implement PEP 479 in bytecode. (GH-99006)Mark Shannon2022-11-031-0/+43
| | | | | * Handle converting StopIteration to RuntimeError in bytecode. * Add custom instruction for converting StopIteration into RuntimeError.
* GH-98831: "Generate" the interpreter (#98830)Guido van Rossum2022-11-031-0/+4006
The switch cases (really TARGET(opcode) macros) have been moved from ceval.c to generated_cases.c.h. That file is generated from instruction definitions in bytecodes.c (which impersonates a C file so the C code it contains can be edited without custom support in e.g. VS Code). The code generator lives in Tools/cases_generator (it has a README.md explaining how it works). The DSL used to describe the instructions is a work in progress, described in https://github.com/faster-cpython/ideas/blob/main/3.12/interpreter_definition.md. This is surely a work-in-progress. An easy next step could be auto-generating super-instructions. **IMPORTANT: Merge Conflicts** If you get a merge conflict for instruction implementations in ceval.c, your best bet is to port your changes to bytecodes.c. That file looks almost the same as the original cases, except instead of `TARGET(NAME)` it uses `inst(NAME)`, and the trailing `DISPATCH()` call is omitted (the code generator adds it automatically).