summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-106706: Streamline family syntax in cases generator DSL (#106716)Kevin Diem2023-07-161-26/+13
| | | | 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-151-2/+12
| | | | | | | | | | | | 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-141-34/+95
| | | | 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-131-0/+30
| | | | | | | 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-131-3/+16
|
* gh-106529: Split FOR_ITER_RANGE into uops (#106638)Guido van Rossum2023-07-121-4/+23
| | | | 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-121-10/+29
|
* gh-106307: C API: Add PyMapping_GetOptionalItem() function (GH-106308)Serhiy Storchaka2023-07-111-92/+24
| | | | Also add PyMapping_GetOptionalItemString() function.
* GH-106529: Define POP_JUMP_IF_NONE in terms of POP_JUMP_IF_TRUE (GH-106599)Mark Shannon2023-07-111-9/+7
|
* gh-106572: Convert PyObject_DelAttr() to a function (#106611)Victor Stinner2023-07-111-1/+1
| | | | | | | | * Convert PyObject_DelAttr() and PyObject_DelAttrString() macros to functions. * Add PyObject_DelAttr() and PyObject_DelAttrString() functions to the stable ABI. * Replace PyObject_SetAttr(obj, name, NULL) with PyObject_DelAttr(obj, name).
* GH-100288: Specialize LOAD_ATTR for simple class attributes. (#105990)Mark Shannon2023-07-101-6/+37
| | | * Add two more specializations of LOAD_ATTR.
* GH-106057: Handle recursion errors in inline class calls properly. (GH-106108)Mark Shannon2023-07-071-3/+4
|
* gh-104584: Fix error handling from backedge optimization (#106484)Guido van Rossum2023-07-061-1/+1
| | | | | | | | | | | | When `_PyOptimizer_BackEdge` returns `NULL`, we should restore `next_instr` (and `stack_pointer`). To accomplish this we should jump to `resume_with_error` instead of just `error`. The problem this causes is subtle -- the only repro I have is in PR gh-106393, at commit d7df54b139bcc47f5ea094bfaa9824f79bc45adc. But the fix is real (as shown later in that PR). While we're at it, also improve the debug output: the offsets at which traces are identified are now measured in bytes, and always show the start offset. This makes it easier to correlate executor calls with optimizer calls, and either with `dis` output. <!-- gh-issue-number: gh-104584 --> * Issue: gh-104584 <!-- /gh-issue-number -->
* GH-104584: Fix ENTER_EXECUTOR (GH-106141)Mark Shannon2023-07-031-7/+12
| | | | | | * Check eval-breaker in ENTER_EXECUTOR. * Make sure that frame->prev_instr is set before entering executor.
* gh-106023: Update code using _PyObject_FastCall() (#106257)Victor Stinner2023-06-301-1/+0
| | | Replace _PyObject_FastCall() calls with PyObject_Vectorcall().
* GH-106008: Make implicit boolean conversions explicit (GH-106003)Brandt Bucher2023-06-291-44/+100
|
* gh-105775: Convert LOAD_CLOSURE to a pseudo-op (#106059)hms2023-06-291-6/+3
| | | | | | This enables super-instruction formation, removal of checks for uninitialized variables, and frees up an instruction.
* gh-104584: Baby steps towards generating and executing traces (#105924)Guido van Rossum2023-06-271-3/+1
| | | | | Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose). All of this code is likely to change dramatically before the 3.13 feature freeze. But this is a first step.
* GH-91095: Specialize calls to normal Python classes. (GH-99331)Mark Shannon2023-06-221-0/+63
|
* GH-104584: Assorted fixes for the optimizer API. (GH-105683)Mark Shannon2023-06-191-1/+2
| | | | | | * Add test for long loops * Clear ENTER_EXECUTOR when deopting code objects.
* gh-105481: add HAS_JUMP flag to opcode metadata (#105791)Irit Katriel2023-06-141-15/+19
|
* GH-77273: Better bytecodes for f-strings (GH-6132)Mark Shannon2023-06-141-30/+24
|
* GH-100987: Allow objects other than code objects as the "executable" of an ↵Mark Shannon2023-06-141-15/+14
| | | | | | | | | | internal frame. (GH-105727) * Add table describing possible executable classes for out-of-process debuggers. * Remove shim code object creation code as it is no longer needed. * Make lltrace a bit more robust w.r.t. non-standard frames.
* gh-105481: add flags to each instr in the opcode metadata table, to replace ↵Irit Katriel2023-06-131-25/+27
| | | | opcode.hasarg/hasname/hasconst (#105482)
* GH-105678: Split MAKE_FUNCTION into MAKE_FUNCTION and SET_FUNCTION_ATTRIBUTE ↵Mark Shannon2023-06-131-25/+30
| | | | (GH-105680)
* gh-105481: add pseudo-instructions to the bytecodes DSL (#105506)Irit Katriel2023-06-111-0/+47
|
* GH-105229: Remove remaining two-codeunit superinstructions (GH-105326)Mark Shannon2023-06-081-3/+0
| | | | * Remove LOAD_CONST__LOAD_FAST and LOAD_FAST__LOAD_CONST superinstructions.
* GH-104610: Remove the use of `PREDICT` macros. (GH-104651)Mark Shannon2023-06-071-13/+0
|
* GH-105229: Replace some superinstructions with single instruction ↵Mark Shannon2023-06-051-7/+25
| | | | equivalent. (GH-105230)
* gh-105214: Use named constants for MAKE_FUNCTION oparg (#105215)Jelle Zijlstra2023-06-021-8/+9
|
* GH-104584: Plugin optimizer API (GH-105100)Mark Shannon2023-06-021-3/+29
|
* remove unused #includes of pycore_pymem.h (#105166)Irit Katriel2023-06-011-1/+0
|
* gh-104909: Split BINARY_OP into micro-ops (#104910)Guido van Rossum2023-05-311-46/+68
| | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* gh-105035: fix super() calls on unusual types (e.g. meta-types) (#105094)Carl Meyer2023-05-301-1/+3
|
* GH-104580: Don't cache eval breaker in interpreter (GH-104581)Mark Shannon2023-05-181-3/+2
| | | Move eval-breaker to the front of the interpreter state.
* GH-103906: Remove immortal refcounting in the interpreter (GH-103909)Brandt Bucher2023-05-161-32/+14
|
* gh-103865: add monitoring support to LOAD_SUPER_ATTR (#103866)Carl Meyer2023-05-161-0/+32
|
* gh-103763: Implement PEP 695 (#103764)Jelle Zijlstra2023-05-161-17/+36
| | | | | | | | | | | | | | This implements PEP 695, Type Parameter Syntax. It adds support for: - Generic functions (def func[T](): ...) - Generic classes (class X[T](): ...) - Type aliases (type X = ...) - New scoping when the new syntax is used within a class body - Compiler and interpreter changes to support the new syntax and scoping rules Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Eric Traut <eric@traut.com> Co-authored-by: Larry Hastings <larry@hastings.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* GH-104405: Add missing PEP 523 checks (GH-104406)Brandt Bucher2023-05-121-2/+6
|
* GH-103082: Filter LINE events in VM, to simplify tool implementation. ↵Mark Shannon2023-05-121-22/+0
| | | | | | | | (GH-104387) When monitoring LINE events, instrument all instructions that can have a predecessor on a different line. Then check that the a new line has been hit in the instrumentation code. This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
* gh-104413: Fix refleak when super attribute throws AttributeError (#104414)Jelle Zijlstra2023-05-121-1/+1
|
* gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270)Carl Meyer2023-05-111-9/+31
|
* gh-87849: fix SEND specialization family definition (GH-104268)Carl Meyer2023-05-111-2/+2
|
* gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)Carl Meyer2023-05-091-0/+6
| | | | Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-98003: Inline call frames for CALL_FUNCTION_EX (GH-98004)Ken Jin2023-04-301-0/+19
|
* gh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809)Carl Meyer2023-04-251-26/+39
|
* gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)Carl Meyer2023-04-241-0/+31
| | | | | This speeds up `super()` (by around 85%, for a simple one-level `super().meth()` microbenchmark) by avoiding allocation of a new single-use `super()` object on each use.
* GH-103488: Use return-offset, not yield-offset. (GH-103502)Mark Shannon2023-04-131-10/+18
| | | | * Use return-offset, not yield-offset, so that instruction pointer is correct when sending to a generator or coroutine.
* GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython ↵Mark Shannon2023-04-121-95/+347
| | | | | | | | | | (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-88691: Shrink the CALL caches (GH-103230)Brandt Bucher2023-04-051-19/+24
|