aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/bytecodes.c
Commit message (Collapse)AuthorAge
* GH-109329: Add tier 2 stats (GH-109913)Michael Droettboom2023-10-04
|
* GH-109369: Merge all eval-breaker flags and monitoring version into one ↵Mark Shannon2023-10-04
| | | | word. (GH-109846)
* gh-104909: Split more LOAD_ATTR specializations (GH-110317)Guido van Rossum2023-10-04
| | | | | | | | | | | | | | | | | | | * Split LOAD_ATTR_MODULE * Split LOAD_ATTR_WITH_HINT * Split _GUARD_TYPE_VERSION out of the latter * Split LOAD_ATTR_CLASS * Split LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES * Fix indent of DEOPT_IF in macros * Split LOAD_ATTR_METHOD_LAZY_DICT * Split LOAD_ATTR_NONDESCRIPTOR_NO_DICT * Fix omission of _CHECK_ATTR_METHOD_LAZY_DICT
* gh-109979: Unify _GUARD_TYPE_VERSION{,_STORE} (#110301)Guido van Rossum2023-10-03
| | | | | Now the target for `DEOPT_IF()` is auto-filled, we don't need a separate `_GUARD_TYPE_VERSION_STORE` uop.
* gh-109979: Auto-generate the target for DEOPT_IF() (#110193)Guido van Rossum2023-10-03
| | | | | | | | | | | | | | | | In Python/bytecodes.c, you now write ``` DEOPT_IF(condition); ``` The code generator expands this to ``` DEOPT_IF(condition, opcode); ``` where `opcode` is the name of the unspecialized instruction. This works inside macro expansions too. **CAVEAT:** The entire `DEOPT_IF(condition)` statement must be on a single line. If it isn't, the substitution will fail; an error will be printed by the code generator and the C compiler will report some errors.
* gh-110020: Fix unused variable warnings in bytecodes.c (GH-110023)Nikita Sobolev2023-09-28
|
* gh-104909: Split some more insts into ops (#109943)Guido van Rossum2023-09-27
| | | | | | | | | | | | | | | | | | | | These are the most popular specializations of `LOAD_ATTR` and `STORE_ATTR` that weren't already viable uops: * Split LOAD_ATTR_METHOD_WITH_VALUES * Split LOAD_ATTR_METHOD_NO_DICT * Split LOAD_ATTR_SLOT * Split STORE_ATTR_SLOT * Split STORE_ATTR_INSTANCE_VALUE Also: * Add `-v` flag to code generator which prints a list of non-viable uops (easter-egg: it can print execution counts -- see source) * Double _Py_UOP_MAX_TRACE_LENGTH to 128 I had dropped one of the DEOPT_IF() calls! :-(
* GH-104584: Don't call executors from JUMP_BACKWARD (GH-109347)Brandt Bucher2023-09-13
|
* GH-105848: Replace KW_NAMES + CALL with LOAD_CONST + CALL_KW (GH-109300)Brandt Bucher2023-09-13
|
* gh-109216: Fix possible memory leak in `BUILD_MAP` (#109257)Nikita Sobolev2023-09-12
|
* gh-109214: Rename SAVE_IP to _SET_IP, and similar (#109285)Guido van Rossum2023-09-11
| | | | | | | | * Rename SAVE_IP to _SET_IP * Rename EXIT_TRACE to _EXIT_TRACE * Rename SAVE_CURRENT_IP to _SAVE_CURRENT_IP * Rename INSERT to _INSERT (This is for Ken Jin's abstract interpreter) * Rename IS_NONE to _IS_NONE * Rename JUMP_TO_TOP to _JUMP_TO_TOP
* gh-109039: Branch prediction for Tier 2 interpreter (#109038)Guido van Rossum2023-09-11
| | | | | | | | | | | This adds a 16-bit inline cache entry to the conditional branch instructions POP_JUMP_IF_{FALSE,TRUE,NONE,NOT_NONE} and their instrumented variants, which is used to keep track of the branch direction. Each time we encounter these instructions we shift the cache entry left by one and set the bottom bit to whether we jumped. Then when it's time to translate such a branch to Tier 2 uops, we use the bit count from the cache entry to decided whether to continue translating the "didn't jump" branch or the "jumped" branch. The counter is initialized to a pattern of alternating ones and zeros to avoid bias. The .pyc file magic number is updated. There's a new test, some fixes for existing tests, and a few miscellaneous cleanups.
* gh-109118: Fix runtime crash when NameError happens in PEP 695 function ↵Jelle Zijlstra2023-09-09
| | | | (#109123)
* GH-108614: Unbreak emscripten build (GH-109132)Mark Shannon2023-09-08
|
* GH-108614: Add `RESUME_CHECK` instruction (GH-108630)Mark Shannon2023-09-07
|
* GH-108614: Remove `TIER_ONE` and `TIER_TWO` from `_PUSH_FRAME` (GH-108725)Mark Shannon2023-09-04
|
* GH-108614: Remove non-debug uses of `#if TIER_ONE` and `#if TIER_TWO` from ↵Mark Shannon2023-08-31
| | | | `_POP_FRAME` op. (GH-108685)
* gh-108487: Move assert(self != NULL) down beyond DEOPT_IF() (#108510)Guido van Rossum2023-08-28
|
* GH-106581: Fix instrumentation in tier 2 (GH-108493)Brandt Bucher2023-08-25
|
* gh-106581: Split CALL_BOUND_METHOD_EXACT_ARGS into uops (#108462)Guido van Rossum2023-08-24
| | | Instead of using `GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS)` we just add the macro elements of the latter to the macro for the former. This requires lengthening the uops array in struct opcode_macro_expansion. (It also required changes to stacking.py that were merged already.)
* gh-106581: Project through calls (#108067)Guido van Rossum2023-08-17
| | | | This finishes the work begun in gh-107760. When, while projecting a superblock, we encounter a call to a short, simple function, the superblock will now enter the function using `_PUSH_FRAME`, continue through it, and leave it using `_POP_FRAME`, and then continue through the original code. Multiple frame pushes and pops are even possible. It is also possible to stop appending to the superblock in the middle of a called function, when running out of space or encountering an unsupported bytecode.
* GH-108035: Remove the `_PyCFrame` struct as it is no longer needed for ↵Mark Shannon2023-08-17
| | | | performance. (GH-108036)
* gh-106581: Split `CALL_PY_EXACT_ARGS` into uops (#107760)Guido van Rossum2023-08-16
| | | | | | | | | | | | * Split `CALL_PY_EXACT_ARGS` into uops This is only the first step for doing `CALL` in Tier 2. The next step involves tracing into the called code object and back. After that we'll have to do the remaining `CALL` specialization. Finally we'll have to deal with `KW_NAMES`. Note: this moves setting `frame->return_offset` directly in front of `DISPATCH_INLINED()`, to make it easier to move it into `_PUSH_FRAME`.
* gh-105481: generate op IDs from bytecode.c instead of hard coding them in ↵Irit Katriel2023-08-16
| | | | opcode.py (#107971)
* gh-107557: Setup abstract interpretation (#107847)Ken Jin2023-08-15
| | | | Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com> Co-authored-by: Jules <57632293+juliapoo@users.noreply.github.com>
* GH-106485: Dematerialize instance dictionaries when possible (GH-106539)Brandt Bucher2023-08-09
|
* GH-105848: Simplify the arrangement of CALL's stack (GH-107788)Brandt Bucher2023-08-09
|
* GH-107596: Specialize str[int] (GH-107597)Brandt Bucher2023-08-08
|
* GH-107263: Increase C stack limit for most functions, except ↵Mark Shannon2023-08-04
| | | | | | `_PyEval_EvalFrameDefault()` (GH-107535) * Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2.
* Use tstate->interp to get the interpreter state in bytecodes.c (GH-107506)Brandt Bucher2023-07-31
|
* GH-104909: Move unused cache entries from uops to macros (#107444)Guido van Rossum2023-07-31
| | | | | | There's no need to use a dummy uop to skip unused cache entries. The macro syntax lets you write `unused/1` instead. Similarly, move `unused/5` from op `_LOAD_ATTR_INSTANCE_VALUE` to macro `LOAD_ATTR_INSTANCE_VALUE`.
* GH-106895: Raise a `ValueError` when attempting to disable events that ↵Mark Shannon2023-07-27
| | | | cannot be disabled. (GH-107337)
* GH-106897: Add `RERAISE` event to `sys.monitoring`. (GH-107291)Mark Shannon2023-07-27
| | | * Ensures that exception handling events are balanced. Each [re]raise event has a matching unwind/handled event.
* gh-106869: Use new PyMemberDef constant names (#106871)Victor Stinner2023-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove '#include "structmember.h"'. * If needed, add <stddef.h> to get offsetof() function. * Update Parser/asdl_c.py to regenerate Python/Python-ast.c. * Replace: * T_SHORT => Py_T_SHORT * T_INT => Py_T_INT * T_LONG => Py_T_LONG * T_FLOAT => Py_T_FLOAT * T_DOUBLE => Py_T_DOUBLE * T_STRING => Py_T_STRING * T_OBJECT => _Py_T_OBJECT * T_CHAR => Py_T_CHAR * T_BYTE => Py_T_BYTE * T_UBYTE => Py_T_UBYTE * T_USHORT => Py_T_USHORT * T_UINT => Py_T_UINT * T_ULONG => Py_T_ULONG * T_STRING_INPLACE => Py_T_STRING_INPLACE * T_BOOL => Py_T_BOOL * T_OBJECT_EX => Py_T_OBJECT_EX * T_LONGLONG => Py_T_LONGLONG * T_ULONGLONG => Py_T_ULONGLONG * T_PYSSIZET => Py_T_PYSSIZET * T_NONE => _Py_T_NONE * READONLY => Py_READONLY * PY_AUDIT_READ => Py_AUDIT_READ * READ_RESTRICTED => Py_AUDIT_READ * PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED * RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
* gh-106917: fix super classmethod calls to non-classmethods (#106977)Carl Meyer2023-07-24
|
* gh-106320: Move private _PySet API to the internal API (#107041)Victor Stinner2023-07-22
| | | | | | | | * Add pycore_setobject.h header file. * Move the following API to the internal C API: * _PySet_Dummy * _PySet_NextEntry() * _PySet_Update()
* GH-106701: Move _PyUopExecute to Python/executor.c (GH-106924)Brandt Bucher2023-07-20
|
* gh-105481: do not auto-generate pycore_intrinsics.h (#106913)Irit Katriel2023-07-20
|
* GH-104584: Miscellaneous fixes for -Xuops (GH-106908)Brandt Bucher2023-07-20
|
* gh-105481: Generate the opcode lists in dis from data extracted from ↵Irit Katriel2023-07-18
| | | | bytecodes.c (#106758)
* gh-106603: Make uop struct a triple (opcode, oparg, operand) (#106794)Guido van Rossum2023-07-17
|
* gh-106581: Add 10 new opcodes by allowing `assert(kwnames == NULL)` (#106707)Guido van Rossum2023-07-17
| | | | | | | | | | | | | By turning `assert(kwnames == NULL)` into a macro that is not in the "forbidden" list, many instructions that formerly were skipped because they contained such an assert (but no other mention of `kwnames`) are now supported in Tier 2. This covers 10 instructions in total (all specializations of `CALL` that invoke some C code): - `CALL_NO_KW_TYPE_1` - `CALL_NO_KW_STR_1` - `CALL_NO_KW_TUPLE_1` - `CALL_NO_KW_BUILTIN_O` - `CALL_NO_KW_BUILTIN_FAST` - `CALL_NO_KW_LEN` - `CALL_NO_KW_ISINSTANCE` - `CALL_NO_KW_METHOD_DESCRIPTOR_O` - `CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS` - `CALL_NO_KW_METHOD_DESCRIPTOR_FAST`
* gh-106706: Streamline family syntax in cases generator DSL (#106716)Kevin Diem2023-07-16
| | | | From `family(opname, STRUCTSIZE) = OPNAME + SPEC1 + ... + SPECn;` to `family(OPNAME, STRUCTSIZE) = SPEC1 + ... + SPECn;`
* gh-106529: Fix subtle Tier 2 edge case with list iterator (#106756)Guido van Rossum2023-07-14
| | | | | | | | | | | | The Tier 2 opcode _IS_ITER_EXHAUSTED_LIST (and _TUPLE) didn't set it->it_seq to NULL, causing a subtle bug that resulted in test_exhausted_iterator in list_tests.py to fail when running all tests with -Xuops. The bug was introduced in gh-106696. Added this as an explicit test. Also fixed the dependencies for ceval.o -- it depends on executor_cases.c.h.
* gh-106529: Split FOR_ITER_{LIST,TUPLE} into uops (#106696)Guido van Rossum2023-07-13
| | | | Also rename `_ITER_EXHAUSTED_XXX` to `_IS_ITER_EXHAUSTED_XXX` to make it clear this is a test.
* gh-106701: Move the hand-written Tier 2 uops to bytecodes.c (#106702)Guido van Rossum2023-07-13
| | | | | | | This moves EXIT_TRACE, SAVE_IP, JUMP_TO_TOP, and _POP_JUMP_IF_{FALSE,TRUE} from ceval.c to bytecodes.c. They are no less special than before, but this way they are discoverable o the copy-and-patch tooling.
* GH-104909: Split `LOAD_ATTR_INSTANCE_VALUE` into micro-ops (GH-106678)Mark Shannon2023-07-13
|
* gh-106529: Split FOR_ITER_RANGE into uops (#106638)Guido van Rossum2023-07-12
| | | | For an example of what this does for Tier 1 and Tier 2, see https://github.com/python/cpython/issues/106529#issuecomment-1631649920
* GH-104909: Break LOAD_GLOBAL specializations in micro-ops. (GH-106677)Mark Shannon2023-07-12
|
* gh-106307: C API: Add PyMapping_GetOptionalItem() function (GH-106308)Serhiy Storchaka2023-07-11
| | | | Also add PyMapping_GetOptionalItemString() function.