summaryrefslogtreecommitdiffstats
path: root/Python/specialize.c
Commit message (Collapse)AuthorAgeFilesLines
* GH-105848: Replace KW_NAMES + CALL with LOAD_CONST + CALL_KW (GH-109300)Brandt Bucher2023-09-131-56/+26
|
* GH-109330: Dump and compare stats using opcode names, not numbers (GH-109335)Michael Droettboom2023-09-121-8/+8
|
* gh-109039: Branch prediction for Tier 2 interpreter (#109038)Guido van Rossum2023-09-111-3/+17
| | | | | | | | | | | 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-108753: _Py_PrintSpecializationStats() uses Py_hexdigits (#109040)Victor Stinner2023-09-071-2/+2
|
* gh-108753: Enhance pystats (#108754)Victor Stinner2023-09-061-32/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Statistics gathering is now off by default. Use the "-X pystats" command line option or set the new PYTHONSTATS environment variable to 1 to turn statistics gathering on at Python startup. Statistics are no longer dumped at exit if statistics gathering was off or statistics have been cleared. Changes: * Add PYTHONSTATS environment variable. * sys._stats_dump() now returns False if statistics are not dumped because they are all equal to zero. * Add PyConfig._pystats member. * Add tests on sys functions and on setting PyConfig._pystats to 1. * Add Include/cpython/pystats.h and Include/internal/pycore_pystats.h header files. * Rename '_py_stats' variable to '_Py_stats'. * Exclude Include/cpython/pystats.h from the Py_LIMITED_API. * Move pystats.h include from object.h to Python.h. * Add _Py_StatsOn() and _Py_StatsOff() functions. Remove '_py_stats_struct' variable from the API: make it static in specialize.c. * Document API in Include/pystats.h and Include/cpython/pystats.h. * Complete pystats documentation in Doc/using/configure.rst. * Don't write "all zeros" stats: if _stats_off() and _stats_clear() or _stats_dump() were called. * _PyEval_Fini() now always call _Py_PrintSpecializationStats() which does nothing if stats are all zeros. Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* gh-108765: Cleanup #include in Python/*.c files (#108977)Victor Stinner2023-09-061-3/+3
| | | Mention one symbol imported by each #include.
* gh-108488: Initialize JUMP_BACKWARD cache to 0, not 17 (#108591)Guido van Rossum2023-08-291-1/+3
| | | This mis-initialization caused the executor optimization to kick in sooner than intended. It also set the lower 4 bits of the counter to `1` -- those bits are supposed to be reserved (the actual counter is in the upper 12 bits).
* gh-107265: Revert "Ensure _PyCode_Quicken does not handle ENTER_EXECUTOR" ↵Dong-hee Na2023-08-251-2/+0
| | | | | | | (#108485) This reverts commit d6ac5c7b105fe57266bd71248e3ada41fedb5ba9. Reason: the assert we just added could be triggered (see issue).
* gh-107265: Ensure _PyCode_Quicken does not handle ENTER_EXECUTOR (gh-108460)Dong-hee Na2023-08-241-0/+2
|
* gh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. ↵Irit Katriel2023-08-231-1/+4
| | | | (#108367)
* GH-106485: Dematerialize instance dictionaries when possible (GH-106539)Brandt Bucher2023-08-091-5/+14
|
* GH-105848: Simplify the arrangement of CALL's stack (GH-107788)Brandt Bucher2023-08-091-0/+8
|
* GH-107596: Specialize str[int] (GH-107597)Brandt Bucher2023-08-081-11/+14
|
* Add some GC stats to Py_STATS (GH-107581)Mark Shannon2023-08-041-1/+17
|
* gh-106869: Use new PyMemberDef constant names (#106871)Victor Stinner2023-07-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-106320: Move _PyMethodWrapper_Type to internal C API (#107064)Victor Stinner2023-07-221-2/+2
|
* GH-100288: Specialize LOAD_ATTR for simple class attributes. (#105990)Mark Shannon2023-07-101-13/+22
| | | * Add two more specializations of LOAD_ATTR.
* gh-106320: Fix specialize.c compilation by including pycore_pylifecycle.h ↵Guido van Rossum2023-07-041-0/+1
| | | | | (#106434) Compilation of Python/specialize.c was broken on macOS for me by gh-106400.
* GH-106008: Make implicit boolean conversions explicit (GH-106003)Brandt Bucher2023-06-291-3/+110
|
* gh-104584: Baby steps towards generating and executing traces (#105924)Guido van Rossum2023-06-271-0/+4
| | | | | 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-5/+94
|
* GH-105840: Fix assertion failures when specializing calls with too many ↵Brandt Bucher2023-06-161-2/+2
| | | | __defaults__ (GH-105847)
* GH-105229: Remove remaining two-codeunit superinstructions (GH-105326)Mark Shannon2023-06-081-10/+0
| | | | * Remove LOAD_CONST__LOAD_FAST and LOAD_FAST__LOAD_CONST superinstructions.
* GH-105229: Replace some superinstructions with single instruction ↵Mark Shannon2023-06-051-11/+1
| | | | equivalent. (GH-105230)
* GH-104405: Add missing PEP 523 checks (GH-104406)Brandt Bucher2023-05-121-0/+22
|
* gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270)Carl Meyer2023-05-111-28/+5
|
* GH-102181: Improve specialization stats for SEND (GH-102182)penguin_wwy2023-05-101-41/+45
|
* gh-104184: fix building --with-pydebug --enable-pystats (#104217)Carl Meyer2023-05-091-1/+1
|
* GH-103082: Code cleanup in instrumentation code (#103474)Mark Shannon2023-04-291-1/+1
|
* gh-103978: avoid using 'class' as an identifier (#103979)Carl Meyer2023-04-281-3/+3
|
* gh-103879: Fix refleak in super specialization (#103882)Jelle Zijlstra2023-04-261-0/+2
|
* gh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809)Carl Meyer2023-04-251-0/+55
|
* GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython ↵Mark Shannon2023-04-121-2/+6
| | | | | | | | | | (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-5/+0
|
* GH-89987: Shrink the BINARY_SUBSCR caches (GH-103022)Brandt Bucher2023-03-291-8/+8
|
* GH-100982: Break up COMPARE_AND_BRANCH (GH-102801)Brandt Bucher2023-03-231-60/+32
|
* GH-101291: Rearrange the size bits in PyLongObject (GH-102464)Mark Shannon2023-03-221-4/+4
| | | | | | | | | | * Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts. * Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints. * Add functions to hide some internals of long object, and for setting sign and digit count. * Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().
* GH-90997: Shrink the LOAD_GLOBAL caches (#102569)Brandt Bucher2023-03-111-2/+10
|
* gh-100227: Move next_keys_version to PyInterpreterState (gh-102335)Eric Snow2023-03-091-5/+11
| | | https://github.com/python/cpython/issues/100227
* GH-100982: Restrict `FOR_ITER_RANGE` to a single instruction to allow ↵Mark Shannon2023-02-221-3/+1
| | | | instrumentation. (GH-101985)
* gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)Steve Dower2023-02-201-86/+86
| | | | | | * gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h * Make cases_generator correct on Windows
* GH-87849: Simplify stack effect of SEND and specialize it for generators and ↵Mark Shannon2023-02-131-1/+24
| | | | coroutines. (GH-101788)
* GH-100288: Skip extra work when failing to specialize LOAD_ATTR (GH-101354)Brandt Bucher2023-01-311-60/+24
|
* GH-101291: Refactor the `PyLongObject` struct into object header and ↵Mark Shannon2023-01-301-1/+1
| | | | PyLongValue struct. (GH-101292)
* gh-100712: make it possible to disable specialization (for debugging) (#100713)Irit Katriel2023-01-191-0/+12
|
* GH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983)Mark Shannon2023-01-161-42/+39
|
* GH-100923: Embed jump mask in `COMPARE_OP` oparg (GH-100924)Mark Shannon2023-01-111-27/+26
|
* GH-100288: Remove LOAD_ATTR_METHOD_WITH_DICT instruction. (GH-100753)Mark Shannon2023-01-051-3/+2
|
* Revert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries ↵Ken Jin2022-12-231-10/+5
| | | | | (GH-100289)" (#100468) This reverts commit c3c7848a48b74a321632202e4bdcf2f465fb1cc6.
* gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)Ken Jin2022-12-231-5/+10
|